EJB provider run only once
--------------------------
Key: AXIS2-3947
URL: https://issues.apache.org/jira/browse/AXIS2-3947
Project: Axis 2.0 (Axis2)
Issue Type: Bug
Components: rpc
Affects Versions: 1.3, 1.4
Environment: Weblogic 10.0MP1 (10.0.1.0)
JDK 1.5.0_15-b04
Windows XP SP2, Solaris 10
Reporter: Jean-Philippe HAUTIN
Priority: Blocker
I made a simple web service towards an EJB using Axis2 1.3, following the
tutorial at this URL http://ws.apache.org/axis2/1_2/ejb-provider.html
It works fine once (the first run) but when I try to run it a second time in a
row, I have this response in SOAP UI
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>object is not an instance of declaring class</faultstring>
<detail>
<Exception>org.apache.axis2.AxisFault: object is not an instance of
declaring class
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:417)
at
org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:156)
at
org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at
org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:96)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)
at
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
at
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:120)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:226)
at
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:124)
at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3370)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2117)
at
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2023)
at
weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1359)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)
Caused by: java.lang.IllegalArgumentException: object is not an instance of
declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:194)
at
org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:98)
... 19 more</Exception>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
I investigated a bit. I found out a problem within the « caching system » used
to prevent introspection to resolve which Java method/class to call.
Here is a simple of
org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic() :
Object obj = getTheImplementationObject(inMessage);
Class ImplClass = obj.getClass();
AxisOperation op =
inMessage.getOperationContext().getAxisOperation();
method = (Method)(op.getParameterValue("myMethod"));
AxisService service = inMessage.getAxisService();
OMElement methodElement =
inMessage.getEnvelope().getBody().getFirstElement();
AxisMessage inAxisMessage =
op.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
String messageNameSpace = null;
if (method == null) {
String methodName = op.getName().getLocalPart();
Method[] methods = ImplClass.getMethods();
for (int i = 0; i < methods.length; i++) {
if (methods[i].getName().equals(methodName)) {
method = methods[i];
op.addParameter("myMethod", method);
break;
}
}
if (method == null) {
throw new AxisFault("No such method '" + methodName +
"' in class " + ImplClass.getName());
}
}
The first time, everything is fine, "obj" is new, "method" is null and is fill
correctly with loop made of ImplClass.getMethods();. During the second call,
"obj" is a new instance but "method" comes from "op" and is the one from the
previous call. But it doesn't match "obj". "method" is related to the previous
instance of "obj" instanciated from the previous call. It seems that the saving
of "obj" in the ServiceContext class didn't work properly.
The quick fix is to comment the line method =
(Method)(op.getParameterValue("myMethod")); but that implies to launch the
introspection framework at every call. It may be time consuming.
I tested it with Axis2 1.3 and 1.4 too and it doesn't work any better
I make a unit Test Eclipse workspaces with 2 projects :
- project "ejbModuleWebService" is the project with a very simple EJB,
- project WebServiceEJB contains the web service definition.
We have the bug on Weblogic 10, I didn't test it on another application server.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]