-
1. Re: JDNI Lookup - Naming Not Found with JBOSS 4.2.2
jaikiran Apr 19, 2008 3:03 AM (in response to senthilrajan.nitt)Where are you doing this lookup from? Is it a standalone java client? If yes, then the java: namespace wont be available for the standalone client.
-
2. Re: JDNI Lookup - Naming Not Found with JBOSS 4.2.2
senthilrajan.nitt Apr 20, 2008 11:40 PM (in response to senthilrajan.nitt)Hi,
Thanks for your quick response.
I am doing lookup in my servlet and its being deployed on the JBOSS server.
Could you please help me on the same?
Thanks,
Senthil -
3. Re: JDNI Lookup - Naming Not Found with JBOSS 4.2.2
jaikiran Apr 21, 2008 1:45 AM (in response to senthilrajan.nitt)Please post the entire exception stacktrace, the code where you doing the lookup and also the JNDI tree contents. For displaying the contents of the jndi tree, read this http://wiki.jboss.org/wiki/en/DisplayTheJNDITreeWithTheJMXConsole.
While posting the logs or code or xml content, remember to wrap it in a code block using the Code button in the message editor window and please hit the Preview button to make sure your post is correctly formatted -
4. Re: JDNI Lookup - Naming Not Found with JBOSS 4.2.2
senthilrajan.nitt Apr 21, 2008 10:24 AM (in response to senthilrajan.nitt)Hi,
My JMX Console output for JNDI Service :
java: Namespace
+- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
+- DefaultDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
+- SecurityProxyFactory (class: org.jboss.security.SubjectSecurityProxyFactory)
+- OracleDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
+- DefaultJMSProvider (class: org.jboss.jms.jndi.JNDIProviderAdapter)
+- comp (class: javax.naming.Context)
+- JmsXA (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
+- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
+- jaas (class: javax.naming.Context)
| +- HsqlDbRealm (class: org.jboss.security.plugins.SecurityDomainContext)
| +- jbossmq (class: org.jboss.security.plugins.SecurityDomainContext)
| +- JmsXARealm (class: org.jboss.security.plugins.SecurityDomainContext)
+- comp.original (class: javax.namingMain.Context)
+- timedCacheFactory (class: javax.naming.Context)
Failed to lookup: timedCacheFactory, errmsg=org.jboss.util.TimedCachePolicy
+- TransactionPropagationContextExporter (class: com.arjuna.ats.internal.jbossatx.jta.PropagationContextManager)
+- StdJMSPool (class: org.jboss.jms.asf.StdServerSessionPoolFactory)
+- Mail (class: javax.mail.Session)
+- comp.ejb3 (class: javax.naming.Context)
| NonContext: null
+- TransactionPropagationContextImporter (class: com.arjuna.ats.internal.jbossatx.jta.PropagationContextManager)
+- TransactionManager (class: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate)
I am looking for the object as follows,public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { logger.info("SpringappController - returning hello view"); String now = (new java.util.Date()).toString(); logger.info("senthil:returning hello view with " + now); Connection con =null; try { Context ctx = new InitialContext(); Object ds = ctx.lookup("java:OracleDS"); System.out.println("Got the object : "+ds); //System.out.println("got the data source :"+ds.getClass()); // con = ds.getConnection(); if(con!=null){ System.out.println("Connected to saba5"); } } catch (NamingException e) { // TODO Auto-generated catch block //e.printStackTrace(); System.out.println(e.getMessage()); }finally{ if(con!=null){ try { con.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } Map myModel = new HashMap(); myModel.put("now", now); myModel.put("products", getProductManager().getProducts()); return new ModelAndView("hello", "model", myModel); }
The error that i am getting
19:36:34,031 ERROR [STDERR] javax.naming.NameNotFoundException: OracleDS not bound
19:36:34,031 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
19:36:34,031 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
19:36:34,031 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
19:36:34,031 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
19:36:34,031 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
19:36:34,031 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
19:36:34,046 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:351)
19:36:34,046 ERROR [STDERR] at com.pk.controller.SpringappController.handleRequest(SpringappController.java:55)
19:36:34,046 ERROR [STDERR] at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
19:36:34,046 ERROR [STDERR] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
19:36:34,046 ERROR [STDERR] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
19:36:34,046 ERROR [STDERR] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:523)
19:36:34,046 ERROR [STDERR] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:453)
19:36:34,046 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
19:36:34,046 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
19:36:34,046 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
19:36:34,046 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
19:36:34,046 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
19:36:34,046 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
19:36:34,046 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
19:36:34,046 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
19:36:34,046 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
19:36:34,046 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
19:36:34,046 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
19:36:34,046 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
19:36:34,046 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
19:36:34,046 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
19:36:34,046 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
19:36:34,046 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
19:36:34,046 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
19:36:34,046 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
19:36:34,046 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
19:36:34,046 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
Please give your suggestions.
Thanks,
Senthil -
5. Re: JDNI Lookup - Naming Not Found with JBOSS 4.2.2
jaikiran Apr 24, 2008 10:21 AM (in response to senthilrajan.nitt)Senthil,
Based on the JNDI tree contents and the the jndi-name you are using, i don't see a reason why it should throw a NameNotFoundException. How are you starting JBoss? Do you use the -b option (if yes, what value do you pass)? And is the servlet deployed on the same server as the datasource? -
6. Re: JDNI Lookup - Naming Not Found with JBOSS 4.2.2
senthilrajan.nitt Apr 27, 2008 6:58 AM (in response to senthilrajan.nitt)Thanks for your reply.
I also wondering why it didnt work.
To start the jboss server i am just running run.bat & not using any -b option.
Yep, the servlet is deployed on server as DS.
Let me try once again.
Thanks,
Senthil -
7. Re: JDNI Lookup - Naming Not Found with JBOSS 4.2.2
frankthetank Apr 28, 2008 3:28 AM (in response to senthilrajan.nitt)pls try
java:/OracleDS
That is the way I have it in the jta-data-source tag of my persistence.xml.