-
1. Re: Accessing JNDI in a Session bean ckient
jesper.pedersen Sep 4, 2012 8:57 AM (in response to bangau)- Use latest snapshot of AS7
- Use http://docs.jboss.org/ironjacamar/userguide/1.1/en-US/html/tools.html#tools_rarinfo to get a sample deployment descriptor
- Post stack traces
-
2. Re: Accessing JNDI in a Session bean ckient
bangau Sep 4, 2012 9:57 AM (in response to jesper.pedersen)Hi Jesper thanks for quick answer. In my session bean I want to read this jndi-name="java:/eis/IMSConnectionFactory" Here is the extension in standalone.xml. ims1211.rar XATransaction 19000 localhost IMS Connection 10 100 10 Here is my code InitialContext ctx = null; Properties env = new Properties(); IMSConnection c = null; IMSConnectionFactory cf= null; try { ctx = new InitialContext(env); cf = (IMSConnectionFactory)ctx.lookup("eis/IMSConnectionFactory"); c = (IMSConnection)cf.getConnection(); }catch(NamingException e) { e. }catch(Exception e){ e.print } Here is the stack trace 15:42:35,343 INFO [stdout] (EJB default - 1) Error javax.naming.NameNotFoundException: eis/IMSConnectionFactory -- service jboss.naming.context.java.eis.IMSConnectionFactory 15:42:35,343 ERROR [stderr] (EJB default - 1) javax.naming.NameNotFoundException: eis/IMSConnectionFactory -- service jboss.naming.context.java.eis.IMSConnectionFactory 15:42:35,343 ERROR [stderr] (EJB default - 1) at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97) 15:42:35,343 ERROR [stderr] (EJB default - 1) at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:177) 15:42:35,343 ERROR [stderr] (EJB default - 1) at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:113) 15:42:35,343 ERROR [stderr] (EJB default - 1) at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:213) 15:42:35,343 ERROR [stderr] (EJB default - 1) at javax.naming.InitialContext.lookup(Unknown Source) 15:42:35,343 ERROR [stderr] (EJB default - 1) at de.bundeswehr.wewis.bussineslogic.JCAClient.getJCA(JCAClient.java:64) 15:42:35,343 ERROR [stderr] (EJB default - 1) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 15:42:35,343 ERROR [stderr] (EJB default - 1) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 15:42:35,343 ERROR [stderr] (EJB default - 1) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 15:42:35,343 ERROR [stderr] (EJB default - 1) at java.lang.reflect.Method.invoke(Unknown Source) 15:42:35,343 ERROR [stderr] (EJB default - 1) at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72) 15:42:35,343 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) 15:42:35,359 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) 15:42:35,359 ERROR [stderr] (EJB default - 1) at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36) 15:42:35,359 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) 15:42:35,359 ERROR [stderr] (EJB default - 1) at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47) 15:42:35,359 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) 15:42:35,359 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21) 15:42:35,359 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) 15:42:35,359 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) 15:42:35,359 ERROR [stderr] (EJB default - 1) at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53) 15:42:35,359 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) 15:42:35,359 ERROR [stderr] (EJB default - 1) at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51) 15:42:35,359 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) 15:42:35,360 ERROR [stderr] (EJB default - 1) at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228) 15:42:35,360 ERROR [stderr] (EJB default - 1) at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304) 15:42:35,360 ERROR [stderr] (EJB default - 1) at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190) 15:42:35,360 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) 15:42:35,360 ERROR [stderr] (EJB default - 1) at org.jboss.as.ejb3.remote.EJBRemoteTransactionPropogatingInterceptor.processInvocation(EJBRemoteTransactionPropogatingInterceptor.java:80) 15:42:35,376 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) 15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) 15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) 15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) 15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) 15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) 15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) 15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) 15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) 15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) 15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) 15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.invokeMethod(MethodInvocationMessageHandler.java:300) 15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.access$200(MethodInvocationMessageHandler.java:64) 15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler$1.run(MethodInvocationMessageHandler.java:194) 15:42:35,392 ERROR [stderr] (EJB default - 1) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) 15:42:35,392 ERROR [stderr] (EJB default - 1) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) 15:42:35,392 ERROR [stderr] (EJB default - 1) at java.util.concurrent.FutureTask.run(Unknown Source) 15:42:35,392 ERROR [stderr] (EJB default - 1) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)15:42:35,408 ERROR [stderr] (EJB default - 1) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 15:42:35,408 ERROR [stderr] (EJB default - 1) at java.lang.Thread.run(Unknown Source) 15:42:35,408 ERROR [stderr] (EJB default - 1) at org.jboss.threads.JBossThread.run(JBossThread.java:122) I am already stuck with this problem since last week. TIA Richard
-
3. Re: Accessing JNDI in a Session bean ckient
bangau Sep 4, 2012 10:00 AM (in response to bangau)I am sorry the listing is terrible
<subsystem xmlns="urn:jboss:domain:resource-adapters:1.0"> <resource-adapters> <resource-adapter> <archive>ims1211.rar</archive> <transaction-support>XATransaction</transaction-support> <config-property name="Port">19000</config-property> <config-property name="Server">localhost</config-property> <connection-definitions> <connection-definition class-name="com.ibm.connector2.ims.ico.IMSConnectionnFactory" jndi-name="java:/eis/IMSConnectionFactory" enabled="true" use-java-context="true" pool-name="java:/eis/IMSConnectionFactory"> <config-property name="Name">IMS Connection</config-property> <xa-pool> <min-pool-size>10</min-pool-size> <max-pool-size>100</max-pool-size> </xa-pool> <security> <application/> </security> </connection-definition> </connection-definitions> <admin-objects> <admin-object class-name="com.ibm.connector2.ims.ico.IMSConnectionnFactory" jndi-name="java:/eis/AcmeAdminObject" pool-name="AcmeAdminObject"> <config-property name="Threshold"> 10 </config-property> </admin-object> </admin-objects> </resource-adapter> </resource-adapters> </subsystem> Here is source code
InitialContext ctx = null; Properties env = new Properties(); IMSConnection c = null; IMSConnectionFactory cf= null; try { ctx = new InitialContext(env); cf = (IMSConnectionFactory)ctx.lookup("eis/IMSConnectionFactory"); c = (IMSConnection)cf.getConnection(); }catch(NamingException e) { e. }catch(Exception e){ e.print } Here is my stactrace
15:42:35,343 INFO [stdout] (EJB default - 1) Error javax.naming.NameNotFoundException: eis/IMSConnectionFactory -- service jboss.naming.context.java.eis.IMSConnectionFactory
15:42:35,343 ERROR [stderr] (EJB default - 1) javax.naming.NameNotFoundException: eis/IMSConnectionFactory -- service jboss.naming.context.java.eis.IMSConnectionFactory
15:42:35,343 ERROR [stderr] (EJB default - 1) at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97)
15:42:35,343 ERROR [stderr] (EJB default - 1) at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:177)
15:42:35,343 ERROR [stderr] (EJB default - 1) at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:113)
15:42:35,343 ERROR [stderr] (EJB default - 1) at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:213)
15:42:35,343 ERROR [stderr] (EJB default - 1) at javax.naming.InitialContext.lookup(Unknown Source)
15:42:35,343 ERROR [stderr] (EJB default - 1) at de.bundeswehr.wewis.bussineslogic.JCAClient.getJCA(JCAClient.java:64)
15:42:35,343 ERROR [stderr] (EJB default - 1) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
15:42:35,343 ERROR [stderr] (EJB default - 1) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
15:42:35,343 ERROR [stderr] (EJB default - 1) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
15:42:35,343 ERROR [stderr] (EJB default - 1) at java.lang.reflect.Method.invoke(Unknown Source)
15:42:35,343 ERROR [stderr] (EJB default - 1) at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72)
15:42:35,343 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
15:42:35,359 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
15:42:35,359 ERROR [stderr] (EJB default - 1) at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36)
15:42:35,359 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
15:42:35,359 ERROR [stderr] (EJB default - 1) at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)
15:42:35,359 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
15:42:35,359 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
15:42:35,359 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
15:42:35,359 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
15:42:35,359 ERROR [stderr] (EJB default - 1) at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)
15:42:35,359 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
15:42:35,359 ERROR [stderr] (EJB default - 1) at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)
15:42:35,359 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
15:42:35,360 ERROR [stderr] (EJB default - 1) at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228)
15:42:35,360 ERROR [stderr] (EJB default - 1) at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304)
15:42:35,360 ERROR [stderr] (EJB default - 1) at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190)
15:42:35,360 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
15:42:35,360 ERROR [stderr] (EJB default - 1) at org.jboss.as.ejb3.remote.EJBRemoteTransactionPropogatingInterceptor.processInvocation(EJBRemoteTransactionPropogatingInterceptor.java:80)
15:42:35,376 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59)
15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)
15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.invokeMethod(MethodInvocationMessageHandler.java:300)
15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.access$200(MethodInvocationMessageHandler.java:64)
15:42:35,392 ERROR [stderr] (EJB default - 1) at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler$1.run(MethodInvocationMessageHandler.java:194)
15:42:35,392 ERROR [stderr] (EJB default - 1) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
15:42:35,392 ERROR [stderr] (EJB default - 1) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
15:42:35,392 ERROR [stderr] (EJB default - 1) at java.util.concurrent.FutureTask.run(Unknown Source)
15:42:35,392 ERROR [stderr] (EJB default - 1) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)15:42:35,408 ERROR [stderr] (EJB default - 1) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
15:42:35,408 ERROR [stderr] (EJB default - 1) at java.lang.Thread.run(Unknown Source)
15:42:35,408 ERROR [stderr] (EJB default - 1) at org.jboss.threads.JBossThread.run(JBossThread.java:122)
-
4. Re: Accessing JNDI in a Session bean ckient
gaol Nov 5, 2012 3:54 AM (in response to bangau)From what I see in your pasted text, you have bound the IMSConnectionnFactory with jndi name: java:/eis/IMSConnectionFactory , but you try to access it using jndi name: eis/IMSConnectionFactory . Besides, does your com.ibm.connector2.ims.ico.IMSConnectionnFactory implement the ManagedConnectionFactory?