小编Pat*_*atz的帖子

获取java.lang.NoSuchMethodException:使用PropertyUtils.setSimpleProperty函数时,属性“ xx”在类“类xx”中没有setter方法

我正在使用PropertyUtils.setSimpleProperty来动态调用我的setter方法,但是由于某些原因,我一直在出错。需要您的协助以找出根本原因。这是我的代码:

class FileDt {
    String reportName=null;
    String reportLocation=null;

    public String getReportName() {
        return reportName;
    }
    public void setReportName(String reportName) {
        this.reportName = reportName;
    }
    public String getReportLocation() {
        return reportLocation;
    }
    public void setReportLocation(String reportLocation) {
        this.reportLocation = reportLocation;
    }
}

class Foo {
    public static void main (String... args) {
        FileDt dt = newFileDt();
        // #1
        PropertyUtilsBean.setSimpleProperty(dt, "reportName", "abc.html");
        // #2
        PropertyUtilsBean.setSimpleProperty(dt, "reportLocation", "c://");
    }
}
Run Code Online (Sandbox Code Playgroud)

这两种方法都抛出异常

  1. 由以下原因引起:java.lang.NoSuchMethodException:属性'reportName'在org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:2096)的类'FileDt'中没有setter方法

  2. 由以下原因引起:java.lang.NoSuchMethodException:属性'reportLocation'在org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:2096)的类'FileDt'中没有setter方法

java javabeans nosuchmethoderror

5
推荐指数
1
解决办法
702
查看次数

尝试使用 -secret 选项通过 JNLP 通过命令行启动 Jenkins slave 时出现 401 Unauthorized 错误

我正在尝试通过 JNLP 通过命令行启动我的 Jenkins slave,以便我可以将命令放入任务调度程序中。但是,只有当我将 -secret 选项与 Jenkins 生成的密钥一起使用时,我才会面临身份验证问题。如果我使用与 Jenkins 相同的用户名密码传递 -auth 选项,则工作正常。

java -jar slave.jar -jnlpUrl http://<jenkins host>:<port>/jenkins/computer/<Slave name>/slave-agent.jnlp -secret <secret_key> -workDir "C:\Jenkins\Robot"
Run Code Online (Sandbox Code Playgroud)

注意:我尝试执行的命令是从 Jenkins 页面复制的。

它给出以下错误:

 org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDirINFO: Using C:\Jenkins\Robot\remoting as a remoting work directory Both error and output logs will be printed to C:\Jenkins\Robot\remoting Not use http_proxy property or environment variable which is invalid: unknown protocol: one.proxy.att.com Failing to obtain http://<host:port>/jenkins/computer/<job>/slave-agent.jnlp?encrypt=true
 java.io.IOException: Failed to load http://<host:port>/jenkins/computer/<job>//slave-agent.jnlp?encrypt=true: 401 Unauthorized
         at hudson.remoting.Launcher.parseJnlpArguments(Launcher.java:485)
         at hudson.remoting.Launcher.run(Launcher.java:316)
         at hudson.remoting.Launcher.main(Launcher.java:277)
 Waiting 10 seconds …
Run Code Online (Sandbox Code Playgroud)

jnlp cmd jenkins jenkins-slave

5
推荐指数
1
解决办法
2109
查看次数

使用 tomcat7-maven-plugin 部署 Tomcat 失败并显示错误“无法调用 Tomcat 管理器:对等方重置连接:套接字写入错误”

我正在尝试使用 Tomcat7-Maven-Plugin 为我的战争设置自动部署到 Tomcat。但是,它无法部署文件。从控制台消息来看,它似乎开始部署,但在 ard 2 MB 传输后被中断。所有重试都会发生同样的情况,最终失败。

$ mvn tomcat7:redeploy
    .
    .
    .  
[INFO] Deploying war to http://localhost:8080/policy-service
Uploading: http://localhost:8080/manager/text/deploy?path=%2Fpolicy-service&update=true
2244/52241 KB
[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2Fpolicy-service&update=true
2242/52241 KB
[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2Fpolicy-service&update=true
2242/52241 KB
[INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket …
Run Code Online (Sandbox Code Playgroud)

java plugins tomcat maven tomcat8.5

3
推荐指数
1
解决办法
3614
查看次数