  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | JSP - A mailing list about Java Server Pages specification and reference | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | -none- | -none- 2007-08-16 - By David Smith
Back Hi Ian.
ojdbc14.jar needs to ONLY be in common/lib. It won't work in myapp/WEB-INF/lib and won't work if you have the jar in both places.
Additionally you should take a look at the JDBC howto docs regarding what your <Resource...> config in your myapp/META-INF/context.xml or conf/Catalina/localhost/myapp.xml should look like:
http://tomcat.apache.org/tomcat-5 (See http://cat-5.ora-code.com).5-doc/jndi-datasource-examples-howto.html #Oracle%208i%20with%20OCI%20client
My only editorial comment on the page is to NOT place your <Resource.../> or <Context .../> definition in server.xml as recommended on the page. Place it in context.xml or myapp.xml as I describe above.
--David
ian.blenk@(protected) wrote:
>Thanks for your advice so far > >I've upgraded to the latest Oracle ojdbc14.jar and placed it the myapp\WEB-INF \lib folder, I also tried it the >Tomcat\common\lib for for good measure but still got the same results. I'll continue to use ojdbc14.jar from now >though. > >I've change the ResourceParams name to just Resource name but this causes Tomcat not to startup, the logs show the >following trace... > >*** Excerpt Tomcat 5.5.12 logs *** >16-Aug-2007 (See http://Aug-2007.ora-code.com) 16:08:32 org.apache.tomcat.util.digester.Digester endElement >SEVERE: End event threw exception >java.lang.reflect.InvocationTargetException > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java :39) >*** end *** > >Does this mean it's now reading the <context> <Resource> element. ? > >Thanks > >Ian > > >Quoting ashish shrivastava <ashish.indore@(protected)>: > > > >>check this >> >>http://evolutionnext.com/blog/2005/10/13/1129259088959.html >> >> >> >>On 8/16/07, Matthew Kerle <matthew.kerle@(protected)> wrote: >> >> >>>hmm, you have an interesting problem! >>> >>>first thing I'd say is use this opportunity to upgrade to the >>>ojdbc14.jar, which is the latest oracle jdbc driver and allows lots of >>>nice enhancements. >>> >>>second, I'm assuming that since the error is a servlet exception, that >>>there's some servlet code manually handling a database connection (no >>>comment *cough* *cough*) that it gets from a JNDI lookup? >>> >>>third, try changing the <ResourceParams> tag to a plain <Resource> tag, >>>this is the Resource tag that I use in my app (and it works). caveat: I >>>declare this in /META-INF/context.xml inside the <context> tag. >>> >>> <Resource name="jdbc/my_USERDS" auth="Container" >>> type="javax.sql.DataSource" >>> maxActive="0" >>> maxIdle="10" >>> maxWait="500" >>> username="db_user" >>> password="db_pass" >>> driverClassName="oracle.jdbc.OracleDriver" >>> url="jdbc:oracle:thin:@(protected):1521:ORA_SID"/> >>> >>>can you try this and let us know how it goes? >>> >>>cheers! >>> >>>ian.blenk@(protected) wrote: >>> >>> >>>>I'm upgrading from tomcat 4.1.24 to tomcat 5.5.12 on WinXP. I have three >>>> >>>> >>>applications that are deployed from this >>> >>> >>>>server, two of which work fine with tomcat 5.5.12, however the third >>>> >>>> >>>which uses an oracle 9i database gives me the >>> >>> >>>>following error "javax.servlet.ServletException: Cannot create JDBC >>>> >>>> >>>driver of class '' for connect URL 'null' ". >>> >>> >>>>Basically I've included the same details form the Tomcat4 server.xmlfile >>>> >>>> >>into the tomcat >> >> >>>5.5 server.xml, rediting >>> >>> >>>>where necessary. >>>> >>>>Things I have tried.. >>>> >>>>Placing the context into fragment files located either inside the >>>> >>>> >>>applications META-INF folder or under >>> >>> >>>>tomcat\conf\Catalina\localhost. Neither of these seemd to work for me as >>>> >>>> >>>Tomcat could not find the apps, so I've >>> >>> >>>>left the context back in server.xml. >>>>Rewriting the Resource params <parameter> as elements i.e.factory=" >>>> >>>> >>>com.ora.jsp.sql.DataSourceFactory" >>> >>> >>>>Checked changed location of the JDBC jar file. >>>> >>>> >>classes12.jarcatalina_home\common\lib\ AND >> >> >>>>catalina_home\webapps\[appname]\WEB-INF\lib >>>>Checked changed the server.xml service-name and engine name to match >>>> >>>> >>>previous TC4 server.xml version. >>> >>> >>>>Added a Resourcelink element to the context - this is not present on the >>>> >>>> >>>TC4 version >>> >>> >>>>Checked Tomcat logs. >>>> >>>>I think that Tomcat is not able to read the <ResourceParams> element, >>>> >>>> >>>which is why the URL and driverClass are >>> >>> >>>>NULL. >>>> >>>>Which When I checked the Tomcat log files shows ... >>>> >>>>16-Aug-2007 (See http://Aug-2007.ora-code.com) 09:25:46 org.apache.catalina.core.ApplicationContext log >>>>SEVERE: action: Cannot create JDBC driver of class '' for connect URL >>>> >>>> >>>'null' >>> >>> >>>>Background info >>>>Using Apache 2.0 with mod_JK to serve pages on port 80 >>>>Java version 1.5 >>>> >>>>**** server.xml **** >>>> >>>><!-- Tomcat 5.5 Example Server Configuration File --> >>>> >>>><Server port="8005" shutdown="SHUTDOWN" debug="0"> >>>> >>>> <Listener className=" >>>> >>>> >>>org.apache.catalina.mbeans.ServerLifecycleListener" debug="0"/> >>> >>> >>>> <Listener className=" >>>> >>>> >>>org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" debug="0"/> >>> >>> >>>> <!-- Global JNDI resources --> >>>> <GlobalNamingResources> >>>> >>>> <!-- Test entry for demonstration purposes --> >>>> <Environment name="simpleValue" type="java.lang.Integer" >>>> >>>> >>>value="30"/> >>> >>> >>>> <Resource name="UserDatabase" auth="Container" >>>> type="org.apache.catalina.UserDatabase" >>>> description="User database that can be updated and saved" >>>> factory="org.apache.catalina.users.MemoryUserDatabaseFactory" >>>> pathname="conf/tomcat-users.xml" ></Resource> >>>> >>>> >>>> </GlobalNamingResources> >>>> >>>> >>>> <Service name="Catalina"> >>>> >>>> <Connector port="8009" >>>> enableLookups="true" redirectPort="8443" >>>> >>>> >>>protocol="AJP/1.3" /> >>> >>> >>>> <Engine name="Catalina" defaultHost="opp-online" debug="0"> >>>> >>>> >>>> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" >>>> resourceName="UserDatabase"/> >>>> >>>> >>>> <Host name="opportunities-online" debug="0" appBase="webapps" > >>>> >>>> >>>> <Context path="/staff" docBase="oponline/staff" cookies="true" >>>> >>>> >>>reloadable="true"> >>> >>> >>>> <Valve className="org.apache.catalina.valves.AccessLogValve" >>>> directory="logs" prefix="staff_access_log." >>>> >>>> >>>suffix=".txt" >>> >>> >>>> pattern="combined" resolveHosts="false"/> >>>> >>>> <Logger className="org.apache.catalina.logger.FileLogger" >>>> >>>> >>>prefix="oponline_log." suffix=".txt" >>> >>> >>>>timestamp="true"/> >>>> >>>> <ResourceParams name="jdbc/oponline" >>>> factory="com.ora.jsp.sql.DataSourceFactory" >>>> user="myuser" >>>> password="mypassword" >>>> dataSourceClassName=" >>>> >>>> >>>oracle.jdbc.pool.OracleConnectionCacheImpl" >>> >>> >>>> URL=" >>>> >>>> >>>jdbc:oracle:thin:@(protected):1521:MYTE" >>> >>> >>>> maxLimit="5" /> >>>> >>>> <!-- global resource for application's context. --> >>>> <!-- <ResourceLink name="/jdbc/oponline" >>>> >>>> >>>global="/jdbc/oponline" >>> >>> >>>> type="org.apache.catalina.UserDatabase"/> --> >>>> >>>> </Context> >>>> >>>> </Host> >>>> >>>> </Engine> >>>> >>>> </Service> >>>> >>>></Server> >>>> >>>>*** end server.xml *** >>>> >>>> >>>>*** App web.xml except *** >>>> >>>> <resource-ref> >>>> <description> >>>> JNDI DataSource for [appname] database. >>>> (From Oreilly "JavaServer Pages", Bergsten, 2nd Ed., page 485) >>>> </description> >>>> <res-ref-name>jdbc/oponline</res-ref-name> >>>> <res-type>javax.sql.DataSource</res-type> >>>> <res-auth>Container</res-auth> >>>> </resource-ref> >>>> >>>>*** end web.xml *** >>>> >>>> >>>>Thanks >>>> >>>>Ian >>>> >>>> >>>> >>>> >>>-- >>>Matthew Kerle >>>IT Consultant >>>Canberra, Australia >>> >>>Mobile: +61404 096 863 >>>Email : mattkerle@(protected) >>>Web : http://threebrightlights.blogspot.com/ >>> >>> >>>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ >>>To start a new topic, e-mail: users@(protected) >>>To unsubscribe, e-mail: users-unsubscribe@(protected) >>>For additional commands, e-mail: users-help@(protected) >>> >>> >>> >>> > > > >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ To start a new topic, e-mail: users@(protected) To unsubscribe, e-mail: users-unsubscribe@(protected) For additional commands, e-mail: users-help@(protected)
|
|
 |