Re: javax.naming.NamingException: Cannot create resource instance

2008-10-02 Thread Ziggy O
No mate that was the full stack trace.

Thanks


On Wed, Oct 1, 2008 at 7:02 PM, David Smith [EMAIL PROTECTED] wrote:

 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
 descriptionOracle Datasource/description
 res-ref-namejdbc/theDb/res-ref-name
 res-typeoracle.jdbc.pool.OracleDataSource/res-type
 res-authContainer/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

Re: javax.naming.NamingException: Cannot create resource instance

2008-10-02 Thread Ziggy O
Hi,

The tomcat version on my Desktop is 5.5.27 and the Tomcat version on the
Unix environment is 5.5.23. Could the above minor version difference cause
it?

One thing i have noticed is that if i take the /META-INF/Context.xml file
and copy it into $CATALINA_HOME/conf/Catalina/localhost/testapp.xml it does
work.

i.e. why does it require the context file in that directory and why does it
have to be renamed to my applications context. On the Windows environment i
dont have to rename and copy the context file to
$CATALINA_HOME/conf/Catalina/localhost

Thanks



On Thu, Oct 2, 2008 at 12:55 PM, David Smith [EMAIL PROTECTED] wrote:

 Ok...

 1) I don't see a tomcat version, could you post that?
 2) Are you sure the tomcat version on the production environment the same
 as your dev system?
 3) This is probably not causing the immediate problem, but res-type ...
 /res-type in your web.xml should be javax.sql.Datasource, not
 oracle.jdbc.pool.OracleDataSource.

 --David


 Ziggy O wrote:

 No mate that was the full stack trace.

 Thanks


 On Wed, Oct 1, 2008 at 7:02 PM, David Smith [EMAIL PROTECTED] wrote:



 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
descriptionOracle Datasource/description
res-ref-namejdbc/theDb/res-ref-name
res-typeoracle.jdbc.pool.OracleDataSource/res-type
res-authContainer/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

Re: javax.naming.NamingException: Cannot create resource instance

2008-10-02 Thread Ziggy O
A bit more info which i think might be relevant.

When i run it on my desktop i ran it directly from within Netbeans but when
i run it on the Unix server i export the project as a war file (within
netbeans) and copy it into the webapps directory on the Unix environment.

Is it possible that netbeans is including some libraries that are not
available on the Unix environment when i run it on the desktop?


On Thu, Oct 2, 2008 at 1:48 PM, Ziggy O [EMAIL PROTECTED] wrote:

 Hi,

 The tomcat version on my Desktop is 5.5.27 and the Tomcat version on the
 Unix environment is 5.5.23. Could the above minor version difference cause
 it?

 One thing i have noticed is that if i take the /META-INF/Context.xml file
 and copy it into $CATALINA_HOME/conf/Catalina/localhost/testapp.xml it does
 work.

 i.e. why does it require the context file in that directory and why does it
 have to be renamed to my applications context. On the Windows environment i
 dont have to rename and copy the context file to
 $CATALINA_HOME/conf/Catalina/localhost

 Thanks




 On Thu, Oct 2, 2008 at 12:55 PM, David Smith [EMAIL PROTECTED] wrote:

 Ok...

 1) I don't see a tomcat version, could you post that?
 2) Are you sure the tomcat version on the production environment the same
 as your dev system?
 3) This is probably not causing the immediate problem, but res-type ...
 /res-type in your web.xml should be javax.sql.Datasource, not
 oracle.jdbc.pool.OracleDataSource.

 --David


 Ziggy O wrote:

 No mate that was the full stack trace.

 Thanks


 On Wed, Oct 1, 2008 at 7:02 PM, David Smith [EMAIL PROTECTED] wrote:



 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
descriptionOracle Datasource/description
res-ref-namejdbc/theDb/res-ref-name
res-typeoracle.jdbc.pool.OracleDataSource/res-type
res-authContainer/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

Re: javax.naming.NamingException: Cannot create resource instance

2008-10-02 Thread Ziggy O
Yes it looks like that fact it is named with uppercase C was the problem. I
renamed it to context.xml and it finally worked.

Thank you all for your help.



On Thu, Oct 2, 2008 at 5:59 PM, David Smith [EMAIL PROTECTED] wrote:

 We have a winner!
 The Windows file system is one of the few (the only one I can think of)
 that's not case sensitive.  Unix, linux, bsd, macos, etc. , ... are all case
 sensitive.  You should change the file name 'Context.xml' to 'context.xml'
 and check to be sure it stays that way as you build your .war file.  After
 that you won't need to have testapp.xml in conf/Catalina/localhost.  Also
 you might want to check all the places in your webapp that references a file
 and be sure the names match in case to what's on disk.


 --David

 Ziggy O wrote:

 Hi,

 The tomcat version on my Desktop is 5.5.27 and the Tomcat version on the
 Unix environment is 5.5.23. Could the above minor version difference
 cause
 it?

 One thing i have noticed is that if i take the /META-INF/Context.xml file
 and copy it into $CATALINA_HOME/conf/Catalina/localhost/testapp.xml it
 does
 work.

 i.e. why does it require the context file in that directory and why does
 it
 have to be renamed to my applications context. On the Windows environment
 i
 dont have to rename and copy the context file to
 $CATALINA_HOME/conf/Catalina/localhost

 Thanks



 On Thu, Oct 2, 2008 at 12:55 PM, David Smith [EMAIL PROTECTED] wrote:



 Ok...

 1) I don't see a tomcat version, could you post that?
 2) Are you sure the tomcat version on the production environment the same
 as your dev system?
 3) This is probably not causing the immediate problem, but res-type ...
 /res-type in your web.xml should be javax.sql.Datasource, not
 oracle.jdbc.pool.OracleDataSource.

 --David


 Ziggy O wrote:



 No mate that was the full stack trace.

 Thanks


 On Wed, Oct 1, 2008 at 7:02 PM, David Smith [EMAIL PROTECTED] wrote:





 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
   descriptionOracle Datasource/description
   res-ref-namejdbc/theDb/res-ref-name
   res-typeoracle.jdbc.pool.OracleDataSource/res-type
   res-authContainer/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

javax.naming.NamingException: Cannot create resource instance

2008-10-01 Thread Ziggy O
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
 descriptionOracle Datasource/description
 res-ref-namejdbc/theDb/res-ref-name
 res-typeoracle.jdbc.pool.OracleDataSource/res-type
 res-authContainer/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

Re: javax.naming.NamingException: Cannot create resource instance

2008-10-01 Thread Ziggy O
I forgot to mention that i am using Tomcat 5.5 on both the windows and unix
environment.

Thanks.


On Wed, Oct 1, 2008 at 5:54 PM, Ziggy O [EMAIL PROTECTED] 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
  descriptionOracle Datasource/description
  res-ref-namejdbc/theDb/res-ref-name
  res-typeoracle.jdbc.pool.OracleDataSource/res-type
  res-authContainer/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

Re: jdbc driver fails with tomcat

2008-09-26 Thread Ziggy O
Hi,

When i debug the code, it doesnt get to the point where i am initialising
the OracleCallableStatement object. It failed just after the initialisation
of the ArrayDescriptor object.

I have tried to change it to use CallableStatement and im now getting
another error. Here is how i've changed it to.

CallableStatement cst =
conn.prepareCall(stp.SUBMIT_CONSIGNMENT_STORED_PROC);

ArrayDescriptor rectabDescriptor =
ArrayDescriptor.createDescriptor(CCS21_CONSIGNMENTLIST_TYPE,conn);
ARRAY awbNoHwbs = new
ARRAY(rectabDescriptor,conn,childLessAwbs);
ARRAY hwbs = new ARRAY(rectabDescriptor,conn,hwbList);


context.xml

  Resource name=jdbc/ccs21db auth=Container
  type=javax.sql.DataSource
driverClassName=oracle.jdbc.driver.OracleDriver
  url=jdbc:oracle:thin:@xxx.xxx.xxx:1525:dbsid
  username=xxx password=xxx maxActive=20 maxIdle=10
  maxWait=-1/

web.xml

resource-ref
 descriptionOracle Datasource/description
 res-ref-namejdbc/ccs21db/res-ref-name
 res-typeoracle.jdbc.pool.OracleDataSource/res-type
 res-authContainer/res-auth
/resource-ref

And here is the stack trace

java.lang.ClassCastException:
org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper

at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:149)

at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:115)

at
com.abbt.ccs21.data.accessors.ConsignmentDAO.submitDeclaration(ConsignmentDAO.java:301)

at
com.bt.abccs21.presentation.events.consignments.select.SubmitDeclaration.midAction(SubmitDeclaration.java:68)

at
com.bt.abccs21.presentation.events.CCS21EventAction.execute(CCS21EventAction.java:36)

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:647)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

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:213)

at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)

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:174)

at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)

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:689)

at java.lang.Thread.run(Thread.java:595)



On Fri, Sep 26, 2008 at 5:57 PM, Christopher Schultz 
[EMAIL PROTECTED] wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Dini,

 Dini Omar wrote:
  I am trying to send an array to a pl/sql module but for some reason i am
  unable to get the connection object.
 
  Here is the line of code that fails
 
  [code]
  Connection conn = null;
  ArrayDescriptor rectabDescriptor =
  ArrayDescriptor.createDescriptor(CCS21_CONSIGNMENTLIST_TYPE,conn);

 It's odd that your exception says DelegatingCallableStatement (which is
 the actual type of the object being casted) when the line indicated
 neither performs a cast, nor does anything with a statement.

 Are you sure this is the right line number?

  FAILS HERE
  ARRAY awbNoHwbs = new ARRAY(rectabDescriptor,conn,childLessAwbs);
  ARRAY hwbs = new ARRAY(rectabDescriptor,conn,hwbList);
 
  OracleCallableStatement cst =
 
 (OracleCallableStatement)conn.prepareCall(stp.SUBMIT_CONSIGNMENT_STORED_PROC);

 I'm guessing that the above line is the one where the problem is really