javax.naming.NameNotFoundException: xas not bound


EJB programming & troubleshooting: javax.naming.NameNotFoundException: xas not bound

  1. Hi, Can someone give an advise or idea on how to solve this problem. I already faced this problem since 3 weeks and could not find any solution. Here is error that i got: 11:57:58,790 ERROR [LoginBean] ADM-LoginBean-[ejbCreate]-Exception in CreateException javax.naming.NameNotFoundException: XAS not bound at org.jnp.server.NamingServer.getBinding( at org.jnp.server.NamingServer.getBinding( at org.jnp.server.NamingServer.getObject( at org.jnp.server.NamingServer.lookup( at org.jnp.server.NamingServer.lookup( at org.jnp.interfaces.NamingContext.lookup( at org.jnp.interfaces.NamingContext.lookup( at org.jnp.interfaces.NamingContext.lookup( at javax.naming.InitialContext.lookup( at com.xybase.xas.helper.DataSourceFactory.getDataSource( at com.xybase.xas.xadm.ejb.LoginBean.ejbCreate( at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke( at sun.reflect.DelegatingMethodAccessorImpl.invoke( at java.lang.reflect.Method.invoke( at org.jboss.ejb.StatelessSessionEnterpriseContext.( at org.jboss.ejb.plugins.StatelessSessionInstancePool.create( at org.jboss.ejb.plugins.AbstractInstancePool.get( at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invokeHome( at org.jboss.ejb.plugins.CallValidationInterceptor.invokeHome( at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext( As what I understand, there is problem when program to getconnection to database at this line: public static DataSource getDataSource(String jndiName) throws NamingException { DataSourceFactory instance = getInstance(); DataSource ds = (DataSource) instance.cache.get(jndiName); if (ds == null) { ds = (DataSource) ctx.lookup(jndiName); instance.cache.put(jndiName, ds); } return ds; } could anyone help me on this.
  2. Reply[ Go to top ]

    Is the "XAS" datasource defined and bound ? (check server startup logs if you already defined the datasource there should be some logs indicating it was bound ) Is the JNDI name - "XAS" correct ? If datasource is defined in resource reference of ejb, try accessing it as "java:comp/env/jdbc/XAS" provided the reference is named jdbc/XAS.
  3. XAS not bound[ Go to top ]

    Regarding on your first statement, I try to paste log here. How can I put the resource reference in EJB? Because currently I didn't put any resource reference in EJB. Using the jboss.xml or web.xml? Additional info, this is a web based application. Before this its running on Oracle Application Server and now I try to migrate to JBOSS AS. Here is from the log file: 08:51:59,813 INFO [QuartzResourceAdapter] start quartz!!! 08:51:59,917 INFO [SimpleThreadPool] Job execution threads will use class loader of thread: main 08:51:59,991 INFO [QuartzScheduler] Quartz Scheduler v.1.5.2 created. 08:51:59,995 INFO [RAMJobStore] RAMJobStore initialized. 08:51:59,995 INFO [StdSchedulerFactory] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: '' 08:51:59,995 INFO [StdSchedulerFactory] Quartz scheduler version: 1.5.2 08:51:59,995 INFO [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started. 08:52:00,271 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA' 08:52:00,477 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=OracleDS' to JNDI name 'java:OracleDS' 08:52:08,879 INFO [A] Bound to JNDI name: queue/A 08:52:08,884 INFO [B] Bound to JNDI name: queue/B 08:52:08,889 INFO [C] Bound to JNDI name: queue/C 08:52:08,893 INFO [D] Bound to JNDI name: queue/D 08:52:08,897 INFO [ex] Bound to JNDI name: queue/ex 08:52:08,996 INFO [testTopic] Bound to JNDI name: topic/testTopic 08:52:09,001 INFO [securedTopic] Bound to JNDI name: topic/securedTopic 08:52:09,005 INFO [testDurableTopic] Bound to JNDI name: topic/testDurableTopic 08:52:09,010 INFO [testQueue] Bound to JNDI name: queue/testQueue 08:52:09,057 INFO [UILServerILService] JBossMQ UIL service available at : / 08:52:09,687 INFO [DLQ] Bound to JNDI name: queue/DLQ 08:52:10,444 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/ 08:52:10,883 INFO [EARDeployer] Init J2EE application: file:/apps/jboss-4.2.2.GA/server/default/deploy/xas.ear
  4. Here is content in oracle-ds.xml: OracleDS jdbc:oracle:thin:@localhost:1521:SID <!-- See on WIKI page below how to use Oracle's thin JDBC driver to connect with enterprise RAC. --> <!-- Here are a couple of the possible OCI configurations. For more information, see <connection-url>jdbc:oracle:oci:@youroracle-tns-name</connection-url> or <connection-url>jdbc:oracle:oci:@(description=(address=(host=youroraclehost)(protocol=tcp)(port=1521))(connect_data=(SERVICE_NAME=yourservicename)))</connection-url> Clearly, its better to have TNS set up properly. --> oracle.jdbc.driver.OracleDriver passwd passwd
  5. From the stack trace looks like 1. The application is using an Stateless Session Bean named LoginBean. 2. The application hence must be having both EJB and Web Component (as you have mentioned that it has a Web component as well) 3. You are looking up a datasource in the EJBCreate method of the LoginBean. 4. The only data source created on the server is OracleDS. Asssuming that OracleDS points to the desired database, you can add the following to the session bean declaration in your ejb-jar.xml ... jdbc/XAS javax.sql.DataSource Container ... (In that case you have to lookup java:comp/env/jdbc/XAS as Rajiv had pointed out) Next you have to point jdbc/XAS to OracleDS on Server, through the following entry in jboss.xml jdbc/XAS java:/OracleDS
  6. Thanks you very muchh.. You all helped me to solve this problem. Now I can bring up and connect to the db. Thanks to all..