This discussion is archived
7 Replies Latest reply: Nov 17, 2012 1:26 AM by kdario RSS

javax.naming.NameNotFoundException

974460 Newbie
Currently Being Moderated
Hi All -

I did search through the forum for this answer for a bit before posting.

I have the javax.naming.NameNotFoundException when I attempt to run projects in the JDeveloper 11g suite.

The projects were originally created with 10g and still run fine there.

The connection is created and a Test Connection runs fine in both 10g and 11g suites.

We get the following error stack when at the very moment when I perform my first database/stored procedure call.


MY QUESTION: Does anyone have any suggestions on what type of misconfiguration this could be from, and what I might try to remedy it?

I am guessing it is an easy one click fix, but since I am new to JDeveloper as a whole I thought it wise to defer to more seasoned users.



javax.naming.NameNotFoundException: While trying to lookup 'jdbc.SCX' didn't find subcontext 'jdbc'. Resolved ''; remaining name 'jdbc/SCX'
     at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
     at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:247)
     at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)
     at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
     at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
     at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:411)
     at javax.naming.InitialContext.lookup(InitialContext.java:392)
     at oracle.wscx.dao.WSCXFormDAOFactory.getDataSource(WSCXFormDAOFactory.java:45)
     at oracle.wscx.dao.WSCXFormDAOFactory.getDatabaseConnection(WSCXFormDAOFactory.java:16)
     at oracle.wscx.dao.WSCXFormDAO.User_Login(WSCXFormDAO.java:46)
     at oracle.wscx.view.LoginAction.execute(LoginAction.java:43)
     at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
     at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
     at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
     at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
     at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
     at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
     at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
     at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
     at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
     at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
     at java.security.AccessController.doPrivileged(Native Method)
     at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
     at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
     at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
     at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
     at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
     at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
     at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
     at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
     at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
     at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
     at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
     at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
     at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
     at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
     at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
     at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
     at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
java.lang.NullPointerException
     at oracle.wscx.dao.WSCXFormDAOFactory.getDatabaseConnection(WSCXFormDAOFactory.java:17)
     at oracle.wscx.dao.WSCXFormDAO.User_Login(WSCXFormDAO.java:46)
     at oracle.wscx.view.LoginAction.execute(LoginAction.java:43)
     at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
     at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
     at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
     at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
     at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
     at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
     at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
     at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
     at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
     at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
     at java.security.AccessController.doPrivileged(Native Method)
     at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
     at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
     at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
     at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
     at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
     at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
     at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
     at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
     at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
     at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
     at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
     at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
     at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
     at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
     at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
     at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
     at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Invalid Login
java.lang.NullPointerException
     at oracle.wscx.dao.WSCXFormDAO.User_Login(WSCXFormDAO.java:56)
     at oracle.wscx.view.LoginAction.execute(LoginAction.java:43)
     at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
     at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
     at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
     at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
     at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
     at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
     at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
     at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
     at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
     at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
     at java.security.AccessController.doPrivileged(Native Method)
     at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
     at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
     at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
     at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
     at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
     at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
     at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
     at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
     at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
     at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
     at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
     at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
     at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
     at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
     at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
     at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
     at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
  • 1. Re: javax.naming.NameNotFoundException
    AlejandroProfet Journeyer
    Currently Being Moderated
    Hi,

    Have you created the data source in your local weblogic?
    If not, try to create it in the WLS Console (usually in this address: http://localhost:7101/console)
    This guide can help you: http://www.deltalounge.net/wpress/2011/02/create-data-source-in-weblogic-server/

    AP

    Edited by: Alejandro Profet on Nov 15, 2012 8:09 PM
  • 2. Re: javax.naming.NameNotFoundException
    974460 Newbie
    Currently Being Moderated
    So I followed these steps and created the datasource on my local weblogic server, but the error persists.

    Afterward - in Jdeveloper under Application Resources, I have removed the connection that I had created in my project before. Then I was hoping I could recreate it, with some option to choose the connection that I had made in the local WebLogic server, but that didn't seem available.

    Still scraping away at the problem...
  • 3. Re: javax.naming.NameNotFoundException
    kdario Expert
    Currently Being Moderated
    So, how you reference WLS data source in your application?
    "java:comp/env/jdbc/SCX" or "jdbc/SCX" ?

    Dario
  • 4. Re: javax.naming.NameNotFoundException
    974460 Newbie
    Currently Being Moderated
    ds = (DataSource)ctx.lookup("jdbc/SCX");


    Do you suggest changing it to the alternative you have posted?

    (I probably will have tried that before you get to reply)
  • 5. Re: javax.naming.NameNotFoundException
    kdario Expert
    Currently Being Moderated
    I don't think that WLS has "java:comp/env/" as default context so you probably need full jndi path("java:comp/env/jdbc/SCX")

    Dario
  • 6. Re: javax.naming.NameNotFoundException
    AlejandroProfet Journeyer
    Currently Being Moderated
    If you are using a connection created under Application Resources in JDeveloper, try to execute lookup with DS suffix and the prefix proposed by Dario:
    ds = (DataSource)ctx.lookup("java:comp/env/jdbc/SCXDS");
    You can also implement something like this in order to deal with both connection (WLS and JDeveloper):
    Context ctx = new InitialContext();
    DataSource ds;
    try {
      ds = (DataSource)ctx.lookup("jdbc/SCXDS");
    }
    catch (NamingException e) {
      ds = (DataSource)ctx.lookup("java:comp/env/jdbc/SCXDS");
    }
    AP

    Edited by: Alejandro Profet on Nov 17, 2012 12:58 AM
  • 7. Re: javax.naming.NameNotFoundException
    kdario Expert
    Currently Being Moderated
    Connection in application Application Resources is local(design time) connection.
    If you create application module, JDev will assign(by default) "DS" suffix to connection name, so matching DS name in WLS also need "DS" suffix.

    But, because you retrieve data source from your java code(manually) then I don't think that this is important.
    (if you set data source name in WLS to "jdbc/SCX" then you must reference this in your code as "jdbc/SCX")
    Some servers(like Tomcat) assign default prefix("java:comp/env/"), but in WLS you probably need to assign this manually.

    Dario.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points