简单的网络服务
@WebService
@Stateless
public class HistoryFormatterWebService implements IHistoryFormatterWebService
{
@EJB
private IHistoryFormatter historyFormatter;
public byte[] formatHistory(final byte[] data)
{
System.err.println("hello from service");
return null;
}
}
IHistoryFormatter
@Local
public interface IHistoryFormatter
{
// ..
}
IHistoryFormatter 是来自另一个项目(query-ear.ear)的 bean,但他也部署在 jBoss 上。
我的 WebService 正常部署在 jBoss 上。jBoss 写道
11:17:09,506 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=wsformatter-ear-1.0-SNAPSHOT.ear,jar=wsformatter-ejb-1.0-SNAPSHOT.jar,name=HistoryFormatterWebService,service=EJB3 with dependencies:
11:17:09,568 INFO [JmxKernelAbstraction] jboss.j2ee:ear=query-ear.ear,jar=query-services.jar,name=HistoryFormatter,service=EJB3
11:17:09,568 INFO [EJBContainer] STARTED EJB: com.wsformatter.HistoryFormatterWebService ejbName: HistoryFormatterWebService
但是当我向它发送请求时(使用 SoapUI)我得到了异常
java.lang.RuntimeException: Non matching type for inject of field: private com.softcomputer.softlab.lquery.service.IHistoryFormatter com.softcomputer.wsformatter.HistoryFormatterWebService.historyFormatter for type: $Proxy250 of jndiName env/com.softcomputer.wsformatter.HistoryFormatterWebService/historyFormatter
intfs: , com.softcomputer.softlab.lquery.service.IHistoryFormatter, org.jboss.ejb3.JBossProxy
at org.jboss.injection.JndiFieldInjector.inject(JndiFieldInjector.java:128)
at org.jboss.injection.JndiFieldInjector.inject(JndiFieldInjector.java:106)
at org.jboss.injection.JndiFieldInjector.inject(JndiFieldInjector.java:63)
at org.jboss.ejb3.AbstractPool.create(AbstractPool.java:111)
at org.jboss.ejb3.InfinitePool.get(InfinitePool.java:49)
at org.jboss.ejb3.ThreadlocalPool.create(ThreadlocalPool.java:50)
at org.jboss.ejb3.ThreadlocalPool.get(ThreadlocalPool.java:90)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.wsf.container.jboss42.InvocationHandlerEJB3.invoke(InvocationHandlerEJB3.java:103)
at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:221)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:466)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:284)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:201)
at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:134)
at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java:84)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.IllegalArgumentException
at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
at java.lang.reflect.Field.set(Field.java:656)
at org.jboss.injection.JndiFieldInjector.inject(JndiFieldInjector.java:116)
... 41 more
有人能帮我吗?