[EJB/JBoss] - Getting ClassCastException during remote EJB call
by AbhayaJha
Hi,
I am migrating jboss-3.2.3 to Jboss-4.0.5.GA.
I have two say first.ear and second.ear files deployed in the same JBoss-4.0.5.GA server. When ejb deployed in first.ear is invoked from second.ear, ClassCastException is thrown. But for local bean call, it works fine.
Can some body help what is the actual reason for class cast exception?
I tried to debug it out and I found problem is at
ejbHome = (EJBHome) PortableRemoteObject.narrow(ref, clazz);
I also inspected ref object it contains the correct home name as we are passing as second argument.
StackTrace is as below:
17:23:13,306 DEBUG [ServiceLocatorConfigurator] Looking up for<ejb/PermDAO>
17:57:56,560 ERROR [STDERR] java.lang.ClassCastException
17:57:56,576 ERROR [STDERR] at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293)
17:57:56,576 ERROR [STDERR] at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
17:57:56,576 ERROR [STDERR] at com.db.dcs.model.settlements.ejb.services.locator.impl.ServiceLocatorConfigurator.getEJBHome(ServiceLocatorConfigurator.java:671)
17:57:56,576 ERROR [STDERR] at com.db.dcs.model.settlements.ejb.services.locator.impl.ServiceLocatorConfigurator.getEjbProvider(ServiceLocatorConfigurator.java:494)
17:57:56,576 ERROR [STDERR] at com.db.dcs.model.settlements.ejb.services.locator.impl.ServiceLocatorConfigurator.createProviderInstance(ServiceLocatorConfigurator.java:374)
17:57:56,591 ERROR [STDERR] at com.db.dcs.model.settlements.ejb.services.locator.impl.ServiceLocatorConfigurator.getServiceInstance(ServiceLocatorConfigurator.java:182)
17:57:56,591 ERROR [STDERR] at com.db.dcs.model.settlements.ejb.services.locator.impl.SimpleServiceFactoryImpl.getInstance(SimpleServiceFactoryImpl.java:80)
17:57:56,591 ERROR [STDERR] at com.db.dcs.model.settlements.ejb.services.locator.impl.SimpleServiceLocatorImpl.getService(SimpleServiceLocatorImpl.java:60)
17:57:56,591 ERROR [STDERR] at com.db.dcs.model.settlements.ejb.services.locator.ServiceLocator.getService(ServiceLocator.java:63)
17:57:56,607 ERROR [STDERR] at com.db.dcs.model.settlements.jboss.security.LdapDBLoginModule.validatePassword(LdapDBLoginModule.java:217)
17:57:56,607 ERROR [STDERR] at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:210)
17:57:56,607 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
17:57:56,607 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
17:57:56,607 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
17:57:56,623 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
17:57:56,623 ERROR [STDERR] at javax.security.auth.login.LoginContext.invoke(LoginContext.java:675)
17:57:56,623 ERROR [STDERR] at javax.security.auth.login.LoginContext.access$000(LoginContext.java:129)
17:57:56,623 ERROR [STDERR] at javax.security.auth.login.LoginContext$4.run(LoginContext.java:610)
17:57:56,623 ERROR [STDERR] at java.security.AccessController.doPrivileged(Native Method)
17:57:56,623 ERROR [STDERR] at javax.security.auth.login.LoginContext.invokeModule(LoginContext.java:607)
17:57:56,638 ERROR [STDERR] at javax.security.auth.login.LoginContext.login(LoginContext.java:534)
17:57:56,638 ERROR [STDERR] at org.jboss.security.plugins.JaasSecurityManager.defaultLogin(JaasSecurityManager.java:601)
17:57:56,638 ERROR [STDERR] at org.jboss.security.plugins.JaasSecurityManager.authenticate(JaasSecurityManager.java:535)
17:57:56,638 ERROR [STDERR] at org.jboss.security.plugins.JaasSecurityManager.isValid(JaasSecurityManager.java:344)
17:57:56,638 ERROR [STDERR] at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.authenticate(JBossSecurityMgrRealm.java:491)
17:57:56,654 ERROR [STDERR] at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:257)
17:57:56,654 ERROR [STDERR] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:416)
17:57:56,654 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
17:57:56,654 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
17:57:56,654 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
17:57:56,670 ERROR [STDERR] at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
17:57:56,670 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
17:57:56,670 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
17:57:56,670 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
17:57:56,685 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
17:57:56,685 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
17:57:56,685 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
17:57:56,685 ERROR [STDERR] at java.lang.Thread.run(Thread.java:534)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4036335#4036335
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4036335
19 years
[JBoss Seam] - No application context active when raising event
by novare
Hi,
I get anonymous wrote : java.lang.IllegalStateException: No application context active when updating an @Entity from a MDB. The @Entity raise an event on the @PostUpdate. If commenting the call to raiseEvent everything works. It also works when updating the @Entity from the user interface and the event is raised.
-A message is placed on a JMS queue which is picked up by a MDB (The MDB is a seam component).
-The MDB make a call to a workhandler (also seam component) , which again ends up in updating an ARRIVAL through the Arrival Entity.
-When Arrival is updated the following code is executed through @PostUpdate:
@PostUpdate
| public void afterUpdate(Arrival entity)
| {
| Events.instance().raiseEvent("arrivalUpdate", entity);
| }
-And this causes the following stacktrace:
11:30:34,436 INFO [STDOUT] Hibernate:
| update
| ARRIVAL
| set
| ARR_ETA=?,
| ARR_PTA=?,
| ARR_ATA=?,
| COS_ID=?
| where
| ARR_ID=?
| 11:30:34,451 ERROR [JmsServerSession] org.jboss.resource.adapter.jms.inflow.JmsServerSession@1b602b9 failed to commit/rollback
| org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=jarle/49, BranchQual=, localId=49] status=STATUS_NO_TRANSACTION; - nested throwable: (javax.persistence.PersistenceException: java.lang.IllegalStateException: No application context active)
| at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:372)
| at org.jboss.tm.TxManager.commit(TxManager.java:240)
| at org.jboss.resource.adapter.jms.inflow.JmsServerSession$XATransactionDemarcationStrategy.end(JmsServerSession.java:471)
| at org.jboss.resource.adapter.jms.inflow.JmsServerSession.run(JmsServerSession.java:260)
| at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:204)
| at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:275)
| at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
| at java.lang.Thread.run(Thread.java:595)
| Caused by: javax.persistence.PersistenceException: java.lang.IllegalStateException: No application context active
| at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:527)
| at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1491)
| at org.jboss.tm.TransactionImpl.beforePrepare(TransactionImpl.java:1110)
| at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:324)
| ... 7 more
| Caused by: java.lang.IllegalStateException: No application context active
| at org.jboss.seam.Component.forName(Component.java:1577)
| at org.jboss.seam.Component.getInstance(Component.java:1627)
| at org.jboss.seam.Component.getInstance(Component.java:1622)
| at org.jboss.seam.Component.getInstance(Component.java:1599)
| at org.jboss.seam.Component.getInstance(Component.java:1594)
| at org.jboss.seam.core.Events.instance(Events.java:138)
| at com.logit.sailingplan.domain.ArrivalListener.afterUpdate(ArrivalListener.java:84)
| 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.hibernate.ejb.event.ListenerCallback.invoke(ListenerCallback.java:31)
| at org.hibernate.ejb.event.EntityCallbackHandler.callback(EntityCallbackHandler.java:78)
| at org.hibernate.ejb.event.EntityCallbackHandler.postUpdate(EntityCallbackHandler.java:67)
| at org.hibernate.ejb.event.EJB3PostUpdateEventListener.onPostUpdate(EJB3PostUpdateEventListener.java:40)
| at org.hibernate.action.EntityUpdateAction.postUpdate(EntityUpdateAction.java:183)
| at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:162)
| at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
| at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
| at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
| at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
| at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
| at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:515)
| ... 10 more
-By commenting the raiseEvent it works and the Arrival is updated, but I'd like to have my event raised.
-My @Observer for the Event is empty (just log)
Anyone know what causes this behaviour? (I'm using seam 1.2.1.GA)
Regards Jarle
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4036332#4036332
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4036332
19 years