How to catch SQLException from a session bean
Hello
I have a stateless session bean which has a method to persist an entity (User) in the database. In User there is a foreign key (addressId) from another entity (Address). While i was persisting User, i entered a value of addressId which was not present in the Address table. Since there was a foreign key constraint on this field in User i got the following exception:
8:49:49,421 ERROR [JDBCExceptionReporter] ORA-02291:
integrity constraint (FK_USER_ADD) violated - parent key not
found 18:49:49,421 ERROR [AbstractFlushingEventListener]
Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: could
not insert: [com.User] at org.hibernate.exception.SQLStateConverter.convert(SQLState
Converter.java:71)So i placed the persist code inside a try block and was catching all the exceptions thrown by persist() method. But these exception are not caught. Instead the exception is sent to the Client end and printed on the client console.
Any clue on how to catch the ConstraintViolationException in the session bean?
Thanks
The problem is that the qry is not executed until you leave your method, so, the exception is catched by the Container. You should issue a entityManager.flush(); rigth "before" leaving the method and you are going to catch all the exceptions given
Cheers
Similar Messages
-
How to catch SQLException in CMP bean
Hi there,
I am using CMP beans to set columns, one of which has referential integrity.
Because the abstract set() method does not declare to throw SQLException, I
can not catch SQLException in my session bean (which calls local CMP bean
for creating and setting entity beans), the compiler complains "unreachable
block".
I can only try catching RemoteException in my delegate class. I do not like
that, I even tried to catch all exceptions, i.e., catch Exception, in my
session bean, I still did not catch the SQLException.
The update calls are made into DB probably right before the transaction
completes, however, since it is the container generated classes that does DB
calls and throw SQLException, I could not catch it there since I do not have
the source code for generated classes.
Call stack is attached.
Any suggestion is welcome. Basically I would like to catch SQLException in
session bean.
Thanks.
Yan
<Oct 18, 2004 10:09:06 AM EDT> <Error> <EJB> <BEA-010026> <Exception
occurred during commit of transaction Name=[EJB com.med
lus.serviceHub.rx.ejb.pharmacy.PharmacyMgrSession.updatePharmacy(java.util.A
rrayList,long,java.lang.String)],Xid=BEA1-0153A4
2892EE25246C3(29499284),Status=Rolled back.
[Reason=weblogic.utils.NestedRuntimeException: Error writing from
beforeCompleti
n - with nested exception:
[java.sql.SQLException: ORA-02291: integrity constraint
(DX_OWNER.STATEABBR_RXPHARM_FK) violated - parent key not found
]],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=0,seconds
left=30,XAServerResourceInfo[weblogic.jdbc.wrappe
.JTSXAResourceImpl]=(ServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceI
mpl]=(state=rolledback,assigned=myserver),xar=we
logic.jdbc.wrapper.JTSXAResourceImpl@1a7491e,re-Registered =
false),SCInfo[hubservices+myserver]=(state=rolledback),properti
s=({weblogic.transaction.name=[EJB
com.medplus.serviceHub.rx.ejb.pharmacy.PharmacyMgrSession.updatePharmacy(jav
a.util.ArrayL
st,long,java.lang.String)], weblogic.jdbc=t3://172.18.15.54:7001}),local
properties=({modifiedListeners=[weblogic.ejb20.inte
nal.TxManager$TxListener@71de6e]}),OwnerTransactionManager=ServerTM[ServerCo
ordinatorDescriptor=(CoordinatorURL=myserver+172
18.15.54:7001+hubservices+t3+,
XAResources={},NonXAResources={})],CoordinatorURL=myserver+172.18.15.54:7001
hubservicest3+)
java.sql.SQLException: ORA-02291: integrity constraint
(DX_OWNER.STATEABBR_RXPHARM_FK) violated - parent key not found
at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:623)
at
oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:18
1)
at
oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatemen
t.java:543)
at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java
:1027)
at
oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedSta
tement.java:2885)
at
oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedState
ment.java:2957)
at
weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java
:115)
at
com.medplus.serviceHub.rx.ejb.pharmacy.Pharmacy_i7s2ww__WebLogic_CMP_RDBMS._
WLstore(Pharmacy_i7s2ww__WebLogic_C
P_RDBMS.java:3564)
at
com.medplus.serviceHub.rx.ejb.pharmacy.Pharmacy_i7s2ww__WebLogic_CMP_RDBMS.e
jbStore(Pharmacy_i7s2ww__WebLogic_CMP
RDBMS.java:3390)
at
weblogic.ejb20.manager.DBManager.beforeCompletion(DBManager.java:965)
at
weblogic.ejb20.internal.TxManager$TxListener.beforeCompletion(TxManager.java
:653)
at
weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(ServerSCInf
o.java:1010)
at
weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(ServerSCI
nfo.java:115)
at
weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAndChain(
ServerTransactionImpl.java:1184)
at
weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(ServerT
ransactionImpl.java:1910)
at
weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTra
nsactionImpl.java:273)
at
weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransaction
Impl.java:244)
at
weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:299)
at
weblogic.ejb20.internal.StatelessEJBObject.postInvoke(StatelessEJBObject.jav
a:140)
at
com.medplus.serviceHub.rx.ejb.pharmacy.PharmacyMgr_kb6mwa_EOImpl.updatePharm
acy(PharmacyMgr_kb6mwa_EOImpl.java:16
at
com.medplus.serviceHub.rx.ejb.pharmacy.PharmacyMgr_kb6mwa_EOImpl_WLSkel.invo
ke(Unknown Source)
at
weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
at
weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java
:108)
at
weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
t.java:363)
at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144)
at
weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:415)
at
weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:3
0)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
--------------- nested within: ------------------Hi there,
I am using CMP beans to set columns, one of which has referential integrity.
Because the abstract set() method does not declare to throw SQLException, I
can not catch SQLException in my session bean (which calls local CMP bean
for creating and setting entity beans), the compiler complains "unreachable
block".
I can only try catching RemoteException in my delegate class. I do not like
that, I even tried to catch all exceptions, i.e., catch Exception, in my
session bean, I still did not catch the SQLException.
The update calls are made into DB probably right before the transaction
completes, however, since it is the container generated classes that does DB
calls and throw SQLException, I could not catch it there since I do not have
the source code for generated classes.
Call stack is attached.
Any suggestion is welcome. Basically I would like to catch SQLException in
session bean.
Thanks.
Yan
<Oct 18, 2004 10:09:06 AM EDT> <Error> <EJB> <BEA-010026> <Exception
occurred during commit of transaction Name=[EJB com.med
lus.serviceHub.rx.ejb.pharmacy.PharmacyMgrSession.updatePharmacy(java.util.A
rrayList,long,java.lang.String)],Xid=BEA1-0153A4
2892EE25246C3(29499284),Status=Rolled back.
[Reason=weblogic.utils.NestedRuntimeException: Error writing from
beforeCompleti
n - with nested exception:
[java.sql.SQLException: ORA-02291: integrity constraint
(DX_OWNER.STATEABBR_RXPHARM_FK) violated - parent key not found
]],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=0,seconds
left=30,XAServerResourceInfo[weblogic.jdbc.wrappe
.JTSXAResourceImpl]=(ServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceI
mpl]=(state=rolledback,assigned=myserver),xar=we
logic.jdbc.wrapper.JTSXAResourceImpl@1a7491e,re-Registered =
false),SCInfo[hubservices+myserver]=(state=rolledback),properti
s=({weblogic.transaction.name=[EJB
com.medplus.serviceHub.rx.ejb.pharmacy.PharmacyMgrSession.updatePharmacy(jav
a.util.ArrayL
st,long,java.lang.String)], weblogic.jdbc=t3://172.18.15.54:7001}),local
properties=({modifiedListeners=[weblogic.ejb20.inte
nal.TxManager$TxListener@71de6e]}),OwnerTransactionManager=ServerTM[ServerCo
ordinatorDescriptor=(CoordinatorURL=myserver+172
18.15.54:7001+hubservices+t3+,
XAResources={},NonXAResources={})],CoordinatorURL=myserver+172.18.15.54:7001
hubservicest3+)
java.sql.SQLException: ORA-02291: integrity constraint
(DX_OWNER.STATEABBR_RXPHARM_FK) violated - parent key not found
at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:623)
at
oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:18
1)
at
oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatemen
t.java:543)
at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java
:1027)
at
oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedSta
tement.java:2885)
at
oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedState
ment.java:2957)
at
weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java
:115)
at
com.medplus.serviceHub.rx.ejb.pharmacy.Pharmacy_i7s2ww__WebLogic_CMP_RDBMS._
WLstore(Pharmacy_i7s2ww__WebLogic_C
P_RDBMS.java:3564)
at
com.medplus.serviceHub.rx.ejb.pharmacy.Pharmacy_i7s2ww__WebLogic_CMP_RDBMS.e
jbStore(Pharmacy_i7s2ww__WebLogic_CMP
RDBMS.java:3390)
at
weblogic.ejb20.manager.DBManager.beforeCompletion(DBManager.java:965)
at
weblogic.ejb20.internal.TxManager$TxListener.beforeCompletion(TxManager.java
:653)
at
weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(ServerSCInf
o.java:1010)
at
weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(ServerSCI
nfo.java:115)
at
weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAndChain(
ServerTransactionImpl.java:1184)
at
weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(ServerT
ransactionImpl.java:1910)
at
weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTra
nsactionImpl.java:273)
at
weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransaction
Impl.java:244)
at
weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:299)
at
weblogic.ejb20.internal.StatelessEJBObject.postInvoke(StatelessEJBObject.jav
a:140)
at
com.medplus.serviceHub.rx.ejb.pharmacy.PharmacyMgr_kb6mwa_EOImpl.updatePharm
acy(PharmacyMgr_kb6mwa_EOImpl.java:16
at
com.medplus.serviceHub.rx.ejb.pharmacy.PharmacyMgr_kb6mwa_EOImpl_WLSkel.invo
ke(Unknown Source)
at
weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
at
weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java
:108)
at
weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
t.java:363)
at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144)
at
weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:415)
at
weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:3
0)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
--------------- nested within: ------------------ -
OC4J 10.1.3: EJB3 - How to catch SQLExceptions in a SessionBean
Hi,
originally I posted this a few minutes ago in the toplink forum, but I'm
unsure if this better suits here. So exceptionally, I post it here as well with a
reference to:
EJB3 - How to catch SQLExceptions from within a stateful session bean
I would like to catch any exception while persisisting the data right in my stateful
session bean and don't have to wait until the client receives an SQLException
wrapped in a bunch of other exceptions.
Here some code fragments to illustrate my problem:
// in Client:
InitialContext ctx = new InitialContext();
statefulWork = (StatefulWork) ctx.lookup("StatefulWork");
try {
statefulWork.doIt();
} catch (Throwable t) {
// don't want to implement db-failover here, even though this works
// in SSB
@Resource
private EntityManager em;
public void doIt() {
try {
// create some entites here, do some loops, long running transaction
em.persist(oneOfMyEntityObjects);
// set some state in the SSB here
} catch (Throwable t) {
// I want to catch all exceptions the persistence provider (toplink) gets
// but I don't get any here :-(
// this should be to implement proper retry after reconnect (RAC with TAF)
}In my testcase I issue a shutdown abort while insert statements are executed.
The client receives an EJBException, but within the SSB nothing...
How to change this behavior?
Here is what one can find in the OC4J log:
[TopLink Warnung]: 2006.03.27 03:25:32.220--UnitOfWork(13386)--Thread(Thread[RMICallHandler-0,5,RequestThreadGroup])--Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
Interne Exception: java.sql.SQLException: ORA-25402: transaction must roll back
Fehlercode:25402
Call:INSERT INTO T_RUN_DETAILS (ID, INS_TIME, COUNTER, RUN_ID) VALUES (105781, '2006.03.27 03:23:55', 450, 801)After that the transaction is properly rolled back (automatically) and the client
could implement the failover code, but I could not find a possibility to control this
at server side. Even with BMT I could not manage to catch this exception. I
wouldn't have a problem if I had to call ctx.setRollbackOnly() myself.
Hope someone can help. I'm getting a little desperate here.
Thanks,
EricThanks to the help of James Sutherland I managed to get this working.
I had to add a call to em.flush() and use BMT for the SSB. For details please follow my link to the toplink-forum!
James thinks OC4J can handle automatic transaction retries but wasn't sure about how to configure this in OC4J. Anyone can help?
Regards,
Eric -
How to get access via RMI from a session bean to a remote session bean?
I have 2 J2EE applications in two different Sun Application Servers (8.0 PE). I would like to get access from one Session Bean "SB1" into Application A to Session Bean "BrickFacade" within Application B.
My Java Code from "SB1":
Context ic = new InitialContext();
Object o = ic.lookup("java:comp/env/ejb/BrickFacade");
BrickFacadeHome brickFacadeHome2 = (BrickFacadeHome) PortableRemoteObject.narrow(o, BrickFacadeHome.class);
brickFacade = brickFacadeHome2.create();
Collection col = brickFacade.doSomething();
...I configured the remote App.server in sun-ejb-jar.xml. I found the syntax within documentation (http://docs.sun.com/source/817-6087/dgjndi.html#wp24622) but I'm not sure if I this is the right usage.
<ejb-ref>
<ejb-ref-name>ejb/BrickFacade</ejb-ref-name>
<jndi-name>corbaname:iiop://161.90.176.213:3700#webclient/BrickFacade</jndi-name>
</ejb-ref>The context lookup throws the exception:
"IOP00110603: (BAD_PARAM) Bad host address in -ORBInitDef"
and
Invalid URL or IOR: corbaloc:iiop://161.90.176.213:3700
javax.naming.ConfigurationException: Invalid URL or IOR: corbaloc:iiop://161.90.176.213:3700 [Root exception is org.omg.CORBA.BAD_PARAM: vmcid: SUN minor code: 603 completed: No]
Could anyone help me? Many thanks!
Stacktrace:
"IOP00110603: (BAD_PARAM) Bad host address in -ORBInitDef"
org.omg.CORBA.BAD_PARAM: vmcid: SUN minor code: 603 completed: No
at com.sun.corba.ee.impl.logging.NamingSystemException.insBadAddress(NamingSystemException.java:148)
at com.sun.corba.ee.impl.logging.NamingSystemException.insBadAddress(NamingSystemException.java:166)
at com.sun.corba.ee.impl.naming.namingutil.CorbalocURL.badAddress(CorbalocURL.java:104)
at com.sun.corba.ee.impl.naming.namingutil.CorbalocURL.handleColon(CorbalocURL.java:140)
at com.sun.corba.ee.impl.naming.namingutil.CorbalocURL.handleIIOPColon(CorbalocURL.java:115)
at com.sun.corba.ee.impl.naming.namingutil.CorbalocURL.<init>(CorbalocURL.java:67)
at com.sun.corba.ee.impl.naming.namingutil.INSURLHandler.parseURL(INSURLHandler.java:41)
at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.operate(INSURLOperationImpl.java:103)
at com.sun.corba.ee.impl.orb.ORBImpl.string_to_object(ORBImpl.java:774)
at com.sun.jndi.cosnaming.CNCtx.setOrbAndRootContext(CNCtx.java:338)
at com.sun.jndi.cosnaming.CNCtx.initUsingCorbanameUrl(CNCtx.java:321)
at com.sun.jndi.cosnaming.CNCtx.initUsingUrl(CNCtx.java:247)
at com.sun.jndi.cosnaming.CNCtx.createUsingURL(CNCtx.java:85)
at com.sun.jndi.url.iiop.iiopURLContextFactory.getUsingURLIgnoreRest(iiopURLContextFactory.java:56)
at com.sun.jndi.url.iiop.iiopURLContext.getRootURLContext(iiopURLContext.java:44)
at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:182)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:702)
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:108)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at de.emilberlinerstudios.va.ejb.testrh.sb.TestRemoteEjbBean.getBrickFacade(TestRemoteEjbBean.java:108)
at de.emilberlinerstudios.va.ejb.testrh.sb.TestRemoteEjbBean.startTest(TestRemoteEjbBean.java:79)
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.startTest(Unknown Source)
at de.emilberlinerstudios.va.ejb.testrh.sb._TestRemoteEjb_Stub.startTest(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.forte4j.j2ee.ejbtest.webtest.InvocableMethod$MethodIM.invoke(InvocableMethod.java:231)
at com.sun.forte4j.j2ee.ejbtest.webtest.EjbInvoker.getInvocationResults(EjbInvoker.java:96)
at com.sun.forte4j.j2ee.ejbtest.webtest.DispatchHelper.getForward(DispatchHelper.java:189)
at org.apache.jsp.dispatch_jsp._jspService(dispatch_jsp.java:75)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:102)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:282)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:263)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:210)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
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 org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:246)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:268)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:236)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:141)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:214)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:168)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:144)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:133)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:539)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
at com.sun.enterprise.webservice.EjbWebServiceValve.invoke(EjbWebServiceValve.java:134)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
at com.sun.enterprise.security.web.SingleSignOn.invoke(SingleSignOn.java:272)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
at com.sun.enterprise.web.VirtualServerValve.invoke(VirtualServerValve.java:209)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:114)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
at com.sun.enterprise.web.VirtualServerMappingValve.invoke(VirtualServerMappingValve.java:166)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:936)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:165)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:683)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:604)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:542)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:647)
at java.lang.Thread.run(Thread.java:534)
|#]
[#|2006-10-02T13:52:55.390+0200|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.stream.out|_ThreadID=11;|2006-10-02 13:52:55 [8080-Processor4] INFO .va.ejb.testrh.sb.TestRemoteEjbBean - RemoteException when getting BrickFacade. Message:Invalid URL or IOR: corbaloc:iiop://161.90.176.213:3700
javax.naming.ConfigurationException: Invalid URL or IOR: corbaloc:iiop://161.90.176.213:3700 [Root exception is org.omg.CORBA.BAD_PARAM: vmcid: SUN minor code: 603 completed: No]
at com.sun.jndi.cosnaming.CNCtx.setOrbAndRootContext(CNCtx.java:367)
at com.sun.jndi.cosnaming.CNCtx.initUsingCorbanameUrl(CNCtx.java:321)
at com.sun.jndi.cosnaming.CNCtx.initUsingUrl(CNCtx.java:247)
at com.sun.jndi.cosnaming.CNCtx.createUsingURL(CNCtx.java:85)
at com.sun.jndi.url.iiop.iiopURLContextFactory.getUsingURLIgnoreRest(iiopURLContextFactory.java:56)
at com.sun.jndi.url.iiop.iiopURLContext.getRootURLContext(iiopURLContext.java:44)
at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:182)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:702)
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:108)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at de.emilberlinerstudios.va.ejb.testrh.sb.TestRemoteEjbBean.getBrickFacade(TestRemoteEjbBean.java:108)
at de.emilberlinerstudios.va.ejb.testrh.sb.TestRemoteEjbBean.startTest(TestRemoteEjbBean.java:79)
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.startTest(Unknown Source)
at de.emilberlinerstudios.va.ejb.testrh.sb._TestRemoteEjb_Stub.startTest(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.forte4j.j2ee.ejbtest.webtest.InvocableMethod$MethodIM.invoke(InvocableMethod.java:231)
at com.sun.forte4j.j2ee.ejbtest.webtest.EjbInvoker.getInvocationResults(EjbInvoker.java:96)
at com.sun.forte4j.j2ee.ejbtest.webtest.DispatchHelper.getForward(DispatchHelper.java:189)
at org.apache.jsp.dispatch_jsp._jspService(dispatch_jsp.java:75)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:102)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:282)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:263)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:210)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
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 org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:246)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:268)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:236)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:141)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:214)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:168)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:144)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:133)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:539)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
at com.sun.enterprise.webservice.EjbWebServiceValve.invoke(EjbWebServiceValve.java:134)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
at com.sun.enterprise.security.web.SingleSignOn.invoke(SingleSignOn.java:272)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
at com.sun.enterprise.web.VirtualServerValve.invoke(VirtualServerValve.java:209)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:114)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
at com.sun.enterprise.web.VirtualServerMappingValve.invoke(VirtualServerMappingValve.java:166)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:936)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:165)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:683)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:604)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:542)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:647)
at java.lang.Thread.run(Thread.java:534)
Caused by: org.omg.CORBA.BAD_PARAM: vmcid: SUN minor code: 603 completed: No
at com.sun.corba.ee.impl.logging.NamingSystemException.insBadAddress(NamingSystemException.java:148)
at com.sun.corba.ee.impl.logging.NamingSystemException.insBadAddress(NamingSystemException.java:166)
at com.sun.corba.ee.impl.naming.namingutil.CorbalocURL.badAddress(CorbalocURL.java:104)
at com.sun.corba.ee.impl.naming.namingutil.CorbalocURL.handleColon(CorbalocURL.java:140)
at com.sun.corba.ee.impl.naming.namingutil.CorbalocURL.handleIIOPColon(CorbalocURL.java:115)
at com.sun.corba.ee.impl.naming.namingutil.CorbalocURL.<init>(CorbalocURL.java:67)
at com.sun.corba.ee.impl.naming.namingutil.INSURLHandler.parseURL(INSURLHandler.java:41)
at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.operate(INSURLOperationImpl.java:103)
at com.sun.corba.ee.impl.orb.ORBImpl.string_to_object(ORBImpl.java:774)
at com.sun.jndi.cosnaming.CNCtx.setOrbAndRootContext(CNCtx.j|#]Problem solved:
configuration in jndi-name was wrong:
<jndi-name>corbaname:iiop:161.90.176.213:3700#ejb/BrickFacade</jndi-name> -
How to get stateful and stateless session bean in second jsp
I create stateful session bean in the first jsp, then how can I get the stateful session bean in the second jsp? I find that somebody store the bean in HttpSession.
If I store the stateful session bean in HttpSession, then I can get it in the second jsp. My problem is that I can store the stateless session bean in HttpSession, and get it in the second jsp. Then, both stateful and stateless can maintain the state in the second jsp. What is the difference between stateful and stateless session bean in this case ?
I understand the definition of stateful and stateless session bean, but I'm confuse how to use session bean. Can anyone provide sample jsp to show difference of stateful and stateless? How the stateful session bean can maintain the state for the client?Greetings,
I create stateful session bean in the first jsp, then how can I get the stateful session bean in the
second jsp? I find that somebody store the bean in HttpSession.Which is the correct scope for sharing client-specific data when 'request' scope is insufficient.
If I store the stateful session bean in HttpSession, then I can get it in the second jsp. My problem is
that I can store the stateless session bean in HttpSession, and get it in the second jsp. Then, bothWhy is that a "problem"? Does your application not require the stateless bean to be shared? If so, then don't store the EJBObject reference in the session...
stateful and stateless can maintain the state in the second jsp. What is the difference betweenWhat do you mean by this exactly?..
stateful and stateless session bean in this case ?Statefulness of session beans is in regard to maintaining client state (er, in all cases). If your "stateless" bean is receiving information from the client (i.e. its caller) - either through a create method or a business method - and that information is available (retrievable from the bean) on subsequent method calls, then that bean is, in fact, stateful - regardless of how it is deployed.
I understand the definition of stateful and stateless session bean, but I'm confuse how to use
session bean.The correct question, it here seems, is "when" to use which type... Use a "stateful" bean when information about (from) the client (i.e. the caller) must be maintained across method calls of the bean. Use a "stateless" bean for general business methods that do not depend on "prior knowledge" of the client (i.e. the caller).
Can anyone provide sample jsp to show difference of stateful and stateless? How the statefulA "sample JSP" would yield nothing additional... The semantics of calling, using, and "persisting", bean references are always the same - regardless of type or class. However, the reason(s) for using one over the other depends entirely on the needs of your application.
session bean can maintain the state for the client?I recommend that you spend more time learning about EJBs generally. In particular, it seems you require more fundamental understanding of their scope and lifecycle. Refer to sections 4, 6, and 7 of the EJB 2.0 Specification.
Regards,
Tony "Vee Schade" Cook -
Do JNDI look up for entity beans from a session bean in different jars
I have a problem doing entity beans JNDI look up from a session bean which is deployed
as a separate package (session.jar) from the entity beans (entity.jar)
I believe if both session bean and entity beans are deployed into one jar and
I specify ejb-local-reference-description for session bean, it should work. However,
due to some reason, they have to be in separated packages but still in the same
container. Then question how to do JNDI lookup given entity beans only have local
interfaces?
FYI.
1 both session.jar and entity.jar are self-contained. i.e., no deployment error.
each JNDI name can be viewed from JNDI tree
2. weblogic-ejb-jar.xml for session.jar
<weblogic-ejb-jar>
<description><![CDATA[Generated by XDoclet]]></description>
<weblogic-enterprise-bean>
<ejb-name>PetstoreLogic</ejb-name>
<stateless-session-descriptor>
</stateless-session-descriptor>
<reference-descriptor>
</reference-descriptor>
<jndi-name>PetstoreLogic</jndi-name>
<local-jndi-name>PetstoreLogicLocal</local-jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
3. weblogic-ejb-jar.xml (code snip) for entity.jar
<weblogic-enterprise-bean>
<ejb-name>Account</ejb-name>
<entity-descriptor>
<persistence>
<persistence-type>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
<type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
</persistence-type>
<persistence-use>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
</persistence-use>
</persistence>
</entity-descriptor>
<reference-descriptor>
</reference-descriptor>
<local-jndi-name>net.sourceforge.cpetstore/AccountLocalHome</local-jndi-name>
</weblogic-enterprise-bean>
4. if I do
accountLocalHome = (AccountLocalHome) ic.lookup("net/sourceforge/cpetstore/AccountLocalHome");
get error like:
javax.naming.LinkException: . Root exception is javax.naming.NameNotFoundException:
While trying to look up /app/ejb/net.sourceforge.cpetstore-entity.jar#Account/local-home
in /app/ejb/cpetstore-ejb.jar#PetstoreLogic.; remaining name '/app/ejb/net/sourceforge/cpetstore-entity/jar#Account/local-home'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:869)
at weblogic.jndi.internal.ApplicationNamingNode.lookup(ApplicationNamingNode.java:150)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:338)In weblogic-ejb-jar.xml use jndi-name instead of local-jndi-name in reference-descriptor
element.
"Qiming He" <[email protected]> wrote:
>
I have a problem doing entity beans JNDI look up from a session bean
which is deployed
as a separate package (session.jar) from the entity beans (entity.jar)
I believe if both session bean and entity beans are deployed into one
jar and
I specify ejb-local-reference-description for session bean, it should
work. However,
due to some reason, they have to be in separated packages but still in
the same
container. Then question how to do JNDI lookup given entity beans only
have local
interfaces?
FYI.
1 both session.jar and entity.jar are self-contained. i.e., no deployment
error.
each JNDI name can be viewed from JNDI tree
2. weblogic-ejb-jar.xml for session.jar
<weblogic-ejb-jar>
<description><![CDATA[Generated by XDoclet]]></description>
<weblogic-enterprise-bean>
<ejb-name>PetstoreLogic</ejb-name>
<stateless-session-descriptor>
</stateless-session-descriptor>
<reference-descriptor>
</reference-descriptor>
<jndi-name>PetstoreLogic</jndi-name>
<local-jndi-name>PetstoreLogicLocal</local-jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
3. weblogic-ejb-jar.xml (code snip) for entity.jar
<weblogic-enterprise-bean>
<ejb-name>Account</ejb-name>
<entity-descriptor>
<persistence>
<persistence-type>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
<type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
</persistence-type>
<persistence-use>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
</persistence-use>
</persistence>
</entity-descriptor>
<reference-descriptor>
</reference-descriptor>
<local-jndi-name>net.sourceforge.cpetstore/AccountLocalHome</local-jndi-name>
</weblogic-enterprise-bean>
4. if I do
accountLocalHome = (AccountLocalHome) ic.lookup("net/sourceforge/cpetstore/AccountLocalHome");
get error like:
javax.naming.LinkException: . Root exception is javax.naming.NameNotFoundException:
While trying to look up /app/ejb/net.sourceforge.cpetstore-entity.jar#Account/local-home
in /app/ejb/cpetstore-ejb.jar#PetstoreLogic.; remaining name '/app/ejb/net/sourceforge/cpetstore-entity/jar#Account/local-home'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:869)
at weblogic.jndi.internal.ApplicationNamingNode.lookup(ApplicationNamingNode.java:150)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:338) -
Error while calling a Web Service from a Session Bean
I am trying to call a Web Service from a Session Bean using an Axis client, but I am getting the next exception:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: org/apache/axis/client/Service
at com.sun.corba.ee.internal.javax.rmi.CORBA.Util.wrapException(Util.java:364)
at javax.rmi.CORBA.Util.wrapException(Util.java:277)
at com.ing.mx.seguros.siniestros.litigios.ejb._SisaServiceRemote_Stub.invocarWebSericeProveedorLegal(Unknown Source)
at com.ing.mx.seguros.siniestros.litigios.proxy.SisaWsProxy.solicitarApoyoLegal(SisaWsProxy.java:132)
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 org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:402)
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:309)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:333)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:481)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:323)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:854)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:158)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:850)Thanks for any help provided.
Does any one have insights about it?Hi Swapna,
from your screenshot it seems that you actually try to call the service in your Data Source Expression field. You should set path to the WSDL file here actually - this could be either URL to SAP or to filesystem, as Anton suggested (this could be faster). Have you created endpoint binding for your service in transaction SOAMANAGER? If yes, then simply download the corresponding WSDL with binding or copy the URL which leads to it. But also test whether you are able to retrieve the WSDL without logging into SAP (close all browser windows and then open a new one otherwise session ID from other browser windows can be reused).
If you have to give username and password, then setup anonymous alias in transaction SICF, for example.
Pleas, check my previous post on the same subject here: Re: BCM7 IVR : SOAP request for client identification in CRM .
Maybe it could help.
Regards,
Dawood. -
How create EJB 2.1 Stateful Session Bean in a EJB 3.0 Session Bean
Hi All,
We have been developing on EJB 2.1. We are now adding a module on EJB 3.0.
How can we "create" a stateful session bean with create method signature similar to create(String id)?
We have tried
// this is the remote interface
@EJB AddressBean abean;
But not working
Any help will be appreciated.There is no explicit create() call for EJB 3.0 session beans. It doesn't really matter though
since you can accomplish the same thing by defining your own business method to act
as an initializer for whatever state you'd like. E.g.
@Remote
public interface FooInterface {
public void initialize(String id);
// ... other business methods
@EJB FooInterface fooRef;
fooRef.initialize("foo");
--ken -
Problems accessing fields in a CMP entity bean from a session bean
Hello everybody,
I'm getting the next problem: when I try to access a field in a CMP entity bean that I have instantiated from a session bean (trhoug entitybean.getNameOfField), I get the error "the entity bean does not exist in the database".
This entity bean is accessing a table in an external database (not the DB of the WAS), but I know that it's getting the correct data from the table, since I check the entitybean.size() and the entitybean.findByPrimaryKey(), and I get the right information. For some reason, the only thing that it doesn't work in the entity bean are the getter/setter methods (I created them automatically after having created the entity fields).
I access the entity bean through its local interface...
I know it's really difficult to give an answer with so few details, but... does anybody think I forgot something important to configure??
Thank very much in advance!!
Isidrogetter and setter methods for cmp-fields are abstract.
getter and setter methods for cmr-fields are abstract.
"John Lee" <[email protected]> wrote:
>
Hi:
Which method in a CMP Entity bean should be abstract? just only SetXXX
and
GetXXX?
Thanks!
John Lee -
How to avoid Invalidation of Stateful Session Bean in case of an Exception?
Hi developers,
I'm working on a project using JSF, Toplink and EJB 3.0 using JDev.
I'm using a statefull session bean that is stored in the session but when an exception occurs in a business method in the stateful bean the bean crashed and can never be reused and returns the following trace :
06/06/05 10:19:12 java.rmi.NoSuchObjectException: Session has timed out or was invalidated
06/06/05 10:19:12 at com.evermind.server.ejb.StatefulSessionEJBObject.throwPassivisationException(StatefulSessionEJBObject.java:335)
06/06/05 10:19:12 at com.evermind.server.ejb.StatefulSessionEJBObject.OC4J_transactionPreExecute(StatefulSessionEJBObject.java:717)
06/06/05 10:19:12 at com.evermind.server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:51)
06/06/05 10:19:12 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
06/06/05 10:19:12 at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
06/06/05 10:19:12 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
06/06/05 10:19:12 at com.evermind.server.ejb.StatefulSessionEJBObject.OC4J_invokeMethod(StatefulSessionEJBObject.java:840)
06/06/05 10:19:12 at PriseChargePS_StatefulSessionBeanWrapper21.trouverAssure(PriseChargePS_StatefulSessionBeanWrapper21.java:1747)
06/06/05 10:19:12 at Pensions.Traitements.AssureTraitement.donnerAssure(AssureTraitement.java:130)
06/06/05 10:19:12 at Pensions.view.backing.priseCharge.PriseCharge.chercherAssure_action(PriseCharge.java:189)
06/06/05 10:19:12 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
06/06/05 10:19:12 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
06/06/05 10:19:12 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
06/06/05 10:19:12 at java.lang.reflect.Method.invoke(Method.java:585)
06/06/05 10:19:12 at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
06/06/05 10:19:12 at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
06/06/05 10:19:12 at javax.faces.component.UICommand.broadcast(UICommand.java:312)
06/06/05 10:19:12 at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
06/06/05 10:19:12 at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)
06/06/05 10:19:12 at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
06/06/05 10:19:12 at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
06/06/05 10:19:12 at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
06/06/05 10:19:12 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
06/06/05 10:19:12 at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
06/06/05 10:19:12 at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:367)
06/06/05 10:19:12 at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:336)
06/06/05 10:19:12 at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:196)
06/06/05 10:19:12 at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:87)
06/06/05 10:19:12 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:629)
06/06/05 10:19:12 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
06/06/05 10:19:12 at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
06/06/05 10:19:12 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
06/06/05 10:19:12 at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218)
06/06/05 10:19:12 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:119)
06/06/05 10:19:12 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
06/06/05 10:19:12 at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
06/06/05 10:19:12 at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230)
06/06/05 10:19:12 at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33)
06/06/05 10:19:12 at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831)
06/06/05 10:19:12 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
Please help !Your question is not how to create/compile a stateless session bean, you are asking how to use those weblogic specific annotations. A weblogic forum is a better place to ask that.
-
Parsing XML from a session bean
Hi,
I am trying to use a Sax parser for parsing xml received from a back end
legacy system. The code is executed from a Session bean.
Debugging learned me that the parse() method on the parser hangs the
container without any error or exception trace. The code works fine outside
a container.
All help will be highly appreciated.
KurtI found out that the InputStream implementation used parsing source inside
the container is different
then from the one outside (other type of VM of course!). The Weblogic
implementation blocks at the end of
the stream, while the normal SUN JDK 1.3 returns. This is not a bug, the bug
I found is in my proxy that allows
the connection to the backend. This proxy allows HTTP connections, and I
parse the XML received over HTTP.
Regards,
Kurt
"Todd Karakashian" <[email protected]> wrote in message
news:[email protected]..
That's seems odd. Perhaps there is something going on in your document
handler code that triggers a hang in the environment of the server.
When you see the hang, instruct the VM to give you a thread dump (type
control-<break> on Windows, <control>-\ (backslash) on UNIX in the
window in which the server is running; the results are dumped to
stderr). That will show what every thread in the server is doing. If you
email or post the thread dump, I will take a look at it and see if I can
see what is going on. Also, let us know which platform, VM, parser, and
WebLogic version you are using.
Regards,
-Todd
Kurt Quirijnen wrote:
Hi,
I am trying to use a Sax parser for parsing xml received from a back end
legacy system. The code is executed from a Session bean.
Debugging learned me that the parse() method on the parser hangs the
container without any error or exception trace. The code works fine
outside
a container.
All help will be highly appreciated.
Kurt--
Todd Karakashian
BEA Systems, Inc.
[email protected] -
Web Service from stateful Session Bean deleted after server restart
Hi,
i created a stateful session bean and from this a web service.
I am able to deploy it and it works really fine.
My problem is: after a server restart the web service is gone and i
have to deploy it again.
I have some other web services (but these are web services from stateless session beans)
but they "survive" the server restart.
I don't want to deploy the web service after every server restart, did I forget something or
is it a general problem of stateful session beans or web services?
Thanks in advance
JensHello Björn,
I am not quite sure what your problem is but did you have a look at these articles:
http://help.sap.com/saphelp_nw04/helpdata/en/4d/993441c73cef23e10000000a155106/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/be/2e2c4142aef623e10000000a155106/frameset.htm
I hope they can give you some idea.
Regads
Vyara -
Calling an RPG (AS400) program from a Session Bean
Hi, does anyone know if there is a kind of connector that makes possbile to call an RPG program in an AS400 host from a session bean, allowing the application server (i.e. : JBoss or WAS or WLB) to maintain the transaction ?
Thanks,
Klaus Koenig
ItalyYes, it is called "AS/400 Toolbox for Java".
-
Error when returning Vector from EJB Session Bean
I am testing the EJB functionality within JDeveloper(9.0.3). I simply expanded on the tutorial that is in the documentation (departments and employees). I created a method in the stateless session bean that retrieves a Collection of employees for a department, then converts it to a Vector. When I try to return the Vector from the session bean to a sample client, I get an error indicating that the Object is NOT serializable. I know that Vector IS serializable. Why do I get this error? (The error displays on the client message log, NOT the OC4J message log). I tried dumping the Vector to System.out.println - this works fine, so I l know I'm getting data.
Here is the stack trace and errors that display:
com.evermind.server.rmi.OrionRemoteException: Error (de-)serializing object: EmployeeLocal_EntityBeanWrapper4
java.lang.Object com.evermind.server.ejb.EJBUtils.cloneSerialize(java.lang.Object, com.evermind.server.ejb.AbstractEJBHome)
EJBUtils.java:404
java.lang.Object com.evermind.server.ejb.EJBUtils.cloneObject(java.lang.Object, com.evermind.server.ejb.AbstractEJBHome)
EJBUtils.java:377
java.lang.Object com.evermind.server.ejb.EJBUtils.cloneOneObjectInstance(java.lang.Object, com.evermind.server.ejb.AbstractEJBHome)
EJBUtils.java:419
java.lang.Object com.evermind.server.ejb.EJBUtils.cloneArrayList(java.util.ArrayList, com.evermind.server.ejb.AbstractEJBHome)
EJBUtils.java:599
java.lang.Object com.evermind.server.ejb.EJBUtils.cloneObject(java.lang.Object, com.evermind.server.ejb.AbstractEJBHome)
EJBUtils.java:357
java.util.Collection hrApp_StatelessSessionBeanWrapper2.getEmployeesByDepartment(java.lang.Long)
hrApp_StatelessSessionBeanWrapper2.java:323
java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[])
native code
void com.evermind.server.rmi.RMICallHandler.run(java.lang.Thread)
RMICallHandler.java:119
void com.evermind.server.rmi.RMICallHandler.run()
RMICallHandler.java:48
void EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run()
PooledExecutor.java:803
void java.lang.Thread.run()
Thread.java:484
at connection to localhost/127.0.0.1 as admin
void com.evermind.server.rmi.RMIConnection.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(java.lang.Throwable)
RMIConnection.java:1558
java.lang.Object com.evermind.server.rmi.RMIConnection.invokeMethod(com.evermind.server.rmi.RMIContext, long, long, java.lang.reflect.Method, java.lang.Object[])
RMIConnection.java:1511
java.lang.Object com.evermind.server.rmi.RemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
RemoteInvocationHandler.java:53
java.lang.Object com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
RecoverableRemoteInvocationHandler.java:22
java.lang.Object com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
StatelessSessionRemoteInvocationHandler.java:50
java.util.Collection __Proxy1.getEmployeesByDepartment(java.lang.Long)
javax.swing.table.DefaultTableModel hr.hrAppClientFrame.getTableModel()
hrAppClientFrame.java:150
void hr.hrAppClientFrame.jbInit()
hrAppClientFrame.java:122
void hr.hrAppClientFrame.<init>()
hrAppClientFrame.java:58
void hr.hrAppClientFrame.main(java.lang.String[])
hrAppClientFrame.java:141
Nested exception is:
java.io.NotSerializableException: EmployeeLocal_EntityBeanWrapper4
void java.io.ObjectOutputStream.outputObject(java.lang.Object)
ObjectOutputStream.java:1148
void java.io.ObjectOutputStream.writeObject(java.lang.Object)
ObjectOutputStream.java:366
java.lang.Object com.evermind.server.ejb.EJBUtils.cloneSerialize(java.lang.Object, com.evermind.server.ejb.AbstractEJBHome)
EJBUtils.java:390
java.lang.Object com.evermind.server.ejb.EJBUtils.cloneObject(java.lang.Object, com.evermind.server.ejb.AbstractEJBHome)
EJBUtils.java:377
java.lang.Object com.evermind.server.ejb.EJBUtils.cloneOneObjectInstance(java.lang.Object, com.evermind.server.ejb.AbstractEJBHome)
EJBUtils.java:419
java.lang.Object com.evermind.server.ejb.EJBUtils.cloneArrayList(java.util.ArrayList, com.evermind.server.ejb.AbstractEJBHome)
EJBUtils.java:599
java.lang.Object com.evermind.server.ejb.EJBUtils.cloneObject(java.lang.Object, com.evermind.server.ejb.AbstractEJBHome)
EJBUtils.java:357
java.util.Collection hrApp_StatelessSessionBeanWrapper2.getEmployeesByDepartment(java.lang.Long)
hrApp_StatelessSessionBeanWrapper2.java:323
java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[])
native code
void com.evermind.server.rmi.RMICallHandler.run(java.lang.Thread)
RMICallHandler.java:119
void com.evermind.server.rmi.RMICallHandler.run()
RMICallHandler.java:48
void EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run()
PooledExecutor.java:803
void java.lang.Thread.run()
Thread.java:484
at connection to localhost/127.0.0.1
void com.evermind.server.rmi.OrionRemoteException.receive(java.net.InetAddress, java.lang.String)
OrionRemoteException.java:130
void com.evermind.server.rmi.RMIConnection.handleMethodInvocationResponse()
RMIConnection.java:1673
void com.evermind.server.rmi.RMIConnection.run(java.lang.Thread)
RMIConnection.java:532
void com.evermind.server.rmi.RMIConnection.run()
RMIConnection.java:275
void EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run()
PooledExecutor.java:797
void java.lang.Thread.run()
Thread.java:484
Any ideas?
ThanksI would suggest opening a case with [email protected] FWIW, I recall seeing
something like this in WLS 6.0. I believe it is fixed in WLS 6.1
-- Rob
Chris Dupuy wrote:
> Btw, this occurs when I create an stateful session bean that ends up
> throwing an exception and setRollbackOnly() is called. From that point
> forward, my logs fill with this message.
>
> Chris
>
> "Chris Dupuy" <[email protected]> wrote in message
> news:[email protected]..
> > anyone know what this means, and what you can do about it?
> >
> >
> > <Error> <ConnectionManager> <atossd03> <cbeyondServer> <ExecuteThread:
> '14'
> > for queue: 'd
> > efault'> <> <> <000000> <Closing:
> 'weblogic.rjvm.t3.T3JVMConnection@488831'
> > because of: 'Server received a message over an uniniti
> > alized connection: 'JVMMessage from: 'null' to:
> >
> '5825313123619479267S:10.6.6.40:[8000,8000,8001,8001,8000,8001,-1]:cbeyond:c
> > beyond
> > Server' cmd: 'CMD_REQUEST', QOS: '101', responseId: '2', invokableId: '1',
> > flags: 'JVMIDs Not Sent, TX Context Not Sent', abbrev o
> > ffset: '204'''>
> >
> >
> >
-
How to achieve Entity Bean methods ONLY by calling them from a Session Bean
Hi,
I used a session bean as a business facade to a entity bean.
In the session bean I achieve the entity bean with a jndiContext.lookup("java:comp/env/ejbEntityBean").
Now I am looking for a solution that it is only possible to call the entity bean methods or the whole entity bean from the corresponding session bean.
In other words: "How can I forbid the access to the entity bean, if the calling object is not the corresponding session bean?"
--->
I only found a way the regulate the access to the entity bean methods by declaring a security-role.
But the existence of the security-role at runtime depends on the calling user-authorizations!
Is there a way to set the entity-security-role within the session bean context?
Best Regards
SteffenHi Srikanth Reddy.T,
sorry, I am not looking for a special tag <entity-security-role>.
I am looking for a way to specifiy that my session bean "has" the special security-role (in my case "WebZaehlerEjbRole") of my entity bean "in my case "WebZaehlerEjbRole") that is necessary to call the methods (findAlleEntries, findByWindowId,...) of my entity-bean.
Here is the relevant part of my ejb-jar.ml:
<assembly-descriptor>
<security-role>
<role-name>WebZaehlerEjbRole</role-name>
</security-role>
<method-permission>
<description>method-permission</description>
<role-name>WebZaehlerEjbRole</role-name>
<method>
<ejb-name>WebZaehlerBean</ejb-name>
<method-name>findAllEntries</method-name>
<method-params/>
</method>
<method>
<ejb-name>WebZaehlerBean</ejb-name>
<method-name>findByWindowId</method-name>
<method-params>
<method-param>java.lang.Long</method-param>
</method-params>
</method>
Regards,
Steffen
Maybe you are looking for
-
IPhone calendars not showing up in icloud
My iphone calendars are not showing up in iCloud. All of my calendar data is on my iPhone. I have turned on iCloud on my phone and checked "Calendar." I am using the same Apple ID on my phone as I am using for iCloud. I can see how to add calendar
-
Which RoboHelp 7 files need to be translated?
I have been transferred to a different division in my company and I am now responsible for the Online help that is created using Robohelp 7. I am completely new to Robohelp and what little I know I learned through a tutorial that I found. I have just
-
Everytime I click on something or am typing there is at least an 8 second delay!! It's aweful....
-
Special Pricing will not sync!
Hi all, We are trying to setup webtools pl1, and when we do the initial sync we get the following error - u201CThere are less special price records in WT than in B1. This can be due to an error in synch and can cause pricing inconsistencies.u201D I'v
-
Gracias por este espacio de cuestiones. aqui tratare de explicar mejor mi pregunta. adquiri un macBook Pro. supuestamente lo primero era descargar la version mavericks, y eso fue lo que hice, en mi sistema aparece que tengo la version OX 10.9.2 . (ES