Caucho Forums  

This forum is permanently closed because of spam. For free community support, please visit Google Groups:


Go Back   Caucho Forums > Quercus

Reply
 
Thread Tools Display Modes
  #1  
Old 04-21-2013, 05:15 AM
sachin0235 sachin0235 is offline
Junior Member
 
Join Date: Apr 2013
Posts: 4
Default JDBC Connection Issue

Hi,

I am using quercus along with my Spring-Tomcat-MYSQL application to create wordpress blog. I am trying to get DB connectivity working. I am having file structure like -

tomcat 6 -> webapps -> blog -> quercus jar unzipped
tomcat 6 -> webapps -> myWebApp

in my tomcat server.xml i have following line of code -

Code:
<Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" maxActive="10" maxIdle="3" maxWait="10000" name="jdbc/abc" password="root" testOnBorrow="true" type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/abc?autoReconnect=true" username="root" validationQuery="SELECT 1"/>
in myWebApp(dispatch-servlet.xml)
Code:
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"
	scope="singleton">
		<property name="jndiName" value="/jdbc/abc" />
		<property name="resourceRef" value="true" />
	</bean>
in quercus web.xml

Code:
<init-param>
      <param-name>database</param-name>
      <param-value>/jdbc/abc</param-value>
    </init-param>
Now issue is my Spring app(myWebAPP works fine and getting DB connection but when i try to open quercus test page, i am getting following error -
Code:
javax.servlet.ServletException: javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
	com.caucho.quercus.servlet.QuercusServlet.setJndiDatabase(QuercusServlet.java:465)
	com.caucho.quercus.servlet.QuercusServlet.setInitParam(QuercusServlet.java:399)
	com.caucho.quercus.servlet.QuercusServlet.init(QuercusServlet.java:381)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
	java.lang.Thread.run(Unknown Source)
root cause

javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
	org.apache.naming.NamingContext.lookup(NamingContext.java:770)
	org.apache.naming.NamingContext.lookup(NamingContext.java:153)
	org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
	javax.naming.InitialContext.lookup(Unknown Source)
	com.caucho.quercus.servlet.QuercusServlet.setJndiDatabase(QuercusServlet.java:453)
	com.caucho.quercus.servlet.QuercusServlet.setInitParam(QuercusServlet.java:399)
	com.caucho.quercus.servlet.QuercusServlet.init(QuercusServlet.java:381)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
	java.lang.Thread.run(Unknown Source)
Please help me in fixing this error.
Reply With Quote
  #2  
Old 04-21-2013, 03:34 PM
sachin0235 sachin0235 is offline
Junior Member
 
Join Date: Apr 2013
Posts: 4
Default

This is fixed, issue was that my eclipse WTP plugin was doing some mess up. I have imported quercus-4.0.35 war in eclipse as a project and then make changes in web.xml for data source again. Also i have included context.xml in META_INF folder of quercus-4.0.35 project which has
Code:
<Resource name="jdbc/abc" auth="Container" type="javax.sql.D .....
launch the server from within eclipse and everything seems to be gr8.
Reply With Quote
  #3  
Old 04-22-2013, 12:58 AM
nam nam is offline
Administrator
 
Join Date: Aug 2009
Posts: 337
Default

Thanks for the update. I was trying this out and was running into issues myself. It turns out that I also had to create a quercus.xml file in META-INF.
Reply With Quote
  #4  
Old 05-25-2013, 06:53 AM
sachin0235 sachin0235 is offline
Junior Member
 
Join Date: Apr 2013
Posts: 4
Default Not working again

Now this is hopeless situation. I have to have my site online 2 weeks back but the problem is my blog section is showing me - Error getting database connection. It works on my local, same setting doesn;t work on my cloud service provider. I checked same settings with another free cloud provide but result is the same.

Had anyone faced this earlier?
Reply With Quote
  #5  
Old 05-27-2013, 06:02 AM
sachin0235 sachin0235 is offline
Junior Member
 
Join Date: Apr 2013
Posts: 4
Default Fixed

Fixed it after 2 days of hard work, now my blog is running fine on tomcat+mysql on my production environment. Issue was, i had an entry
Code:
<init-param>
      <param-name>database</param-name>
      <param-value>jdbc/myDB</param-value>
    </init-param>
which was causing error, i removed it and everything is working great
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:07 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.