[jboss-user] [JBossCache] - PojoCache with Compile Time Weaving on JBoss 4.2.0 ?

mbroons do-not-reply at jboss.com
Mon Jul 9 04:33:24 EDT 2007


I'm facing some trouble trying to use PojoCache with Compile Time Weaving on JBoss 4.2.0.

I have a DemoService exposing a DemoServiceRemote interface. The interface allows a client application to subscribe/unsubscribe to the service (subscribe, unSubscribe methods) and to invoke a method on the service (invoke method)

The service stores the client sessions into Arralist attribute where ClientSession is defined as follow:

@PojoCacheable
public class ClientSession  {
    String sessionId = null;
    ...

The DemoService works fine as long as i use Load Time Weaving on JBoss AS, although Load Time Weaving seems to really slow down the application server start up.

I did not manage to make it work using Compile Time Weaving.
I followed the procedure described here:
http://wiki.jboss.org/wiki/Wiki.jsp?page=PojoCacheAS405

I "aopc" compiled My ClientSession class to create the instrumented version of the class.  
I packaged all class files (original classes + generated classes) in a 
single DemoService.jar file. (My service is built using the EJB 3.0 @Service but the same behavior was experimented when building my service as a mbean service)

When the service.subscribe() method is called from the client the following exception is raised:

javax.ejb.EJBException: java.lang.ClassCastException: pojo.ClientSession
  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.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.service.ServiceContainer.dynamicInvoke(ServiceContainer.java:353)
  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:369)
  at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165)
Caused by: java.lang.ClassCastException: pojo.ClientSession
  at org.jboss.aspects.patterns.observable.SubjectInterceptor.invoke(SubjectInterceptor.java:50)
  at pojo.ClientSession$sessionId_Set.invokeNext(ClientSession$sessionId_Set.java)
  at pojo.ClientSession.sessionId_w_$aop(ClientSession.java)
  at pojo.ClientSession.(ClientSession.java:11)
  at ejbservice.DemoService.subscribe(DemoService.java:67)
  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.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.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.service.ServiceContainer.dynamicInvoke(ServiceContainer.java:353)
  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:369)
  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.service.ServiceRemoteProxy.invoke(ServiceRemoteProxy.java:94)
  at $Proxy7.subscribe(Unknown Source)
  at client.DemoServiceDelegate.subscribe(DemoServiceDelegate.java:33)
  at client.DemoServiceDelegateTest.testSubscribe(DemoServiceDelegateTest.java:30)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method.invoke(Unknown Source)
  at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
  at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
  at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
  at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
  at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
  at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
  at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
  at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
  at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
  at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
  at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:32)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
  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.service.ServiceRemoteProxy.invoke(ServiceRemoteProxy.java:94)
  at $Proxy7.subscribe(Unknown Source)
  at client.DemoServiceDelegate.subscribe(DemoServiceDelegate.java:33)
  at client.DemoServiceDelegateTest.testSubscribe(DemoServiceDelegateTest.java:30)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method.invoke(Unknown Source)
  at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
  at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
  at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
  at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
  at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
  at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
  at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
  at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
  at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
  at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
  at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:32)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

Is the problem due to the way i package my service ?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4061839#4061839

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4061839



More information about the jboss-user mailing list