[jboss-user] [JBoss Portal] - Re: How can i access my own datasource in portlet jsp

GajananM do-not-reply at jboss.com
Thu Mar 26 01:37:00 EDT 2009


hi peter i really apperciate for your quick reply.


I am using JNDI lookup for data source in my jsp page
however i am getting NameNotFoundException.
below is my jsp page:

InitialContext ic = new InitialContext();
System.out.println("After initial context");
ds = (DataSource) ic.lookup("jdbc/mysql");

and my web.xml contains:
<resource-ref>
    jdbc/mysql
    <res-ref-name>jdbc/mysql</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>

stacktrace:
javax.naming.NameNotFoundException: jdbc not bound
10:58:10,718 ERROR [STDERR] 	at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
10:58:10,718 ERROR [STDERR] 	at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
10:58:10,718 ERROR [STDERR] 	at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
10:58:10,718 ERROR [STDERR] 	at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
10:58:10,718 ERROR [STDERR] 	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
10:58:10,718 ERROR [STDERR] 	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
10:58:10,718 ERROR [STDERR] 	at javax.naming.InitialContext.lookup(InitialContext.java:392)
10:58:10,718 ERROR [STDERR] 	at org.apache.jsp.jsp.Adventures_jsp._jspService(Adventures_jsp.java:83)
10:58:10,718 ERROR [STDERR] 	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
10:58:10,718 ERROR [STDERR] 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
10:58:10,718 ERROR [STDERR] 	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387)
10:58:10,718 ERROR [STDERR] 	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
10:58:10,718 ERROR [STDERR] 	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
10:58:10,718 ERROR [STDERR] 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
10:58:10,718 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
10:58:10,718 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
10:58:10,718 ERROR [STDERR] 	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
10:58:10,718 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
10:58:10,718 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
10:58:10,718 ERROR [STDERR] 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
10:58:10,718 ERROR [STDERR] 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
10:58:10,718 ERROR [STDERR] 	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
10:58:10,718 ERROR [STDERR] 	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
10:58:10,718 ERROR [STDERR] 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
10:58:10,718 ERROR [STDERR] 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
10:58:10,718 ERROR [STDERR] 	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
10:58:10,718 ERROR [STDERR] 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
10:58:10,718 ERROR [STDERR] 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
10:58:10,718 ERROR [STDERR] 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
10:58:10,718 ERROR [STDERR] 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
10:58:10,718 ERROR [STDERR] 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
10:58:10,718 ERROR [STDERR] 	at java.lang.Thread.run(Thread.java:619)

thanks in advance.

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4221153#4221153

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4221153



More information about the jboss-user mailing list