tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jitendra Kharche" <Jitendra.Khar...@geometricsoftware.com>
Subject RE: Using Datasource for cloudscape
Date Tue, 20 Jun 2006 05:25:05 GMT
 
Hi Dilan,

Thanks for helping.
Attaching the files
CATALINA_HOME/conf/server.xml
CATALINA_HOME/webapps/myApp/WEB-INF/web.xml
CATALINA_HOME/webapps/myApp/META-INF/context.xml

The context.xml is placed in CATALINA_HOME/webapps/myApp/META-INF.
There are no additional config files for database or resources.
Please ask any additional info required.
 
Regards,
Jitendra Kharche
Geometric Software Solutions Co. Ltd.
Work: +91-20-2290 6351
 
********************************************************************
This e-mail communication and any attachments are privileged and
confidential and intended only for the use of the recipients named
above. If you are not the intended recipient, please do not review,
disclose, disseminate, distribute or copy this e-mail and attachments.
If you have received this communication in error, please notify the
sender immediately by email or telephone at+91-20-22906351.
*********************************************************************

-----Original Message-----
From: Dilan Kelanibandara [mailto:dilan@beyondm.net] 
Sent: Monday, June 19, 2006 8:58 PM
To: 'Tomcat Users List'
Subject: RE: Using Datasource for cloudscape

Hi Jitendra,

To claryfiy your error please send followings in your configuration (as
an attachment or copy ,paste here)

CATALINA_HOME/conf/server.xml
CATALINA_HOME/webapps/yourApp/WEB-INF/web.xml
context.xml
Where do you have defined your context.xml?

And any other additional configuration files you have for database
configuration and resource references

Regards,
Dilan

-----Original Message-----
From: Jitendra Kharche [mailto:Jitendra.Kharche@geometricsoftware.com]
Sent: Monday, June 19, 2006 6:20 PM
To: Tomcat Users List
Subject: RE: Using Datasource for cloudscape

 
Hi Dilan,

Please see my next mail. In which I have modified the context.xml and
got following error
WARNING: Unexpected exception resolving reference
java.lang.NoSuchMethodException:
com.ibm.db2j.jdbc.DB2jDataSource.setScope(boolean)
        at java.lang.Class.getMethod(Class.java:1581)
        at
com.ibm.db2j.jdbc.DB2jAbstractDataSource.getObjectInstance(Unknown
Source)
	  ........

Then I added the resourec-ref entry in web.xml, but I still get the same
error.
 
Regards,
Jitendra Kharche
Geometric Software Solutions Co. Ltd.
Work: +91-20-2290 6351
 
********************************************************************
This e-mail communication and any attachments are privileged and
confidential and intended only for the use of the recipients named
above. If you are not the intended recipient, please do not review,
disclose, disseminate, distribute or copy this e-mail and attachments.
If you have received this communication in error, please notify the
sender immediately by email or telephone at+91-20-22906351.
*********************************************************************

-----Original Message-----
From: Dilan Kelanibandara [mailto:dilan@beyondm.net]
Sent: Monday, June 19, 2006 8:34 PM
To: 'Tomcat Users List'
Subject: RE: Using Datasource for cloudscape

Hi Jitenra,
Tomcat5.5 uses a defferent way of defining JNDI resources. That is why
you get this error. It seems your resource declaration at web.xml is
missing. 
Please stick to tomcat documentation here
http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html

where you have to define context.xml in
CATALINA_HOME/webapps/yourApp/META-INF/

you have to define database connectivity in
CATALINA_HOME/conf/server.xml as usual, where tomcat has commented all
the sample database connectivities.
Uncomment your required one their and define them

web.xml should have resource declaration at bottom if web.xml file (this
is normally, but where you declare in web.xml depends on your other
resource declaration at web.xml)

That is all you have to do. Please stick to tomcat documentation.

Regards,
Dilan Kelanibandara

-----Original Message-----
From: Jitendra Kharche [mailto:Jitendra.Kharche@geometricsoftware.com]
Sent: Monday, June 19, 2006 5:28 PM
To: Tomcat Users List
Subject: Using Datasource for cloudscape

 
Hi All,

I am using Tomcat 5.5.17 and tried running a sample datasource
application using the Cloudscape database. I have added the driver jar
into common/lib directory.

The context.xml has following configuration for datasource
  <Resource auth="Container" name="jdbc/MyDB"
type="javax.sql.DataSource" password="password"
    driverClassName="com.ibm.db2j.jdbc.DB2jDriver" maxIdle="4"
testOnBorrow="true"
    validationQuery="select 1" username="user"
 
url="jdbc:db2j:E:/apache-tomcat-5.5.17/webapps/datasourcedemo/SampleDB"
    timeBetweenEvictionRunsMillis="30000" maxActive="8"/>

I have created a datasource using the admin application and it added
following entry in server.xml
    <Resource name="jdbc/MyDB" type="javax.sql.DataSource"
password="password"
      driverClassName="com.ibm.db2j.jdbc.DB2jDriver" maxIdle="2"
maxWait="5000" username="user" 
 
url="jdbc:db2j:E:/apache-tomcat-5.5.17/webapps/datasourcedemo/SampleDB"
maxActive="4"/>

The appliaction has a jsp page with following code

		Connection con = null;
		Statement stmt = null;
		try {
			Context initContext = new InitialContext();
			Context envContext  =
(Context)initContext.lookup("java:comp/env");
			DataSource ds =
(DataSource)envContext.lookup("jdbc/MyDB");
			System.out.println("Got DataSource\n");
			con = ds.getConnection();
			System.out.println("Got Connection\n");
			

		} catch(java.lang.Exception e) {
			e.printStackTrace();
			System.err.print(e.getClass().getName());
			System.err.println(e.getMessage());
		}

		try {
			stmt = con.createStatement();	
				
			ResultSet rs = stmt.executeQuery("SELECT * FROM
assignment");
			............
			............

The application gets deployed ok but when I access the jsp page I get
the following exception 

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create
PoolableConnection Factory (Syntax error: Encountered "<EOF>" at line 1,
column 8.)
        at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSo
urce.java:855)
        at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSourc
e.java:540)
        at org.apache.jsp.dbdemo1_jsp._jspService(dbdemo1_jsp.java:59)
        at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja
va:332)
        at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
        at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:252)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:173)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:213)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:178)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:126)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:105)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:107)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:1
48)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:86
9)
        at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.proc
essConnection(Http11BaseProtocol.java:664)
        at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint
.java:527)
        at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollow
erWorkerThread.java:80)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:684)
        at java.lang.Thread.run(Thread.java:595)
Caused by: SQL Exception: Syntax error: Encountered "<EOF>" at line 1,
column 8.

        at db2j.ai.j.generateCsSQLException(Unknown Source)
        at db2j.ai.g.wrapInSQLException(Unknown Source)
        at db2j.ai.g.handleException(Unknown Source)
        at db2j.ai.c.handleException(Unknown Source)
        at db2j.ai.e.handleException(Unknown Source)
        at db2j.ai.m.execute(Unknown Source)
        at db2j.ai.m.executeQuery(Unknown Source)
        at
org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeQuery(DelegatingS
tatement.java:205)
        at
org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.validateConnection
(PoolableConnectionFactory.java:328)
        at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.validateConnectionFactory(Ba
sicDataSource.java:879)
        at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSo
urce.java:851)
        ... 22 more
org.apache.tomcat.dbcp.dbcp.SQLNestedExceptionCannot create
PoolableConnectionFactory (Syntax error: Encountered "<EOF>" at line 1,
column 8.) java.lang.NullPointerException
        at org.apache.jsp.dbdemo1_jsp._jspService(dbdemo1_jsp.java:70)
        at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja
va:332)
        at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
        at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:252)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:173)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:213)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:178)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:126)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:105)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:107)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:1
48)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:86
9)
        at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.proc
essConnection(Http11BaseProtocol.java:664)
        at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint
.java:527)
        at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollow
erWorkerThread.java:80)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:684)
        at java.lang.Thread.run(Thread.java:595)
java.lang.NullPointerExceptionnull


Please help.
 
Regards,
Jitendra Kharche
Geometric Software Solutions Co. Ltd.
Work: +91-20-2290 6351
 
********************************************************************
This e-mail communication and any attachments are privileged and
confidential and intended only for the use of the recipients named
above. If you are not the intended recipient, please do not review,
disclose, disseminate, distribute or copy this e-mail and attachments.
If you have received this communication in error, please notify the
sender immediately by email or telephone at+91-20-22906351.
*********************************************************************

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



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


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



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


Mime
View raw message