Catching javax.ejb.DuplicateKeyException
Here is the situation.
A weblogic workshop control calls a message bean.
The message bean calls a session bean.
The session beans does some junk and creates an entity bean.
During the create there is a possibilty of a javax.ejb.DuplicateKeyException being
thrown.
I am trying to catch this exception but for some reason the weblogic server is
catching and
and trying to restart the transaction by calling the message bean again.
By doing this it is an enless cycle of errors that will not stop untill you shut
down the weblogic server.
How can I catch this error to prevent this loop from happening?
Thanks for the response and the direction.
Its Bug No.6713854
Could you please shed some light on toplink flavors and support/fixes.
That is:
1. Is toplink that comes with OAS different than the open source toplink?
2. If so, how are bugs tracked. where should I go and look for the bugs for the open source version?
3. Could we use the open source version for OC4J?
Thanks :)
Similar Messages
-
Javax.ejb.DuplicateKeyException: Exception [EJB - 10007]
Hi,
I am deploying an EJB application in OAS10.1.3.1. (it comes with toplink)
The application executes bean.remove() and removes the bean and then it creates
the same bean again using bean.create() in the same transaction.
When bean.create() executes the following exception is encountered.
Is there any setting in toplink that will help me avoid this situation.
javax.ejb.DuplicateKeyException: Exception [EJB - 10007]: Exception creating bean of type [XXXX]. Bean already exists.
at oracle.toplink.internal.ejb.cmp.EJBExceptionFactory.duplicateKeyException(EJBExceptionFactory.java:195)
at oracle.toplink.internal.ejb.cmp.oc4j.Oc4jPersistenceManager.createBean(Oc4jPersistenceManager.java:163)
at com.evermind.server.ejb.interceptor.system.TopLinkCreateInterceptor.invoke(TopLinkCreateInterceptor.java:51)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:50)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.interceptor.system.SecurityRoleInterceptor.invoke(SecurityRoleInterceptor.java:47)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.InvocationContextPool.invoke(InvocationContextPool.java:55)
at com.evermind.server.ejb.AbstractEJBHome.OC4J_invokeMethod(AbstractEJBHome.java:723)Thanks for the response and the direction.
Its Bug No.6713854
Could you please shed some light on toplink flavors and support/fixes.
That is:
1. Is toplink that comes with OAS different than the open source toplink?
2. If so, how are bugs tracked. where should I go and look for the bugs for the open source version?
3. Could we use the open source version for OC4J?
Thanks :) -
Catch javax.ejb.EJBException: Could not activate; failed to restore state
Software
JDK 1.5
Jboss 4.0.5GA
Problem
I am getting
DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] Activation failure
javax.ejb.EJBException: Could not activate; failed to restore state
I know this error is as my bean is getting passivated and then when I try to use the Remote Interface that bean this error is thrown
I require a method by which I can catch this error and create a new bean whenever required. Does anyone knows of any way by which I will catch this specific error and create a new Stateful bean.
I mean to say some way by using the Remote Interface to find out whether the bean is active or has been vanished form the memory
Thanks in advance
CSJakhariaThis is the stack trace in the log file which I could see. I cannot understand the reason why it could not activate the Entity Class
2007-02-27 18:45:47,816 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Running RemoverTask
2007-02-27 18:45:47,816 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, PassivatedCount=4
2007-02-27 18:45:47,816 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] removePassivated, now=1172582147816, maxLifeAfterPassivation=1200000
2007-02-27 18:45:47,826 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, done
2007-02-27 18:45:54,546 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] run: IdleRemover notifying pools, interval: 450000
2007-02-27 18:47:54,759 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Running RemoverTask
2007-02-27 18:47:54,759 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, PassivatedCount=0
2007-02-27 18:47:54,759 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] removePassivated, now=1172582274759, maxLifeAfterPassivation=1200000
2007-02-27 18:47:54,759 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, done
2007-02-27 18:50:46,396 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Running RemoverTask
2007-02-27 18:50:46,396 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, PassivatedCount=1
2007-02-27 18:50:46,396 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] removePassivated, now=1172582446396, maxLifeAfterPassivation=1200000
2007-02-27 18:50:46,396 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, done
2007-02-27 18:52:12,169 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Running RemoverTask
2007-02-27 18:52:12,169 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, PassivatedCount=2
2007-02-27 18:52:12,169 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] removePassivated, now=1172582532169, maxLifeAfterPassivation=1200000
2007-02-27 18:52:12,279 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, done
2007-02-27 18:52:20,401 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Running RemoverTask
2007-02-27 18:52:20,401 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, PassivatedCount=2
2007-02-27 18:52:20,401 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] removePassivated, now=1172582540401, maxLifeAfterPassivation=1200000
2007-02-27 18:52:20,401 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, done
2007-02-27 18:53:24,553 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] run: IdleRemover notifying pools, interval: 450000
2007-02-27 18:57:10,578 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Running RemoverTask
2007-02-27 18:57:10,578 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, PassivatedCount=1
2007-02-27 18:57:10,578 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] removePassivated, now=1172582830578, maxLifeAfterPassivation=1200000
2007-02-27 18:57:10,578 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, done
2007-02-27 18:59:45,050 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Running RemoverTask
2007-02-27 18:59:45,050 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, PassivatedCount=0
2007-02-27 18:59:45,050 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] removePassivated, now=1172582985050, maxLifeAfterPassivation=1200000
2007-02-27 18:59:45,050 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, done
2007-02-27 19:00:54,560 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] run: IdleRemover notifying pools, interval: 450000
2007-02-27 19:02:25,471 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Running RemoverTask
2007-02-27 19:02:25,471 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, PassivatedCount=2
2007-02-27 19:02:25,471 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] removePassivated, now=1172583145471, maxLifeAfterPassivation=1200000
2007-02-27 19:02:25,471 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, done
2007-02-27 19:04:09,050 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Running RemoverTask
2007-02-27 19:04:09,050 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, PassivatedCount=2
2007-02-27 19:04:09,050 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] removePassivated, now=1172583249050, maxLifeAfterPassivation=1200000
2007-02-27 19:04:09,050 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, done
2007-02-27 19:08:15,694 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Running RemoverTask
2007-02-27 19:08:15,694 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, PassivatedCount=2
2007-02-27 19:08:15,694 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] removePassivated, now=1172583495694, maxLifeAfterPassivation=1200000
2007-02-27 19:08:15,694 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, done
2007-02-27 19:08:24,757 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] run: IdleRemover notifying pools, interval: 450000
2007-02-27 19:17:11,645 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Running RemoverTask
2007-02-27 19:17:11,645 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, PassivatedCount=12
2007-02-27 19:17:11,645 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] removePassivated, now=1172584031645, maxLifeAfterPassivation=1200000
2007-02-27 19:17:11,675 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] run: IdleRemover notifying pools, interval: 450000
2007-02-27 19:17:11,685 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, done
2007-02-27 19:17:54,767 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Running RemoverTask
2007-02-27 19:17:54,767 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, PassivatedCount=0
2007-02-27 19:17:54,767 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] removePassivated, now=1172584074767, maxLifeAfterPassivation=1200000
2007-02-27 19:17:54,767 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, done
2007-02-27 19:20:46,404 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Running RemoverTask
2007-02-27 19:20:46,414 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, PassivatedCount=2
2007-02-27 19:20:46,414 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] removePassivated, now=1172584246414, maxLifeAfterPassivation=1200000
2007-02-27 19:20:46,414 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, done
2007-02-27 19:22:12,177 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Running RemoverTask
2007-02-27 19:22:12,177 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, PassivatedCount=1
2007-02-27 19:22:12,177 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] removePassivated, now=1172584332177, maxLifeAfterPassivation=1200000
2007-02-27 19:22:12,177 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, done
2007-02-27 19:22:20,409 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Running RemoverTask
2007-02-27 19:22:20,409 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, PassivatedCount=1
2007-02-27 19:22:20,409 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] removePassivated, now=1172584340409, maxLifeAfterPassivation=1200000
2007-02-27 19:22:20,409 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, done
2007-02-27 19:24:41,682 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] run: IdleRemover notifying pools, interval: 450000
2007-02-27 19:27:10,586 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Running RemoverTask
2007-02-27 19:27:10,586 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, PassivatedCount=1
2007-02-27 19:27:10,586 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] removePassivated, now=1172584630586, maxLifeAfterPassivation=1200000
2007-02-27 19:27:10,586 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, done
2007-02-27 19:29:45,058 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Running RemoverTask
2007-02-27 19:29:45,058 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, PassivatedCount=0
2007-02-27 19:29:45,058 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] removePassivated, now=1172584785058, maxLifeAfterPassivation=1200000
2007-02-27 19:29:45,058 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, done
2007-02-27 19:32:11,689 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] run: IdleRemover notifying pools, interval: 450000
2007-02-27 19:32:25,479 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Running RemoverTask
2007-02-27 19:32:25,479 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, PassivatedCount=1
2007-02-27 19:32:25,479 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] removePassivated, now=1172584945479, maxLifeAfterPassivation=1200000
2007-02-27 19:32:25,479 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, done
2007-02-27 19:34:09,058 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Running RemoverTask
2007-02-27 19:34:09,058 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, PassivatedCount=1
2007-02-27 19:34:09,058 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] removePassivated, now=1172585049058, maxLifeAfterPassivation=1200000
2007-02-27 19:34:09,058 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, done
2007-02-27 19:38:15,703 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Running RemoverTask
2007-02-27 19:38:15,703 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, PassivatedCount=1
2007-02-27 19:38:15,703 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] removePassivated, now=1172585295703, maxLifeAfterPassivation=1200000
2007-02-27 19:38:15,703 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, done
2007-02-27 19:39:41,696 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] run: IdleRemover notifying pools, interval: 450000
2007-02-27 19:41:04,445 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] Activation failure
javax.ejb.EJBException: Could not activate; failed to restore state
at org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager.activateSession(StatefulSessionFilePersistenceManager.java:343)
at org.jboss.ejb.plugins.StatefulSessionInstanceCache.activate(StatefulSessionInstanceCache.java:113)
at org.jboss.ejb.plugins.AbstractInstanceCache.doActivate(AbstractInstanceCache.java:457)
at org.jboss.ejb.plugins.StatefulSessionInstanceCache.doActivate(StatefulSessionInstanceCache.java:129)
at org.jboss.ejb.plugins.AbstractInstanceCache.get(AbstractInstanceCache.java:123)
at org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invoke(StatefulSessionInstanceInterceptor.java:236)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
at org.jboss.ejb.Container.invoke(Container.java:954)
at sun.reflect.GeneratedMethodAccessor82.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:819)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:420)
at sun.reflect.GeneratedMethodAccessor93.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.io.FileNotFoundException: E:\jboss-4.0.5.GA\server\default\tmp\sessions\com\common\IDerivedLastNoEntity-eyoauehf-c\eyocxhho-p.ser (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager$FISAction.run(StatefulSessionFilePersistenceManager.java:526)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager$FISAction.open(StatefulSessionFilePersistenceManager.java:535)
at org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager.activateSession(StatefulSessionFilePersistenceManager.java:323)
... 29 more
2007-02-27 19:41:23,322 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] Activation failure
javax.ejb.EJBException: Could not activate; failed to restore state
at org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager.activateSession(StatefulSessionFilePersistenceManager.java:343)
at org.jboss.ejb.plugins.StatefulSessionInstanceCache.activate(StatefulSessionInstanceCache.java:113)
at org.jboss.ejb.plugins.AbstractInstanceCache.doActivate(AbstractInstanceCache.java:457)
at org.jboss.ejb.plugins.StatefulSessionInstanceCache.doActivate(StatefulSessionInstanceCache.java:129)
at org.jboss.ejb.plugins.AbstractInstanceCache.get(AbstractInstanceCache.java:123)
at org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invoke(StatefulSessionInstanceInterceptor.java:236)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
at org.jboss.ejb.Container.invoke(Container.java:954)
at sun.reflect.GeneratedMethodAccessor82.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:819)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:420)
at sun.reflect.GeneratedMethodAccessor93.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.io.FileNotFoundException: E:\jboss-4.0.5.GA\server\default\tmp\sessions\com\prathamwoods\ITransProductionEntity-eyoauek7-d\eyocxrao-x.ser (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager$FISAction.run(StatefulSessionFilePersistenceManager.java:526)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager$FISAction.open(StatefulSessionFilePersistenceManager.java:535)
at org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager.activateSession(StatefulSessionFilePersistenceManager.java:323)
... 29 more
2007-02-27 19:42:22,968 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] Activation failure
javax.ejb.EJBException: Could not activate; failed to restore state
at org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager.activateSession(StatefulSessionFilePersistenceManager.java:343)
at org.jboss.ejb.plugins.StatefulSessionInstanceCache.activate(StatefulSessionInstanceCache.java:113)
at org.jboss.ejb.plugins.AbstractInstanceCache.doActivate(AbstractInstanceCache.java:457)
at org.jboss.ejb.plugins.StatefulSessionInstanceCache.doActivate(StatefulSessionInstanceCache.java:129)
at org.jboss.ejb.plugins.AbstractInstanceCache.get(AbstractInstanceCache.java:123)
at org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invoke(StatefulSessionInstanceInterceptor.java:236)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
at org.jboss.ejb.Container.invoke(Container.java:954)
at sun.reflect.GeneratedMethodAccessor82.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:819)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:420)
at sun.reflect.GeneratedMethodAccessor93.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.io.FileNotFoundException: E:\jboss-4.0.5.GA\server\default\tmp\sessions\com\prathamwoods\ITransProductionEntity-eyoauek7-d\eyocxrao-x.ser (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager$FISAction.run(StatefulSessionFilePersistenceManager.java:526)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager$FISAction.open(StatefulSessionFilePersistenceManager.java:535)
at org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager.activateSession(StatefulSessionFilePersistenceManager.java:323)
... 29 more
2007-02-27 19:47:12,514 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Running RemoverTask
2007-02-27 19:47:12,534 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] run: IdleRemover notifying pools, interval: 450000
2007-02-27 19:47:13,566 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, PassivatedCount=0
2007-02-27 19:47:13,666 DEBUG [org.jboss.ejb.plugins.AbstractInstanceCache] removePassivated, now=1172585833646, maxLifeAfterPassivation=1200000
2007-02-27 19:47:13,716 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] RemoverTask, done
2007-02-27 19:47:54,775 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Running RemoverTaskThanks in advance
CSJakharia -
Warning: Unable to create new entry, caught: "javax.ejb.CreateException", message is: "Error creating EntityBean: Io exception: The Network Adapter could not establish the connection".
while executing JSP:<%
* add.jsp
* Adds a new entry through EmployeeBean. This is a JSP that serves 2
* functions. First of all, when called with no arguments, it will display a
* table with a few input fields. The user should enter empNo, empName and
* salary of the new record to be added. When she submits this
* information, it is sent to this page again. If it is successful, then the
* user can continue adding new entries. If it is not, then the old data will
* be displayed, and a warning message will be shown to her.
%>
<%@ page import="com.webstore.*,java.io.*,java.util.*,javax.naming.*" %>
<%
// Make sure this page will not be cached by the browser
response.addHeader("Pragma", "no-cache");
response.addHeader("Cache-Control", "no-store");
// We will send error messages to System.err, for verbosity. In a real
// application you will probably not want this.
PrintStream errorStream = System.err;
// If we find any fatal error, we will store it in this variable.
String error = null;
// In a moment we will check if all columns were passed to this page
String param_1 = "";
String param_2 = "";
String param_3 = "";
long dptNo = 0;
String dptName = null;
// This variable indicates what function of this page is currently used. If
// this page is called with parameters, then a new entry should be
// added. In that case this variable is true.
boolean submitting = false;
// We will first attempt to get the reference to EmployeeHome from the
// session. The "list.jsp" page sets this attribute in the session.
DepartmentHome home = (DepartmentHome) session.getAttribute("DepartmentHome");
if (home == null) {
error = "No previous connection to DepartmentBean.";
} else {
// Attempt to get all 3 parameters from the session
param_1 = request.getParameter("DPTNO");
param_2 = request.getParameter("DPTNAME");
// If all 3 parameters are specified, then this is probably a submission by
// this very page. Note that if the user left one of the fields blank, then
// the corresponding parameter will be "", not null.
if (param_1 != null && param_2 != null) {
param_1 = param_1.trim();
param_2 = param_2.trim();
submitting = true;
// In the following variable we will store a (non-fatal) warning message. This
// message will be displayed in the page, but so will the submission form.
String warning = null;
if (submitting) {
warning = "";
// If there is an empty param_1, param_2 and/or param_3, then this will be noted
// in the warning message.
if ("".equals(param_1)) {
warning = "Null param_1 specified. ";
if ("".equals(param_2)) {
warning += "Null param_2 specified. ";
// If we don't have a warning message yet, then we will attempt to create
// a new record.
if ("".equals(warning)) {
try {
dptNo = (long)Long.parseLong(param_1);
dptName = new String(param_2);
Department rec = (Department) home.create(dptNo);
rec.setDptname(dptName);
// empty columns after insert for effect
param_1 = "";
param_2 = "";
// If we got this far, then there was no problem detected.
warning = null;
} catch (Exception e) {
// Set the warning variable to indicate a problem.
warning = "Unable to create new entry, caught: \"" +
e.getClass().getName() + "\", message is: \"" +
e.getMessage() + "\".";
// Decide what the title will be.
String title;
if (error != null) {
title = "Error";
} else {
title = "com.webstore | Add entry";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE><%= title %></TITLE>
</HEAD>
<BODY bgcolor="#FFFFFF">
<H1><%= title %></H1>
<%
// If there was a fatal error, then display the error message
if (error != null) {
%>
<P><BLOCKQUOTE><%= error %></BLOCKQUOTE>
<%
// Otherwise display a table with fields to be filled in.
} else {
// If there was a warning, then display it.
if (warning != null) {
%>
<TABLE border="1" bgcolor="#FF2222">
<TR><TD><FONT color="#FFFFFF"><STRONG>Warning: <%= warning %></STRONG></FONT></TD></TR>
</TABLE>
<%
} /* if */
// Display the table with fields. There are two columns. The left column
// contains the names of the fields, while the right column contains the
// fields.
%>
<FORM action="dptadd.jsp" method="GET">
<P><TABLE border="1">
<TR>
<TD><STRONG>DptNo:</STRONG></TD>
<TD><INPUT type="text" name="DPTNO" value="<%= param_1 %>"></INPUT></TD>
</TR>
<TR>
<TD><STRONG>DptName:</STRONG></TD>
<TD><INPUT type="text" name="DPTNAME" value="<%= param_2 %>"></INPUT></TD>
</TR>
<TR>
<TD colspan="3" align="center"><INPUT type="submit" value="Add this entry"></INPUT></TD>
</TR>
</TABLE>
</FORM>
<%
} /* else */
%>
<P><TABLE border="1">
<TR><TD>Back to list</TD></TR>
</TABLE>
</BODY>
</HTML>
Please guide me..Rajive,
This is the same problem as in your other post:
sql is running very slow
So please refer to my answer there.
Good Luck,
Avi. -
SOS: javax.ejb.CreateException: Create failed because primary key is null
Hello,
I am desperately trying to get my application server to create a record through CMP 2. My app server is JRun 4.
Here is the client:
package com.parispano.tests;
import java.util.Date;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import com.parispano.account.entity.Account;
import com.parispano.account.entity.AccountHome;
public class ClientEJBDeuxTemp {
public static void main(String[] args) {
System.out.println("\nBegin account DemoClient...\n");
try {
// Create A Demo object, in the server
// Note: the name of the class corresponds to the JNDI
// property declared in the DeploymentDescriptor
// From DeploymentDescriptor ...
// beanHomeName demo.DemoHome
Context ctx = getInitialContext();
AccountHome ahome = (AccountHome) ctx.lookup("AccountEJBHome");
//System.out.println("Creating Demo\n");
Account account = ahome.create("toto","toto", "toto","toto","toto","toto","toto","toto","toto","toto","toto",new Date(),new Date());
catch (Exception e) {
System.out.println(":::::::::::::: Error :::::::::::::::::");
e.printStackTrace();
System.out.println("\nEnd DemoClient...\n");
static String user = "admin";
static String password = "admin";
static String url = "ordi:2908";
* Gets an initial context.
* @return Context
* @exception java.lang.Exception if there is
* an error in getting a Context
static public Context getInitialContext() throws Exception {
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "jrun.naming.JRunContextFactory");
p.put(Context.PROVIDER_URL, url);
if (user != null) {
System.out.println ("user: " + user);
p.put(Context.SECURITY_PRINCIPAL, user);
if (password == null)
password = "";
p.put(Context.SECURITY_CREDENTIALS, password);
return new InitialContext(p);
}and here is the exception I get:
javax.ejb.CreateException: Create failed because primary key is null
I don't understand why I get this as the primary key is "toto" and therefore is not null.
Here is the DD:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<display-name>Account EJB</display-name>
<enterprise-beans>
<entity>
<display-name>Account EJB</display-name>
<ejb-name>AccountEJB</ejb-name>
<home>com.parispano.account.entity.AccountHome</home>
<remote>com.parispano.account.entity.Account</remote>
<local-home>com.parispano.account.entity.AccountLocalHome</local-home>
<local>com.parispano.account.entity.AccountLocal</local>
<ejb-class>com.parispano.account.entity.AccountEJB</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>account</abstract-schema-name>
<cmp-field>
<description>Login</description>
<field-name>login</field-name>
</cmp-field>
<!-- -->
<cmp-field>
<description>Password</description>
<field-name>password</field-name>
</cmp-field>
<cmp-field>
<description>Surname</description>
<field-name>surname</field-name>
</cmp-field>
<cmp-field>
<description>First Name</description>
<field-name>firstName</field-name>
</cmp-field>
<cmp-field>
<description>Address One</description>
<field-name>addressOne</field-name>
</cmp-field>
<cmp-field>
<description>Address Two</description>
<field-name>addressTwo</field-name>
</cmp-field>
<cmp-field>
<description>Postcode</description>
<field-name>postcode</field-name>
</cmp-field>
<cmp-field>
<description>City</description>
<field-name>city</field-name>
</cmp-field>
<cmp-field>
<description>Country</description>
<field-name>country</field-name>
</cmp-field>
<cmp-field>
<description>Telephone</description>
<field-name>telephone</field-name>
</cmp-field>
<cmp-field>
<description>Email</description>
<field-name>email</field-name>
</cmp-field>
<cmp-field>
<description>Inscription Date</description>
<field-name>inscriptionDate</field-name>
</cmp-field>
<cmp-field>
<description>Last Visit Date</description>
<field-name>lastVisitDate</field-name>
</cmp-field>
<primkey-field>login</primkey-field>
</entity>
</enterprise-beans>
</ejb-jar>Can anyone tell me why I am getting this exception please?
Thanks in advance,
Julien Martin.Yes, I have set the PK. Actually this is happening when the number of columns are more than 63 columns. After I reduce the number of column, it is working fine.
Is it the actual problem???
fyi, I'm using jboss as the Application Server... -
package library.client;
import javax.naming.InitialContext;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.lang.reflect.Method;
import java.sql.ResultSet;
import javax.ejb.*;
import javax.naming.*;
import javax.swing.*;
import library.common.*;
@SuppressWarnings("serial")
public class LibraryClient extends JFrame implements ActionListener {
private static LibraryInterface li;
private JTextField book_author = new JTextField(10);
private JTextField book_title = new JTextField(10);
private JTextField book_isbn = new JTextField(10);
private JLabel author_label = new JLabel("Podaj autora:");
private JLabel book_title_label = new JLabel("Podaj tytul ksiazki");
private JLabel isbn_label = new JLabel("Podaj ISBN");
private JTextArea display_books = new JTextArea(20,50);
private JButton search = new JButton("Search");
private ResultSet resultset;
public LibraryClient() {
this("DEFAULT_CONTEXT");
private JPanel createPanel1(){
JPanel panel = new JPanel();
panel.add(author_label);
panel.add(book_author);
panel.add(book_title_label);
panel.add(book_title);
panel.add(isbn_label);
panel.add(book_isbn);
panel.add(search);
////search.setActionCommand("ISBN");
search.addActionListener(this);
return panel;
private JPanel createPanel2(){
JPanel panel = new JPanel();
panel.add(display_books);
return panel;
private JPanel createPanels(){
JPanel panel = new JPanel();
//Use default FlowLayout.
panel.setLayout(new BorderLayout());
panel.add(createPanel1(), BorderLayout.NORTH);
panel.add(createPanel2(), BorderLayout.SOUTH);
return panel;
public LibraryClient(String appType) {
init(appType);
JFrame frame = new JFrame("Library");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// /final Table table = new Table();
frame.setContentPane(createPanels());
frame.pack();
// /f.setLocationRelativeTo(null);
frame.setVisible(true);
public void actionPerformed(ActionEvent e) {
try {
display_books.setText("");
display_books.setText("Wyszukane Ksiazki\n");
if(!book_author.getText().equals("")){
resultset=li.getBookByAuthor(book_author.getText());
}else if(!book_title.getText().equals("")){
resultset=li.getBookByName(book_title.getText());
}else if(!book_isbn.getText().equals("")){
resultset=li.getBookByISBN(book_isbn.getText());
}else {
System.out.println("Before->resultset=li.getAllBooks()");
resultset=li.getAllBooks();
System.out.println("After->resultset=li.getAllBooks()");
while(resultset.next()){
System.out.println("in while resultset.next()");
String name = resultset.getString("name");
String author =resultset.getString("author");
String isbn = resultset.getString("ISBN");
display_books.append("\n"+ name + " " + author +" "+ isbn);
} catch(Exception exc) { exc.printStackTrace(); }
private void init(String type) {
if (type.equals("JAVA_APP")) li = new library.ejb.LibraryBean();
else if (type.equals("JAVA_CLIENT")) {
try {
InitialContext ic = new InitialContext();
li = (LibraryInterface) ic.lookup("library.common.LibraryInterface");
} catch (NamingException e) {
e.printStackTrace();
public static void main(String[] args) {
if (args.length >= 1) new LibraryClient(args[0]);
else new LibraryClient();
}it throws the exception when it gets to
any of the functions
resultset=li.getBookByAuthor(book_author.getText());
resultset=li.getBookByName(book_title.getText());
resultset=li.getBookByISBN(book_isbn.getText());
resultset=li.getAllBooks();
Please help
Thank YouHi,
I also get the same error.have you got the solution,fi so explain me how to rectify the error
Regards
SamyMohan -
Javax.ejb.NoSuchObjectLocalException when removing entitybean
Weblogic 10.3.0.0
EJB 2.1
Hi. I am using the below code to remove a record in the database. But it happens that I get a javax.ejb.NoSuchObjectLocalException.
Before this code is executed, I load the data from the database and create a list of sealsInfoTO that has to be removed, so I only get sealsInfoTO that exists in the database.
It all is in the same transaction that is started in a session bean.
It is not only happening with the seals, but also other objects that goes through likewise code
Iterator removedIterator = seals.removedIterator();
while (removedIterator.hasNext()) {
sealsInfoTO = (SealsInfoTO) removedIterator.next();
if ((sealsId = sealsInfoTO.getSealsId()) != null) {
sealsInfoLocal = BeanFactory.getInstance().getSealsInfoLocal(sealsId);
try {
sealsInfoLocal.remove();
log.debug("sealsInfoLocal with pk " + sealsId + " has been removed by the client");
} catch (RemoveException e) {
log.error("Can not remove SealsInfo", e);
throw new SystemException("Can not remove SealsInfo", e);
javax.ejb.NoSuchObjectLocalException: [EJB:010142]Instance of EJB 'SealsInfo' with primary key '183109' does not exist.: javax.ejb.NoSuchEntityException: [EJB:010142]Instance of EJB 'SealsInfo' with primary key '183109' does not exist.
at dk.steria.exp.midtier.model.declaration.ejb.SealsInfo_tjm27k__WebLogic_CMP_RDBMS.ejbRemove(SealsInfo_tjm27k__WebLogic_CMP_RDBMS.java:2682)
at weblogic.ejb.container.manager.DBManager.remove(DBManager.java:1661)
at weblogic.ejb.container.internal.EntityEJBLocalObject.remove(EntityEJBLocalObject.java:129)
at dk.steria.exp.midtier.model.declaration.ejb.SealsInfo_tjm27k_ELOImpl.remove(SealsInfo_tjm27k_ELOImpl.java:646)
at dk.steria.exp.midtier.tools.consumer.Process.processSealsInfo(Process.java:382)
at dk.steria.exp.midtier.tools.consumer.DeclarationConsumer.updateDeclaration(DeclarationConsumer.java:205)
at dk.steria.exp.midtier.tools.consumer.DeclarationConsumer.updateDeclaration(DeclarationConsumer.java:157)
at dk.steria.exp.midtier.tools.consumer.DeclarationConsumer.submitDeclaration(DeclarationConsumer.java:1207)
at dk.steria.exp.midtier.api.declaration.ejb.DeclarationSBBean.submitDeclaration(DeclarationSBBean.java:871)Edited by: Kristian Lind on Sep 4, 2012 10:56 AMYogavelan...for a faster response, post your question in the Oracle9i JDeveloper Forum:
JDeveloper and ADF
This forum is for member feedback about OTN services and content only; it is not monitored by product teams. -
BMP question : got javax.ejb.EJBException error Object state not saved
Could anybody please help me? I could not figure out what i did wrong.
I got the javax.ejb.EJBException error: Object state not saved
when i test the getname() method for findByPrimaryKey() and findAll() methods.
Here is my code:
package org.school.idxc;
import javax.sql.*;
import javax.naming.*;
import javax.ejb.*;
import javax.sql.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Vector;
* Bean implementation class for Enterprise Bean: status
public class statusBean implements javax.ejb.EntityBean {
private javax.ejb.EntityContext myEntityCtx;
private int id;
private String name;
private DataSource ds;
private String dbname = "jdbc/idxc";
private Connection con;
* ejbActivate
public void ejbActivate() {
* ejbLoad
public void ejbLoad() {
System.out.println("Entering EJBLoad");
try
Integer primaryKey = (Integer) myEntityCtx.getPrimaryKey();
String sqlstmt = "select id, name from from status where id =?";
con = ds.getConnection();
PreparedStatement stmt = con.prepareStatement(sqlstmt);
stmt.setInt (1,primaryKey.intValue());
ResultSet rs = stmt.executeQuery();
if (rs.next())
this.id = rs.getInt(1);
this.name = rs.getString (2).trim();
stmt.close();
} // if
else
stmt.close();
throw new NoSuchEntityException ("Invalid id " + id);
}// else
} // try
catch (SQLException e)
System.out.println("EJBLOad : " + e.getMessage());
} // catch
finally
try
if (con != null)
con.close();
}// try
catch (SQLException e)
System.out.println("EJBLOad finally" + e.getMessage());
} // catch
}// finally
* ejbPassivate
public void ejbPassivate() {
* ejbRemove
public void ejbRemove() throws javax.ejb.RemoveException {
System.out.println ("Entering ejb Removed");
try
String sqlstmt = "delete from status where id=" + id;
con = ds.getConnection();
Statement stmt = con.createStatement();
stmt.executeUpdate(sqlstmt);
stmt.close();
}// try
catch (SQLException e)
System.out.println("Ejb Remove" + e.getMessage());
} // catch
finally
try
if (con!=null)
con.close();
}// try
catch (SQLException e)
System.out.println ("EJBRemoved " + e.getMessage());
} // catch
} // finally
* ejbStore
public void ejbStore() {
System.out.println("Entering the ejbStore");
try
String sqlstmt = "update status set id=" + id + ",name='" + name + "' where id=" + id;
con = ds.getConnection();
Statement stmt = con.createStatement();
if (stmt.executeUpdate(sqlstmt) != 1)
throw new EJBException ("Object state not saved");
stmt.close();
} // try
catch (SQLException e)
System.out.println ("EJBStore : " + e.getMessage());
}// catch
finally
try
if (con != null)
con.close();
} // try
catch(SQLException e)
System.out.println ("EJBStore finally " + e.getMessage());
} // catch
} // finally
* getEntityContext
public javax.ejb.EntityContext getEntityContext() {
return myEntityCtx;
* setEntityContext
public void setEntityContext(javax.ejb.EntityContext ctx) {
myEntityCtx = ctx;
try
InitialContext initial = new InitialContext();
ds = (DataSource)initial.lookup(dbname);
} // try
catch (NamingException e)
throw new EJBException ("set Entity context : Invalid database");
}// catch
* unsetEntityContext
public void unsetEntityContext() {
myEntityCtx = null;
* ejbCreate
public Integer ejbCreate(Integer key, String name) throws javax.ejb.CreateException {
this.id = key.intValue();
this.name = name;
System.out.println ("Entering ejbCreated!!!");
try
String sqlstmt = "insert into status(id,name) values (" + id + ",'" + (name == null ? "" : name) + "')";
con = ds.getConnection();
Statement stmt = con.createStatement();
stmt.executeUpdate(sqlstmt);
stmt.close();
}// try
catch (SQLException e)
System.out.println("EJBCreate : SQLEXception ");
}// catch
finally
try
if (con!=null)
con.close();
}// try
catch (SQLException e)
System.out.println ("EJB Created Finally : SQLException");
e.getMessage();
} // catch
}// finally
this.id = key.intValue();
this.name = name;
return key ;
* ejbPostCreate
public void ejbPostCreate(Integer id, String name) throws javax.ejb.CreateException {
* ejbFindByPrimaryKey
public Integer ejbFindByPrimaryKey(
Integer key) throws javax.ejb.FinderException {
try
String sqlstmt = "select id from status where id=" + key.intValue();
con = ds.getConnection();
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(sqlstmt);
if (!rs.next())
throw new ObjectNotFoundException();
} // if
rs.close();
stmt.close();
} // try
catch (SQLException e)
System.out.println ("EJBFindBYPrimaryKey " + e.getMessage());
} // catch
finally
try
if (con!=null)
con.close();
}// try
catch (SQLException e)
System.out.println ("EJB Find by primary key" + e.getMessage());
}// catch
}// finally
return key;
* @return Returns the name.
public String getName() {
return this.name;
* @return Returns id
public int getId() {
return this.id;
* @param name The name to set.
public void setName(String xname) {
this.name = xname;
* ejbFindByLastnameContaining
public Enumeration ejbFindAllNamne () throws javax.ejb.FinderException
try
String sqlstmt = "select id from status order by id";
con = ds.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(sqlstmt);
Vector keys = new Vector();
while (rs.next())
keys.add(new Integer(rs.getInt(1)));
}// while
rs.close();
s.close();
con.close();
return keys.elements();
} // try
catch (SQLException e)
throw new FinderException (e.toString());
} // catch
}Hi,
if you look at your error message you will see the problem. In your code you've missed to implement
public void ejbPassivate {}
so your code looks like this
import java.lang.Object;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import java.rmi.RemoteException;
import java.lang.Math;
import java.util.Random;
import java.io.*;
/** * Title: * Description: * Copyright: Copyright (c) 2001 * Company: * @author * @version 1.0 */
public class DiceEJB implements SessionBean, Serializable
public int[] Roll()
Random rng = new Random();
int[] diceArray = new int[5];
for(int i =0; i < diceArray.length;i++)
diceArray[i] = (Math.abs (rng.nextInt()) % 6) +1;
return diceArray;
public DiceEJB(){}
public void ejbCreate() {}
public void ejbRemove() {}
public void ejbActivate() {}
public void ejbPassivate() {}
public void setSessionContext (SessionContext sc)
private void writeObject(ObjectOutputStream oos) throws IOException
oos.defaultWriteObject();
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException
ois.defaultReadObject();
bye -
Hi,
I'm stuck on this problem since 10 days now. Please Please help.
I'm using Jboss 4.0.5GA and ejb 2.0 While executing the last query after running the ejbStore() of the bean, it breaks,
The error is below :
Executing SQL: UPDATE arinpchg SET modified_date=?, doc_num=?, printing_status=? WHERE trx_num=?
2007-11-29 15:52:55,593 TRACE [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP1xFieldBridge.au.com.cams.cims.ar.ejb.Charge#modifiedDate] param: i=1, type=TIMESTAMP, value=2007-11-29 15:52:53.14
2007-11-29 15:52:55,593 TRACE [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP1xFieldBridge.au.com.cams.cims.ar.ejb.Charge#docNum] param: i=2, type=VARCHAR, value=INV297217
2007-11-29 15:52:55,593 TRACE [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP1xFieldBridge.au.com.cams.cims.ar.ejb.Charge#printingStatus] param: i=3, type=INTEGER, value=1
2007-11-29 15:52:55,593 TRACE [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP1xFieldBridge.au.com.cams.cims.ar.ejb.Charge#trxNum] param: i=4, type=VARCHAR, value=ARTRX395716
2007-11-29 15:52:55,734 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackException in method: public abstract au.com.cams.cims.ar.data.PendingChargeResponse au.com.cams.cims.business.ejb.PendingChargeManager.processPendingCharges(au.com.cams.cims.ar.data.PendingChargeRequest,au.com.cams.cims.core.data.DUser) throws au.com.cams.cims.core.util.StoredProcedureFailedException,au.com.cams.cims.core.util.UpdateFailedException,java.rmi.RemoteException, causedBy:
org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=MEL-LAP-XP-66/59, BranchQual=, localId=59] status=STATUS_NO_TRANSACTION; - nested throwable: (javax.ejb.EJBException: Update failed. Expected one affected row: rowsAffected=0, id=au.com.cams.cims.ar.data.ChargePK@839418b6)
at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:372)
at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:501)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:361)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
at org.jboss.ejb.Container.invoke(Container.java:954)
at sun.reflect.GeneratedMethodAccessor108.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
at $Proxy508.processPendingCharges(Unknown Source)
at au.com.cams.cims.ar.cmd.PendingChargeManagerCmdBean.doProcessPendingCharges(Unknown Source)
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 au.com.cams.cims.core.cmd.AbstractCmdBean.execute(Unknown Source)
at au.com.cams.cims.core.sys.CIMSCommandBeanManager.doCommandBeanExecute(Unknown Source)
at au.com.cams.cims.core.sys.CIMSCommandBeanManager.execute(Unknown Source)
at au.com.singtech.saf.MainServlet.doPost(Unknown Source)
at au.com.singtech.saf.MainServlet.doGet(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)
Caused by: javax.ejb.EJBException: Update failed. Expected one affected row: rowsAffected=0, id=au.com.cams.cims.ar.data.ChargePK@839418b6
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.execute(JDBCStoreEntityCommand.java:169)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.storeEntity(JDBCStoreManager.java:666)
at org.jboss.ejb.plugins.CMPPersistenceManager.storeEntity(CMPPersistenceManager.java:428)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.storeEntity(CachedConnectionInterceptor.java:273)
at org.jboss.ejb.EntityContainer.storeEntity(EntityContainer.java:756)
at org.jboss.ejb.GlobalTxEntityMap$2.synchronize(GlobalTxEntityMap.java:149)
at org.jboss.ejb.GlobalTxEntityMap$GlobalTxSynchronization.synchronize(GlobalTxEntityMap.java:295)
at org.jboss.ejb.GlobalTxEntityMap$GlobalTxSynchronization.beforeCompletion(GlobalTxEntityMap.java:345)
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)
My entityBean:
* Copyright 2000 by Sing Technologies Pty. Ltd.,
* Level 11, 269 Wickham Street, Fortitude Valley, Qld 4006, Australia
* All rights reserved.
* This software is the confidential and proprietary information
* of Sing Technologies Pty. Ltd. ("Confidential Information"). You
* shall not disclose such Confidential Information and shall use
* it only in accordance with the terms of the license agreement
* you entered into with Sing Technologies.
package au.com.cams.cims.ar.ejb;
import java.sql.*;
import javax.ejb.*;
import au.com.cams.cims.ar.data.*;
import au.com.cams.cims.core.data.*;
import au.com.cams.cims.core.util.*;
import au.com.cams.cims.core.ejb.*;
import au.com.cams.cims.core.app.*;
import org.apache.log4j.*;
import javax.naming.*;
import javax.rmi.*;
import java.util.*;
import java.rmi.RemoteException;
* @stereotype EntityBean
* @persistence Container
* @homeInterface au.com.cams.cims.ar.ejb.ChargeHome
* @remoteInterface au.com.cams.cims.ar.ejb.Charge
* @primaryKey au.com.cams.cims.ar.ejb.ChargePK
public class ChargeBean implements EntityBean {
static private Logger log = Logger.getLogger(ChargeBean.class.getName());
private static final String datasource = "java:ds/cims";
private static final String chargeLineRef = "java:comp/env/ejb/au.com.cams.cims.ar.ejb.ChargeLineHome";
// Used by the isModified extension
private transient boolean isDirty;
public boolean isModified() {
return isDirty;
/** @field Key VARCHAR(20) CIMSSchema.dbo.arinpchg.trx_num */
public String trxNum;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.apply_to_num */
public String applyToNum;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.terms_code */
public String termsCode;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.fin_chg_code */
public String finChgCode;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.shipping_code */
public String shippingCode;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.posting_code */
public String postingCode;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.tax_code */
public String taxCode;
/** @field TIMESTAMP(23) CIMSSchema.dbo.arinpchg.aging_date */
public Timestamp agingDate;
/** @field TIMESTAMP(23) CIMSSchema.dbo.arinpchg.due_date */
public Timestamp dueDate;
/** @field FLOAT(15) CIMSSchema.dbo.arinpchg.gross_amount */
public Double grossAmount;
/** @field FLOAT(15) CIMSSchema.dbo.arinpchg.tax_amount */
public Double taxAmount;
/** @field FLOAT(15) CIMSSchema.dbo.arinpchg.tax_included_amount */
public Double taxIncludedAmount;
/** @field FLOAT(15) CIMSSchema.dbo.arinpchg.freight_amount */
public Double freightAmount;
/** @field FLOAT(15) CIMSSchema.dbo.arinpchg.tax_on_freight_amount */
public Double taxOnFreightAmount;
/** @field FLOAT(15) CIMSSchema.dbo.arinpchg.net_amount */
public Double netAmount;
/** @field FLOAT(15) CIMSSchema.dbo.arinpchg.paid_amount */
public Double paidAmount;
/** @field FLOAT(15) CIMSSchema.dbo.arinpchg.due_amount */
public Double dueAmount;
/** @field INTEGER(10) CIMSSchema.dbo.arinpchg.trx_type */
public Integer trxType;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.doc_num */
public String docNum;
/** @field TIMESTAMP(23) CIMSSchema.dbo.arinpchg.doc_date */
public Timestamp docDate;
/** @field TIMESTAMP(23) CIMSSchema.dbo.arinpchg.apply_date */
public Timestamp applyDate;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.debtor_num */
public String debtorNum;
/** @field INTEGER(10) CIMSSchema.dbo.arinppyt.trx_status */
public Integer trxStatus;
/** @field INTEGER(10) CIMSSchema.dbo.arinppyt.approval_status */
public Integer approvalStatus;
/** @field INTEGER(10) CIMSSchema.dbo.arinpchg.printing_status */
public Integer printingStatus;
/** @field INTEGER(10) CIMSSchema.dbo.arinpchg.posting_status */
public Integer postingStatus;
/** @field INTEGER(10) CIMSSchema.dbo.arinpchg.hold_status */
public Integer holdStatus;
/** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.hold_reason */
public String holdReason;
/** @field VARCHAR(2000) CIMSSchema.dbo.arinpchg.notes */
public String notes;
/** @field VARCHAR(200) CIMSSchema.dbo.arinpchg.message */
public String message;
/** @field INTEGER(10) CIMSSchema.dbo.arinpchg.next_sequence_id */
public Integer nextSequenceId;
/** @field VARCHAR(100) CIMSSchema.dbo.arinpchg.billing_addressee */
public String billingAddressee;
/** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.billing_job_position */
public String billingJobPosition;
/** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.billing_addr1 */
public String billingAddr1;
/** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.billing_addr2 */
public String billingAddr2;
/** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.billing_addr3 */
public String billingAddr3;
/** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.billing_locality */
public String billingLocality;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.billing_state */
public String billingState;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.billing_postcode */
public String billingPostcode;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.billing_country */
public String billingCountry;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.billing_phone_home */
public String billingPhoneHome;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.billing_phone_business */
public String billingPhoneBusiness;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.billing_phone_mobile */
public String billingPhoneMobile;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.billing_phone_car */
public String billingPhoneCar;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.billing_fax_home */
public String billingFaxHome;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.billing_fax_business */
public String billingFaxBusiness;
/** @field VARCHAR(100) CIMSSchema.dbo.arinpchg.billing_email */
public String billingEmail;
/** @field VARCHAR(100) CIMSSchema.dbo.arinpchg.billing_email2 */
public String billingEmail2;
/** @field VARCHAR(100) CIMSSchema.dbo.arinpchg.billing_website */
public String billingWebsite;
/** @field VARCHAR(100) CIMSSchema.dbo.arinpchg.shipping_addressee */
public String shippingAddressee;
/** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.shipping_job_position */
public String shippingJobPosition;
/** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.shipping_addr1 */
public String shippingAddr1;
/** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.shipping_addr2 */
public String shippingAddr2;
/** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.shipping_addr3 */
public String shippingAddr3;
/** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.shipping_locality */
public String shippingLocality;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.shipping_state */
public String shippingState;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.shipping_postcode */
public String shippingPostcode;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.shipping_country */
public String shippingCountry;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.shipping_phone_home */
public String shippingPhoneHome;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.shipping_phone_business */
public String shippingPhoneBusiness;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.shipping_phone_mobile */
public String shippingPhoneMobile;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.shipping_phone_car */
public String shippingPhoneCar;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.shipping_fax_home */
public String shippingFaxHome;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.shipping_fax_business */
public String shippingFaxBusiness;
/** @field VARCHAR(100) CIMSSchema.dbo.arinpchg.shipping_email */
public String shippingEmail;
/** @field VARCHAR(100) CIMSSchema.dbo.arinpchg.shipping_email2 */
public String shippingEmail2;
/** @field VARCHAR(100) CIMSSchema.dbo.arinpchg.shipping_website */
public String shippingWebsite;
/** @field TIMESTAMP(23) CIMSSchema.dbo.arinpchg.created_date */
public Timestamp createdDate;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.created_by */
public String createdBy;
/** @field TIMESTAMP(23) CIMSSchema.dbo.arinpchg.modified_date */
public Timestamp modifiedDate;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.modified_by */
public String modifiedBy;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.print_job_num *//*
public String printJobNum;*/
* The container assigned reference to the entity
private EntityContext context;
* Sets the context of the bean
* @param ec
public void setEntityContext(EntityContext ec) {
context = ec;
// to do: code goes here.
* Clears the context of the bean
public void unsetEntityContext() {
this.context = null;
// to do: code goes here.
* This method is called when the container picks this entity object
* and assigns it to a specific entity object. Insert code here to
* acquire any additional resources that it needs when it is in the
* ready state.
public void ejbActivate() {
* This method is called when the container diassociates the bean
* from the entity object identity and puts the instance back into
* the pool of available instances. Insert code to release any
* resources that should not be held while the instance is in the
* pool.
public void ejbPassivate() {
* The container invokes this method on the bean whenever it
* becomes necessary to synchronize the bean's state with the
* state in the database. This method is called after the container
* has loaded the bean's state from the database.
public void ejbLoad() {
System.out.println("#### VJ: ChargeBean.ejbLoad()");
* The container invokes this method on the bean whenever it
* becomes necessary to synchronize the state in the database
* with the state of the bean. This method is called before the
* container extracts the fields and writes them into the database.
public void ejbStore() {
System.out.println("#### VJ: ChargeBean.ejbStore()");
this.isDirty = false;
updateTotals();
System.out.println("#### VJ: ChargeBean.context.getPrimaryKey(): " + context.getPrimaryKey().toString());
System.out.println("#### VJ: ChargeBean.trxNum: " + trxNum);
* The container invokes this method in response to a client-invoked
* remove request. Insert code to implement any actions before the
* bean is removed from the database.
public void ejbRemove() throws RemoveException {
public ChargePK ejbCreate(DCharge charge, DUser user)
throws CreateException {
System.out.println("#### VJ: ChargeBean.ejbCreate(DCharge, DUser)");
Connection con = null;
ChargePK key = new ChargePK();
if (charge == null)
throw new CreateException("charge cannot be null");
if (user == null)
throw new CreateException("user cannot be null");
try {
// set the pk
con = DatabaseUtilities.getConnection(log, datasource);
this.trxNum = AppJDBCHelper.getNextTrxNum(con);
key.trxNum = this.trxNum;
// set other attributes
setAttributes(charge);
// set mod history
this.createdDate = new Timestamp(new java.util.Date().getTime());
this.createdBy = user.getUsername();
this.modifiedDate = new Timestamp(new java.util.Date().getTime());
this.modifiedBy = user.getUsername();
} catch (GetNextIdFailedException gnife) {
log.error("ejbCreate", gnife);
throw new CreateException(gnife.getMessage());
} catch (NullPointerException ex1) {
ex1.printStackTrace();
log.warn("ejbCreate(): " + ex1);
throw new CreateException("ejbCreate(): " + ex1);
} finally {
if (con != null) DatabaseUtilities.close(con, log, "ejbCreate()");
//System.out.println("#### VJ: ChargeBean.ejbCreate(DCharge, DUser) context.getPrimaryKey(): " + context.getPrimaryKey().toString());
System.out.println("#### VJ: ChargeBean.ejbCreate(DCharge, DUser) (ChargeBean) trxNum: " + trxNum);
System.out.println("#### VJ: ChargeBean.ejbCreate(DCharge, DUser) (ChargePK) key.trxNum: " + key.trxNum);
System.out.println("#### VJ: ChargeBean.ejbCreate(DCharge, DUser) (DCharge): " + charge.getTrxNum());
return (key);
* The container invokes this method after invoking the ejbCreate
* method with the same arguments.
* @param charge
* @param user
public void ejbPostCreate(DCharge charge, DUser user) {
System.out.println("#### VJ: ChargeBean.ejbPostCreate(DCharge, DUser)");
updateTotals();
isDirty = false;
System.out.println("#### VJ: ChargeBean.ejbPostCreate(DCharge, DUser) context.getPrimaryKey(): " + context.getPrimaryKey().toString());
System.out.println("#### VJ: ChargeBean.ejbPostCreate(DCharge, DUser) (ChargeBean) trxNum: " + trxNum);
System.out.println("#### VJ: ChargeBean.ejbPostCreate(DCharge, DUser) (DCharge): " + charge.getTrxNum());
* @exception ReadFailedException
* @return
public DCharge getDetails()
throws ReadFailedException {
DCharge charge = new DCharge();
try {
updateTotals();
charge.setTrxNum(this.trxNum);
getAttributes(charge);
DModificationHistory history = new DModificationHistory();
history.setCreatedDate(this.createdDate);
history.setCreatedBy(this.createdBy);
history.setModifiedDate(this.modifiedDate);
history.setModifiedBy(this.modifiedBy);
charge.setModificationHistory(history);
} catch (InvalidDataException ex1) {
log.warn("getDetails(): " + ex1);
throw new ReadFailedException("getDetails(): " + ex1.toString());
} catch (NullPointerException ex2) {
log.warn("getDetails(): " + ex2);
throw new ReadFailedException("getDetails(): " + ex2.toString());
return (charge);
* @exception ReadFailedException
* @return
public DCharge getAllDetails()
throws ReadFailedException {
DCharge charge = null;
try {
// get non dependant object data
charge = getDetails();
// declare and init search home ejbs
Context ctx = new InitialContext();
// used for searching
ChargePK chargePK = new ChargePK();
chargePK.trxNum = this.trxNum;
System.out.println("#### VJ: ChargeBean.getAllDetails() chargePK.trxNum(): " + chargePK.trxNum);
System.out.println("#### VJ: ChargeBean.getAllDetails() charge.getTrxNum(): " + charge.getTrxNum());
// load the charge line items
try {
Object obj = ctx.lookup("java:comp/env/ejb/au.com.cams.cims.ar.ejb.ChargeLineSearchHome");
ChargeLineSearchHome chargeLineSearchHome = (ChargeLineSearchHome) PortableRemoteObject.narrow(obj, ChargeLineSearchHome.class);
ChargeLineSearch chargeLineSearch = chargeLineSearchHome.create();
System.out.println("ChargePK: " + chargePK.trxNum);
charge.setLineItems(chargeLineSearch.searchByCharge(chargePK));
} catch (NamingException ne) {
log.warn("getAllDetails(): couldn't lookup ChargeLineSearchHome " + ne.toString());
} catch (InvalidDataException ide) {
log.warn("getAllDetails(): couldn't set ChargeLineSearchHome " + ide.toString());
} catch (SearchFailedException sfe) {
log.warn("getAllDetails(): search failed " + sfe.toString());
} catch (CreateException ce) {
log.warn("getAllDetails(): couldn't create ChargeLineSearchHome " + ce.toString());
} catch (RemoteException re) {
log.warn("getAllDetails(): " + re.toString());
} catch (NamingException ex) {
log.warn("getAllDetails(): couldn't get an initial context " + ex.toString());
throw new ReadFailedException("getAllDetails(): " + ex.toString());
return charge;
* @param charge
* @param user
* @exception UpdateFailedException
public void setDetails(DCharge charge, DUser user)
throws UpdateFailedException {
System.out.println("#### VJ: ChargeBean.setDetails(DCharge, DUser)");
try {
// set other attributes
setAttributes(charge);
updateTotals();
// set mod history
this.modifiedDate = new Timestamp(new java.util.Date().getTime());
this.modifiedBy = user.getUsername();
} catch (NullPointerException ex1) {
log.warn("setDetails(): " + ex1);
throw new UpdateFailedException("setDetails(): " + ex1.toString());
* Increments the next sequenceId and returns the current sequenceId (before incrememt)
* @exception java.rmi.RemoteException
* @exception UpdateFailedException
public Integer incNextSequenceId()
throws UpdateFailedException {
Integer nextId = null;
try {
int current = this.nextSequenceId.intValue();
// make a copy of the existing id
nextId = new Integer(current);
// now inc it
this.nextSequenceId = new Integer(++current);
} catch (EJBException e) {
log.error("incNextSequenceId(): couldn't inc next sequenceId: " + e.toString());
throw new UpdateFailedException(e.getMessage());
return nextId;
* Used by setDetails, ejbCreate.
* @param member
protected void setAttributes(DCharge charge) {
System.out.println("#### VJ: ChargeBean.setAttributes(DCharge)");
this.isDirty = true;
ARTransactionManager mgr = null;
try {
Context ctx = new InitialContext();
Object obj = ctx.lookup("java:comp/env/ejb/au.com.cams.cims.ar.ejb.ARTransactionManagerHome");
ARTransactionManagerHome mgrHome = (ARTransactionManagerHome) PortableRemoteObject.narrow(obj, ARTransactionManagerHome.class);
mgr = mgrHome.create();
} catch (NamingException ne) {
log.warn("setAttributes(): couldn't lookup ARTransactionManagerHome " + ne.toString());
throw new EJBException(ne.toString());
} catch (CreateException ce) {
log.warn("setAttributes(): couldn't create ARTransactionManagerHome " + ce.toString());
throw new EJBException(ce.toString());
} catch (RemoteException ex) {
log.error(ex.toString());
throw new EJBException(ex.toString());
try {
TaxCode tc = mgr.getTaxCode(charge.getTaxCode());
TaxAmounts amounts = ARUtilities.calculateTax(charge.getFreightAmount(), tc);
this.taxOnFreightAmount = new Double(amounts.getAmountTax().doubleValue() - amounts.getAmountTaxIncluded().doubleValue());
} catch (ReadFailedException rfe) {
log.error("ReadFailedException reading tax code : " + charge.getTaxCode(), rfe);
throw new EJBException(rfe.toString());
} catch (RecordNotFoundException rnfe) {
log.error("RecordNotFoundException reading tax code : " + charge.getTaxCode(), rnfe);
throw new EJBException(rnfe.toString());
} catch (RemoteException ex) {
log.error(ex.toString());
throw new EJBException(ex.toString());
System.out.println("#### VJ: ChargeBean.setAttributes(DCharge) prior setters");
this.applyToNum = charge.getApplyToNum();
this.termsCode = charge.getTermsCode();
this.finChgCode = charge.getFinanceChargeCode();
this.shippingCode = charge.getShippingCode();
this.postingCode = charge.getPostingCode();
this.taxCode = charge.getTaxCode();
this.agingDate = new Timestamp(charge.getAgingDate().getTime());
this.dueDate = new Timestamp(charge.getDueDate().getTime());
this.grossAmount = charge.getGrossAmount();
this.taxAmount = charge.getTaxAmount();
this.taxIncludedAmount = charge.getTaxIncludedAmount();
this.freightAmount = charge.getFreightAmount();
this.netAmount = charge.getNetAmount();
this.paidAmount = charge.getPaidAmount();
this.dueAmount = charge.getDueAmount();
this.trxType = charge.getTrxType();
this.docNum = charge.getDocNum();
this.docDate = new Timestamp(charge.getDocDate().getTime());
this.applyDate = new Timestamp(charge.getApplyDate().getTime());
this.debtorNum = charge.getDebtorNum();
this.trxStatus = charge.getTrxStatus();
this.approvalStatus = charge.getApprovalStatus();
this.printingStatus = charge.getPrintingStatus();
this.postingStatus = charge.getPostingStatus();
this.holdStatus = charge.getHoldStatus();
this.holdReason = charge.getHoldReason();
this.notes = charge.getNotes();
this.message = charge.getMessage();
this.nextSequenceId = charge.getNextSequenceId();
DAddress billingAddress = charge.getBillingAddress();
if (billingAddress != null) {
this.billingAddressee = billingAddress.getAddressee();
this.billingJobPosition = billingAddress.getPosition();
this.billingAddr1 = billingAddress.getAddress1();
this.billingI've solved this problem using JDBC.
Thanks
Smile
Message was edited by:
nsqsmile -
Hello Experts..,
I created a EJB session bean 3.0 (Remote and Local). I created a web service from this bean.
When I test the web service, I get following exception...
javax.ejb.EJBException: Exception raised from invocation of public java.lang.String com.<name>...doeHeader(java.lang.String) method on bean instance com.<name>...@714647bf for bean nested exception is: javax.xml.ws.WebServiceException: java.lang.ClassCastException: class ..jndi.persistent.UnsatisfiedReferenceImpl:service:[email protected]@4807ccf6@alive incompatible with interface
My ejb-jar.xml is almost empty:
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
</ejb-jar>
Am I missing any properties in the ejb-jar.xml?
Server logs show
at $Proxy3060.salesOrderCreateOut(Unknown Source)
at com...doe.salesheader.DoeToPIBean.doeHeader(DoeToPIBean.java:58)
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)
What does these logs mean?
Thanks
SrinivasHere is the DoeToPIBean
@WebService(targetNamespace="http://<name>.com/doe/salesheader/", endpointInterface="com...doe.salesheader.DoeToPIRemote", portName="DoeToPIBeanPort", serviceName="DoeToPIService")
@Stateless
public class DoeToPIBean implements DoeToPIRemote, DoeToPILocal {
@WebServiceRef (name="SalesOrderCreateOutService")
private SalesOrderCreateOutService service;
public String doeHeader(String headerXml){
SalesOrderCreateOut servicePort = service.getSalesOrderCreate_Out_Port();
javax.xml.ws.BindingProvider bp = (javax.xml.ws.BindingProvider) servicePort;
Map<String, Object> context = bp.getRequestContext();
context.put(BindingProvider.USERNAME_PROPERTY, "<name>");
context.put(BindingProvider.PASSWORD_PROPERTY, "<pwd>");
SalesOrderResponse response = null;
Project salesOrderCreateRequest = new Project();
Header header = new Header();
header.setTitle("EAST COAST SHEET METAL MOTOR WARRANTY");
header.setBillToName("GLOBAL MECHANICAL SYSTEMS LTD");
salesOrderCreateRequest.setHeader(header);
try {
response = servicePort.salesOrderCreateOut(salesOrderCreateRequest);
} catch (SalesOrderError_Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
TRETURN treturn = response.getTRETURN();
Iterator ls = treturn.getItem().iterator();
while(ls.hasNext()){
TRETURN.Item tempItem = (TRETURN.Item)ls.next();
headerXml = tempItem.getMESSAGE();
break;
return headerXml;
Exception occurs on the bold line above: (line 58)
When I "CTRL + click" on the method "salesOrderCreateOut" on this line, it goes to the interface declaration. So I don't see the implementation of this interface method anywhere in my workspace..,
I generated this client code using the wizard similar to wsimport..
Here is the full stack trace:
Error com.sap.engine.services.webservices.espbase.client.bindings.impl.SOAPTransportBinding # java.lang.ClassCastException: class com.sap.engine.services.jndi.persistent.UnsatisfiedReferenceImpl:service:[email protected]@75da931b@alive incompatible with interface com.sap.engine.services.webservices.espbase.xi.ESPXIMessageProcessor:library:[email protected]ssLoader@5892a78b@alive
[EXCEPTION]
javax.xml.ws.WebServiceException: java.lang.ClassCastException: class com.sap.engine.services.jndi.persistent.UnsatisfiedReferenceImpl:service:[email protected]@75da931b@alive incompatible with interface com.sap.engine.services.webservices.espbase.xi.ESPXIMessageProcessor:library:[email protected]ssLoader@5892a78b@alive
at com.sap.engine.services.webservices.espbase.client.bindings.impl.SOAPTransportBinding.call_XI(SOAPTransportBinding.java:2067)
at com.sap.engine.services.webservices.espbase.client.bindings.impl.SOAPTransportBinding.callWOLogging(SOAPTransportBinding.java:812)
at com.sap.engine.services.webservices.espbase.client.bindings.impl.SOAPTransportBinding.call(SOAPTransportBinding.java:759)
at com.sap.engine.services.webservices.espbase.client.jaxws.core.WSInvocationHandler.processTransportBindingCall(WSInvocationHandler.java:167)
at com.sap.engine.services.webservices.espbase.client.jaxws.core.WSInvocationHandler.invokeSEISyncMethod(WSInvocationHandler.java:120)
at com.sap.engine.services.webservices.espbase.client.jaxws.core.WSInvocationHandler.invokeSEIMethod(WSInvocationHandler.java:83)
at com.sap.engine.services.webservices.espbase.client.jaxws.core.WSInvocationHandler.invoke(WSInvocationHandler.java:64)
at $Proxy3060.salesOrderCreateOut(Unknown Source)
at com....doe.salesheader.DoeToPIBean.doeHeader(DoeToPIBean.java:58)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
Here is the full stack trace, as this editor won't let me paste (limit is 7500 chars)...
http://www.yousendit.com/download/YWhPSkhRTXY3bUJjR0E9PQ -
Prevent javax.ejb.EJBException in log file
I am getting javax.ejb.EJBException's in my code when I try to instantiate an EJB with a bad primary key. I have put the instantiation inside of a try catch, and caught the generic "Exception". I have also tried catching the javax.ejb.EJBException.
In both cases I am still getting the javax.ejb.EJBException error message printing in my log files. is there a way to prevent this from printing in the log files?check this thread
Problem in PI 7.11 - SLD -
Javax.ejb.CreateException: "Help.." :)
i am building two tables the relationship between them is one to many..
I just created a very simple test code run a JSP to call one of these entity beans.. and I got the Error like this...
javax.ejb.CreateException: Error creating EntityBean: ORA-01747: invalid user.table.column, table.column, or column specification
I have checked my Oracle Database and codes seems nothing is wrong.. I actually built this CMB by using JDeveloper 9031 and creating the entity bean from the table directly..
really no clues with this error now.. :( Help Help :)i just created this dummy program to test.. when two tables has realtionship how can i deal with the entity beans..
StudentHome Interface (part of the codes)
Student create(Long id, String name, String password, String email, Timestamp date, ClassesLocal classes_class_id) throws RemoteException, CreateException;
ClassesHome interface(part of the codes)
Classes create(String class_id, String name, String location, String roomid, String teacherid) throws RemoteException, CreateException;
my client Servlet (part of the codes)
try{
// get My Jobs for this user
Context ctx = new InitialContext();
Object jndiRef01 = ctx.lookup("Classes");
Object portableObj01 = PortableRemoteObject.narrow(jndiRef01, ClassesHome.class);
ClassesHome ejbHome01 = (ClassesHome) portableObj01;
System.out.println("00");
ejbHome01.create("xxx24","xxx24", "xxx24","xxx24","xxx24");
System.out.println("02");
Object jndiRef02 = ctx.lookup("Student");
Object portableObj02 = PortableRemoteObject.narrow(jndiRef01, StudentHome.class);
StudentHome ejbHome02 = (StudentHome) portableObj02;
Calendar dd = Calendar.getInstance();
ejbHome02.create(new Long(11),"11","11","ere", new Timestamp((dd.getTime()).getTime()), ????????????????);
}catch (Exception e)
e.printStackTrace();
=================================================================================
I used Jdeveloper 9032 IDE and built these two CMPs by mapping from Oracle database directly.... i didnot modify anything for these two CMPs since assume JDeveloper will do the setting for me..
One of the problems i am facing now is
what vale (ClassesLocal classes_class_id) should I put when call this create method... this paramter is gennerated by IDE.....
Student create(Long id, String name, String password, String email, Timestamp date, ClassesLocal classes_class_id) throws RemoteException, CreateException;
Thanks for your reply.. will check back later -
Javax.ejb.ObjectNotFoundException
While I am using any find method that is not returing any row, I am getting javax.ejb.ObjectNotFoundException - it is not returning null. The finder methods has return type as Interface (Remote/Local EJB object).
Does it correspond to J2EE specification and if it is what is the reason behind it?
I have to use try-catch for the same to handle it.Yes, this is the spec defined behavior for finder methods that have single-valued return types. Here's the relevant text from the Entity Bean chapter in the spec :
"Note that a single-object finder method may return a nul lvalue. If the result set of the query consists of
a single null value, the container must return the null value as the result of the method. If the result set of
a query for a single-object finder method contains more than one value (whether non-null, null, or a
combination), the container must throw the FinderException from the finder method. If the result
set of the query contains no values, the container must throw theObjectNotFoundException. "
You can get your desired behaivor by declaring a finder method with a collection-valued return type. In that case, if the query results are empty, an empty collection will be returned.
--ken -
Catch TransactionRolledbackLocalException ejb session
Hi,
I'm working with ADF Faces, JSF and EJB3. Now when I use UnitOfWork's commit and it fails I throw a RuntimeException that it catched and wrapped in a TransactionRolledbackLocalException.
I need to manage TransactionRolledbackLocalException because I must identify what causes the exception and re-throws the correct exception
ThanksThe EJB spec defines two kinds of exceptions : system exceptions and application exceptions. System exceptions are considered severe errors that are not recoverable. If you throw a RuntimeException it will be considered a system exception and will result in an EJBException being delivered to the caller. In this case the exception thrown from the bean code is not necessarily visible to the caller, even in the exception chain. If you want to deliver a specific exception to the caller "as is" then throw an Application Exception. You can do that by throwing any exception that subclasses java.lang.Exception. You can also take a user-defined class that extends RuntimeException and annotate it with @javax.ejb.ApplicationException to have it treated as an Application Exception by the container.
-
Javax.ejb.EJBException: Null primary key returned by ejbCreate method
Hi all,
I'm using SunOne 7.1 and I got this error when I call the create on the CMP bean.
javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: javax.ejb.EJBException: Null primary key returned by ejbCreate method
[14/Aug/2004:01:15:34] WARNING ( 4044): CORE3283: stderr: javax.ejb.EJBException: Null primary key returned by ejbCreate method
[14/Aug/2004:01:15:34] WARNING ( 4044): CORE3283: stderr: at com.sun.ejb.containers.EntityContainer.postCreate(EntityContainer.java:801)
[14/Aug/2004:01:15:34] WARNING ( 4044): CORE3283: stderr: at uk.co.upco.workflow.applicationAdmin.ejb.ApplicationAdminBean_854379388_ConcreteImpl_LocalHomeImpl.createNewApplication(ApplicationAdminBean_854379388_ConcreteImpl_LocalHomeImpl.java:64)
[14/Aug/2004:01:15:34] WARNING ( 4044): CORE3283: stderr: at uk.co.upco.workflow.sessionFacedeApplicationAdmin.SFApplicationAdminBean.insertNewApplicationName(SFApplicationAdminBean.java:64)
[14/Aug/2004:01:15:34] WARNING ( 4044): CORE3283: stderr: at uk.co.upco.workflow.sessionFacedeApplicationAdmin.SFApplicationAdminBean_EJBObjectImpl.insertNewApplicationName(SFApplicationAdminBean_EJBObjectImpl.java:31)
[14/Aug/2004:01:15:34] WARNING ( 4044): CORE3283: stderr: at uk.co.upco.workflow.sessionFacedeApplicationAdmin._SFApplicationAdminBean_EJBObjectImpl_Tie._invoke(Unknown Source)
[14/Aug/2004:01:15:34] WARNING ( 4044): CORE3283: stderr: at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(GenericPOAServerSC.java:569)
[14/Aug/2004:01:15:34] WARNING ( 4044): CORE3283: stderr: at com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(GenericPOAServerSC.java:211)
[14/Aug/2004:01:15:34] WARNING ( 4044): CORE3283: stderr: at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(GenericPOAServerSC.java:113)
[14/Aug/2004:01:15:34] WARNING ( 4044): CORE3283: stderr: at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:275)
[14/Aug/2004:01:15:34] WARNING ( 4044): CORE3283: stderr: at com.sun.corba.ee.internal.iiop.RequestProcessor.process(RequestProcessor.java:83)
[14/Aug/2004:01:15:34] WARNING ( 4044): CORE3283: stderr: at com.iplanet.ias.corba.ee.internal.iiop.ServicableWrapper.service(ServicableWrapper.java:25)
[14/Aug/2004:01:15:34] WARNING ( 4044): CORE3283: stderr: at com.iplanet.ias.util.threadpool.FastThreadPool$ThreadPoolThread.run(FastThreadPool.java:283)
[14/Aug/2004:01:15:34] WARNING ( 4044): CORE3283: stderr: at java.lang.Thread.run(Thread.java:534)
cmp:
public java.lang.Integer ejbCreateNewApplication(java.lang.String application) throws javax.ejb.CreateException {
setApplication(application);
return null;
The key is auto_increment and is an integer.
I'm usin MySQL and it is already set up as ANSI. (running as mysqld --ansi)
Any Idea?
Thanks in advanceWhat happend when two concourrent user try to get the same key on the table? If for example I have 30 users at same time do I have lock table?
Any way here the finest log using sunone 8. The error is the same, so I think I missing something:
[#|2004-08-14T12:11:19.296+0100|FINE|sun-appserver-pe8.0|javax.enterprise.system.util|_ThreadID=11;|IM: preInvokeorg.apache.catalina.servlets.DefaultServlet@1acecf3|#]
[#|2004-08-14T12:11:19.296+0100|FINE|sun-appserver-pe8.0|javax.enterprise.system.util|_ThreadID=11;|IM: postInvokeorg.apache.catalina.servlets.DefaultServlet@1acecf3|#]
[#|2004-08-14T12:11:26.166+0100|FINE|sun-appserver-pe8.0|javax.enterprise.system.core.security|_ThreadID=22;|JACC: returning cached ProtectionDomain - CodeSource: ((file:/Test <no certificates>)) PrincipalSet: null|#]
[#|2004-08-14T12:11:26.166+0100|FINE|sun-appserver-pe8.0|javax.enterprise.system.core.security|_ThreadID=22;|JACC: Changing Policy Context ID: oldV = null newV = Test|#]
[#|2004-08-14T12:11:26.166+0100|FINE|sun-appserver-pe8.0|javax.enterprise.system.core.security|_ThreadID=22;|JACC: Access Control Decision Result: true EJBMethodPermission (Name) = SFApplicationAdmin (Action) = create,Home, (Codesource) = (file:/Test <no certificates>)|#]
[#|2004-08-14T12:11:26.186+0100|FINE|sun-appserver-pe8.0|javax.enterprise.system.core.security|_ThreadID=22;|JACC: returning cached ProtectionDomain - CodeSource: ((file:/Test <no certificates>)) PrincipalSet: null|#]
[#|2004-08-14T12:11:26.186+0100|FINE|sun-appserver-pe8.0|javax.enterprise.system.core.security|_ThreadID=22;|JACC: Access Control Decision Result: true EJBMethodPermission (Name) = SFApplicationAdmin (Action) = insertNewApplicationName,Remote,java.util.Hashtable (Codesource) = (file:/Test <no certificates>)|#]
[#|2004-08-14T12:11:26.186+0100|FINE|sun-appserver-pe8.0|javax.enterprise.system.util|_ThreadID=22;|IM: preInvokeuk.co.myDomain.workflow.sessionFacedeApplicationAdmin.SFApplicationAdminBean@1fa487f|#]
[#|2004-08-14T12:11:26.186+0100|FINE|sun-appserver-pe8.0|javax.enterprise.system.core.security|_ThreadID=22;|JACC: doAsPrivileged contextId(Test)|#]
[#|2004-08-14T12:11:26.186+0100|INFO|sun-appserver-pe8.0|javax.enterprise.system.stream.out|_ThreadID=22;|
new|#]
[#|2004-08-14T12:11:26.186+0100|INFO|sun-appserver-pe8.0|javax.enterprise.system.stream.out|_ThreadID=22;|
mgmt: com.sun.enterprise.naming.TransientContext:com.sun.enterprise.naming.TransientContext@ad00b2|#]
[#|2004-08-14T12:11:26.186+0100|INFO|sun-appserver-pe8.0|javax.enterprise.system.stream.out|_ThreadID=22;|
new|#]
[#|2004-08-14T12:11:26.186+0100|INFO|sun-appserver-pe8.0|javax.enterprise.system.stream.out|_ThreadID=22;|
SFApplicationAdmin: javax.naming.Reference:Reference Class Name: reference
Type: url
Content: ejb/SFApplicationAdmin
|#]
[#|2004-08-14T12:11:26.186+0100|FINE|sun-appserver-pe8.0|javax.enterprise.system.core.security|_ThreadID=22;|JACC: returning cached ProtectionDomain - CodeSource: ((file:/Test <no certificates>)) PrincipalSet: null|#]
[#|2004-08-14T12:11:26.186+0100|FINE|sun-appserver-pe8.0|javax.enterprise.system.core.security|_ThreadID=22;|JACC: Access Control Decision Result: true EJBMethodPermission (Name) = ApplicationAdmin (Action) = createNewApplication,LocalHome,java.lang.String (Codesource) = (file:/Test <no certificates>)|#]
[#|2004-08-14T12:11:26.196+0100|FINE|sun-appserver-pe8.0|javax.enterprise.system.container.ejb|_ThreadID=22;|[Pool-ApplicationAdmin]: Added PoolResizeTimerTask...|#]
[#|2004-08-14T12:11:26.196+0100|FINE|sun-appserver-pe8.0|javax.enterprise.system.util|_ThreadID=22;|IM: preInvokeuk.co.myDomain.workflow.applicationAdmin.ejb.ApplicationAdminBean_1421299025_ConcreteImpl@7ae165|#]
[#|2004-08-14T12:11:26.196+0100|FINEST|sun-appserver-pe8.0|javax.enterprise.resource.jdo.persistencemanager|_ThreadID=22;|:Thread[Worker: 16,5,org.apache.commons.launcher.ChildMain] -->SQLPersistenceManagerFactory.getPersistenceManager().|#]
[#|2004-08-14T12:11:26.196+0100|FINEST|sun-appserver-pe8.0|javax.enterprise.resource.jdo.persistencemanager|_ThreadID=22;|Thread[Worker: 16,5,org.apache.commons.launcher.ChildMain] <->SQLPersistenceManagerFactory.getPersistenceManager() FOUND javax.transaction.Transaction: com.sun.ejb.containers.PMTransactionImpl@5.|#]
[#|2004-08-14T12:11:26.196+0100|FINEST|sun-appserver-pe8.0|javax.enterprise.resource.jdo.persistencemanager|_ThreadID=22;|<--SQLPersistenceManagerFactory.getFromPool().|#]
[#|2004-08-14T12:11:26.196+0100|FINEST|sun-appserver-pe8.0|javax.enterprise.resource.jdo.persistencemanager|_ThreadID=22;|PersistenceManagerImpl cache properties: _txCacheInitialCapacity=20, _flushedCacheInitialCapacity=20, _flushedCacheLoadFactor=0.75, _weakCacheInitialCapacity=20, _weakCacheLoadFactor=0.75.|#]
[#|2004-08-14T12:11:26.196+0100|FINEST|sun-appserver-pe8.0|javax.enterprise.resource.jdo.utility|_ThreadID=22;|NullSemaphore constructor() for PersistenceManagerImpl.cacheLock.|#]
[#|2004-08-14T12:11:26.196+0100|FINEST|sun-appserver-pe8.0|javax.enterprise.resource.jdo.utility|_ThreadID=22;|NullSemaphore constructor() for PersistenceManagerImpl.fieldUpdateLock.|#]
[#|2004-08-14T12:11:26.196+0100|FINEST|sun-appserver-pe8.0|javax.enterprise.resource.jdo.persistencemanager|_ThreadID=22;|<--SQLPersistenceManagerFactory.getFromPool() PM: com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl@8d18c for JTA com.sun.ejb.containers.PMTransactionImpl@5.|#]
[#|2004-08-14T12:11:26.196+0100|FINEST|sun-appserver-pe8.0|javax.enterprise.resource.jdo.persistencemanager|_ThreadID=22;|<->SQLPersistenceManagerFactory.getPersistenceManager() JDO Transaction: Transaction:
status = STATUS_NO_TRANSACTION
Transaction Object = Transaction@16077795
threads = 0
.|#]
[#|2004-08-14T12:11:26.196+0100|FINEST|sun-appserver-pe8.0|javax.enterprise.resource.jdo.transaction|_ThreadID=22;|Thread[Worker: 16,5,org.apache.commons.launcher.ChildMain] Tran[ Transaction:
status = STATUS_NO_TRANSACTION
Transaction Object = Transaction@16077795
threads = 0
].begin:status = STATUS_NO_TRANSACTION ,txType: UNKNOWN for com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl@8d18c.|#]
[#|2004-08-14T12:11:26.196+0100|FINEST|sun-appserver-pe8.0|javax.enterprise.resource.jdo.transaction|_ThreadID=22;|Thread[Worker: 16,5,org.apache.commons.launcher.ChildMain] Tran[ Transaction:
status = STATUS_NO_TRANSACTION
Transaction Object = Transaction@16077795
threads = 0
].setStatus: STATUS_NO_TRANSACTION => STATUS_ACTIVE for com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl@8d18c.|#]
[#|2004-08-14T12:11:26.196+0100|FINEST|sun-appserver-pe8.0|javax.enterprise.resource.jdo.persistencemanager|_ThreadID=22;|Thread[Worker: 16,5,org.apache.commons.launcher.ChildMain] <->SQLPersistenceManagerFactory.getPersistenceManager() : com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl@8d18c for JTA: com.sun.ejb.containers.PMTransactionImpl@5.|#]
[#|2004-08-14T12:11:26.196+0100|FINEST|sun-appserver-pe8.0|javax.enterprise.resource.jdo.persistencemanager|_ThreadID=22;|---PersistenceManagerImpl.getCurrentWrapper() > current: null.|#]
[#|2004-08-14T12:11:26.196+0100|FINEST|sun-appserver-pe8.0|javax.enterprise.resource.jdo.persistencemanager|_ThreadID=22;|---PersistenceManagerImpl.pushCurrentWrapper() > current: null new: com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerWrapper@567117.|#]
[#|2004-08-14T12:11:26.196+0100|FINEST|sun-appserver-pe8.0|javax.enterprise.resource.jdo.persistencemanager|_ThreadID=22;|---PersistenceManagerImpl.popCurrentWrapper() > current: com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerWrapper@567117 prev: null.|#]
[#|2004-08-14T12:11:26.196+0100|FINE|sun-appserver-pe8.0|javax.enterprise.system.util|_ThreadID=22;|IM: postInvokeuk.co.myDomain.workflow.applicationAdmin.ejb.ApplicationAdminBean_1421299025_ConcreteImpl@7ae165|#]
[#|2004-08-14T12:11:26.196+0100|FINE|sun-appserver-pe8.0|javax.enterprise.system.container.ejb|_ThreadID=22;|Exception in forceDestroyBean()
java.lang.IllegalStateException: Primary key not available
at com.sun.ejb.containers.EntityContextImpl.getPrimaryKey(EntityContextImpl.java:114)
at com.sun.ejb.containers.EntityContainer.forceDestroyBean(EntityContainer.java:1232)
at com.sun.ejb.containers.BaseContainer.checkExceptionClientTx(BaseContainer.java:2559)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:2416)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:763)
at com.sun.ejb.containers.EJBLocalHomeInvocationHandler.invoke(EJBLocalHomeInvocationHandler.java:197)
at $Proxy10.createNewApplication(Unknown Source)
at uk.co.myDomain.workflow.sessionFacedeApplicationAdmin.SFApplicationAdminBean.insertNewApplicationName(SFApplicationAdminBean.java:64)
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:324)
at com.sun.enterprise.security.SecurityUtil$2.run(SecurityUtil.java:146)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.enterprise.security.application.EJBSecurityManager.doAsPrivileged(EJBSecurityManager.java:930)
at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:151)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:128)
at $Proxy7.insertNewApplicationName(Unknown Source)
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:324)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:117)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:651)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:190)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1653)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1513)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:895)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:172)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:668)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:375)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.read(SocketOrChannelConnectionImpl.java:284)
at com.sun.corba.ee.impl.transport.ReaderThreadImpl.doWork(ReaderThreadImpl.java:73)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:382)
|#]
[#|2004-08-14T12:11:26.196+0100|INFO|sun-appserver-pe8.0|javax.enterprise.system.container.ejb|_ThreadID=22;|EJB5018: An exception was thrown during an ejb invocation on [ApplicationAdmin]|#]
[#|2004-08-14T12:11:26.196+0100|INFO|sun-appserver-pe8.0|javax.enterprise.system.container.ejb|_ThreadID=22;|
javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: java.lang.IllegalArgumentException: JDO73013: Primary Key field applicationId for bean 'ApplicationAdmin' cannot be null.
java.lang.IllegalArgumentException: JDO73013: Primary Key field applicationId for bean 'ApplicationAdmin' cannot be null.
at com.sun.jdo.spi.persistence.support.ejb.cmp.JDOEJB11HelperImpl.assertPrimaryKeyFieldNotNull(JDOEJB11HelperImpl.java:446)
at uk.co.myDomain.workflow.applicationAdmin.ejb.ApplicationAdminBean_1421299025_ConcreteImpl.setApplicationId(ApplicationAdminBean_1421299025_ConcreteImpl.java:102)
at uk.co.myDomain.workflow.applicationAdmin.ejb.ApplicationAdminBean.ejbCreateNewApplication(ApplicationAdminBean.java:93)
at uk.co.myDomain.workflow.applicationAdmin.ejb.ApplicationAdminBean_1421299025_ConcreteImpl.ejbCreateNewApplication(ApplicationAdminBean_1421299025_ConcreteImpl.java:334)
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:324)
at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:140)
at com.sun.ejb.containers.EJBLocalHomeInvocationHandler.invoke(EJBLocalHomeInvocationHandler.java:168)
at $Proxy10.createNewApplication(Unknown Source)
at uk.co.myDomain.workflow.sessionFacedeApplicationAdmin.SFApplicationAdminBean.insertNewApplicationName(SFApplicationAdminBean.java:64)
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:324)
at com.sun.enterprise.security.SecurityUtil$2.run(SecurityUtil.java:146)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.enterprise.security.application.EJBSecurityManager.doAsPrivileged(EJBSecurityManager.java:930)
at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:151)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:128)
at $Proxy7.insertNewApplicationName(Unknown Source)
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:324)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:117)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:651)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:190)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1653)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1513)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:895)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:172)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:668)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:375)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.read(SocketOrChannelConnectionImpl.java:284)
at com.sun.corba.ee.impl.transport.ReaderThreadImpl.doWork(ReaderThreadImpl.java:73)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:382)
javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: java.lang.IllegalArgumentException: JDO73013: Primary Key field applicationId for bean 'ApplicationAdmin' cannot be null.
at com.sun.ejb.containers.BaseContainer.checkExceptionClientTx(BaseContainer.java:2564)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:2416)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:763)
at com.sun.ejb.containers.EJBLocalHomeInvocationHandler.invoke(EJBLocalHomeInvocationHandler.java:197)
at $Proxy10.createNewApplication(Unknown Source)
at uk.co.myDomain.workflow.sessionFacedeApplicationAdmin.SFApplicationAdminBean.insertNewApplicationName(SFApplicationAdminBean.java:64)
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:324)
at com.sun.enterprise.security.SecurityUtil$2.run(SecurityUtil.java:146)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.enterprise.security.application.EJBSecurityManager.doAsPrivileged(EJBSecurityManager.java:930)
at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:151)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:128)
at $Proxy7.insertNewApplicationName(Unknown Source)
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:324)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:117)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:651)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:190)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1653)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1513)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:895)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:172)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:668)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:375)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.read(SocketOrChannelConnectionImpl.java:284)
at com.sun.corba.ee.impl.transport.ReaderThreadImpl.doWork(ReaderThreadImpl.java:73)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:382)
|#]
Any Idea?
Thanks in advance for any help
Maybe you are looking for
-
Hello, I have just connected my Macbook Pro to a 1080p 23' LG monitor using a Displayport to VGI adapter. However, when I use the 1080p setting, it cuts off a little bit of the top bar. When I switch to lower resolutions, it works just fine. I would
-
View responses - any way to print or view as form?
Hi - am new to forms central Previous posted links to .pdf forms at acrobat.com. There is was possible to print individual reponses as a .pdf Is there a was to format the reponses as a form - I have printed the 'Show Detail' view but it doesnt seem t
-
IPhoto opens whenever iPhone is connected
Even though I have syncing of photos deselected in my iPhone settings in iTunes. Is there some way to turn this off? Thanks
-
Hp touchpad (so many problems)
First of all let me say i liked using my hp touch pad to view youtube and use apps ect... But then my charger broke when i would plug it in it would not work half the time. A day later it I had to wiggle it to get it to charge then it stopped chargin
-
If I create a view in db of Pub Schema to display some data related to some products do I need to have the asset version, workspace id et al. related columns in the view as well ?