[英]Java Wildfly javax.ejb.EJBException
I am working on project using java and wildfly 10. I have problem when I try to make rest request. 我正在使用Java和Wildfly 10开发项目。尝试发出休息请求时遇到问题。 I can not figure out where is the real problem.
我不知道真正的问题在哪里。 Here is a project source code: https://github.com/alien93/at and here is error from consele https://gist.github.com/MiselAdemi/f5876f6f4b2b6dffcfcf6598cd3ce903
这是项目源代码: https : //github.com/alien93/at ,这是consele的错误https://gist.github.com/MiselAdemi/f5876f6f4b2b6dffcfcf6598cd3ce903
Can somebody help me, or even just to give me some hint? 有人可以帮我,甚至可以给我一些提示吗?
Relevant part of the stacktrace is: stacktrace的相关部分是:
Caused by: java.lang.ClassCastException: java.util.ArrayList cannot be cast to session.HostsList
at session.HostBean.register(HostBean.java:71)
When we take a look to the row 71 in HostBean.java, we will find following: 当我们查看HostBean.java中的第71行时,将发现以下内容:
return (HostsList) Host.hosts;
As stacktrace says, Host.hosts
is not a HostList
. 正如stacktrace所说,
Host.hosts
不是HostList
。 Also it cannot be because type of of hosts
is something that implements java.util.List, in this case runtime type is ArrayList: 也不能是因为
hosts
类型是实现java.util.List的东西,在这种情况下,运行时类型是ArrayList:
public transient static List<Host> hosts = new ArrayList<Host>();
HostList
can be constructed and then returned as follows (in line 71 in HostBean.java): 可以构造
HostList
,然后按以下方式返回(在HostBean.java的第71行中):
HostsList hl = new HostList();
hl.setHosts(host.hosts);
return hosts;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.