Seems like such a generic error would have a root cause. Was there anything more to the stack trace?

--David

Ziggy O wrote:
Hi,

I am trying to connect to an oracle database but cant seem to get the jdbc
connection to work. I am developing the application on a Windows desktop and
transferring it onto a Unix box.

When i test it on the Windows environmnet it does manage to connect but if i
test it on unix then i get an error. My gut feeling is that the installation
on the unix environment is missing a library but i cant figure out what it
is.

Here is how i am trying to get the jndi connection.

[code]
String fullname;
        if (jndiPrefix != null && jndiPrefix.length() > 0)
            fullname = jndiPrefix + datasource;
        else
            fullname = datasource;

        // JNDI
        Context ctx = null;
        DataSource ds = null;
        Connection conn = null;

        try
        {
            ctx = new InitialContext();
            Context envContext  = (Context)ctx.lookup("java:/comp/env");
            if (ctx != null)
            {
                ds = (DataSource)envContext.lookup(fullname);
                if (ds != null)
                {
                    conn = ds.getConnection();
                }
            }
        }
[/code]

And here is the Configuration.

Context.xml (User and password modified)

[code]
  <Resource name="jdbc/theDb" auth="Container"
                      type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
                      url="jdbc:oracle:thin:@localhost:1521:webdev"
                      username="webuser" password="webuser" maxActive="20"
maxIdle="10"
                      maxWait="-1"/>
[/code]

web.xml

[code]
    <resource-ref>
     <description>Oracle Datasource</description>
     <res-ref-name>jdbc/theDb</res-ref-name>
     <res-type>oracle.jdbc.pool.OracleDataSource</res-type>
     <res-auth>Container</res-auth>
    </resource-ref>

[/code]

And here is the stack trace of the error

[code]
javax.naming.NamingException: Cannot create resource instance
        at
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:143)
        at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
        at
com.bt.ccs21.util.DbConnection.getJNDIConnection(DbConnection.java:334)
        at
com.bt.ccs21.util.DbConnection.getJNDIConnection(DbConnection.java:256)
        at
com.bt.ccs21.util.DbConnection.getJRunConnection(DbConnection.java:286)
        at
com.bt.ccs21.presentation.events.admin.LogonActionPost.preAction(LogonActionPost.java:118)
        at
com.bt.ccs21.presentation.events.CCS21EventAction.execute(CCS21EventAction.java:29)
        at
org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
        at
org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
        at
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
        at
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
        at
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
        at
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
        at
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
        at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
        at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
        at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
        at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
        at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
        at java.lang.Thread.run(Unknown Source)
"/tmp/crmsauth.log.20081001" 561 lines, 48080 characters
        at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
        at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
        at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
        at java.lang.Thread.run(Unknown Source)
[/code]

What i dont understand is why it works on the installation on the windows
environment but not in the Unix environment. I check all the libraries and
everything under common/lib is the same for both environments.

Thanks

Edited by: ziggy on Oct 1, 2008 3:48 PM

Edited by: ziggy on Oct 1, 2008 3:50 PM



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to