[
http://jira.jboss.com/jira/browse/EJBTHREE-1018?page=all ]
Michael Pfeiffer updated EJBTHREE-1018:
---------------------------------------
Attachment: jboss.example.src.zip
Notes about the sample code:
The projects are provided as Eclipse Java projects.
- jboss.example.core ... the implementation CoreBean
- jboss.example.core.client ... the remote interface ICoreBean and user defined class
Value
- jboss.example.service1 ... the ServiceBean 1 that uses CoreBean
- jboss.example.service2 ... the ServiceBean 2 that uses CoreBean
- jboss.example.test ... test cases that call Service Bean 1 and 2 sequentially and
concurrently
Building:
Build scripts are within folder "build" in each project.
They expect a user library named "JBoss Server" that includes .jar files of a
JBoss installation
(lib/*.jar, lib/endorsed/*.jar, server/default/lib/*.jar and
server/defalt/deploy/ejb3.deployer/*.jar).
Additionally the Ant property "artifactDirectory" has to be set to directory for
the built EAR files.
To build all EAR files run jboss.example.test/build/build.xml.
Deployment:
Two JBoss instances are needed A and B.
Copy jboss.example.core.ear into A/server/default/deploy.
Copy jboss.example.service1.ear and jboss.example.service2.ear into
B/server/default/deploy.
Run JBoss instance A:
cd A/bin
run --host=IP_ADDRESS_OF_HOST_A
Run Jboss instance B:
cd B/bin
run --host=IP_ADDRESS_OF_HOST_B -Dcore.url=IP_ADDRESS_OF_HOST_A
Run the unit tests within Eclipse.
Before running the unit tests set the property java.naming.provider.url to
IP_ADDRESS_OF_HOST_B in file jboss.example.test/src/jndi.properties.
Run the jboss.example.test/TestServices
- testConcurrentServices should fail (several attempts could be needed)
- testService1, testService2 and testSequentialServices should be successful
Source code snippets:
The remote interface for CoreBean (bean C from description):
@Remote()
public interface ICoreBean {
public Value getObject();
}
with class Value:
public class Value implements Serializable {
private static final long serialVersionUID = -321075498467824372L;
private String value;
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
The stack trace:
javax.ejb.EJBException: java.lang.ClassCastException: jboss.example.core.client.Value
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at
org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at
org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
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:106)
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.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
at
org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:734)
at
org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:560)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:383)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165)
Caused by: java.lang.ClassCastException: jboss.example.core.client.Value
at $Proxy74.getObject(Unknown Source)
at jboss.example.service1.ServiceBean.getObject(ServiceBean.java:18)
at sun.reflect.GeneratedMethodAccessor73.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
at
org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
at
org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at
org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at
org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at
org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at
org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
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:106)
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.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
at
org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:734)
at
org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:560)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:383)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165)
at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:163)
at org.jboss.remoting.Client.invoke(Client.java:1550)
at org.jboss.remoting.Client.invoke(Client.java:530)
at
org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at
org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at
org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:72)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:103)
at $Proxy0.getObject(Unknown Source)
at jboss.example.test.TestServices$1.work(TestServices.java:79)
at jboss.example.test.TestServices$Worker.run(TestServices.java:48)
at java.lang.Thread.run(Thread.java:595)
at
org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at
org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at
org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:72)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:103)
at $Proxy0.getObject(Unknown Source)
at jboss.example.test.TestServices$1.work(TestServices.java:79)
at jboss.example.test.TestServices$Worker.run(TestServices.java:48)
at java.lang.Thread.run(Thread.java:595)
ClassCastException on concurrent EJB3 method invocation from
different beans
----------------------------------------------------------------------------
Key: EJBTHREE-1018
URL:
http://jira.jboss.com/jira/browse/EJBTHREE-1018
Project: EJB 3.0
Issue Type: Bug
Affects Versions: AS 4.2.0 GA, AS 4.2.1.GA
Environment: Java: JDK 1.5.0_11
Eclipse: SDK 3.2.2
Reporter: Michael Pfeiffer
Attachments: deployables.zip, jboss.example.src.zip
Two different EJB3 stateless session beans A and B packaged into separate EAR files
deployed on the same JBoss instance
invoke a method of another stateless session bean C on another JBoss instance that
returns an object of a user
defined class Value.
There seems to be a multi-threading issue.
Sometimes when both beans concurrently call the method of C an ClassCastException Value
is thrown within the remote
interface proxy before the result object is returned to the calling bean.
The class Value and the remote interface for C are packaged into a JAR file within each
EAR file inside a "lib" folder.
If this JAR file is deployed instead and not packaged into the EAR files of bean A and B
everything works fine.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira