Struts db connection issue

G

girishmanwani

Hi ,
I am trying to connect to Sybase from Struts by configuring the
struts-config.
But when i try to load application page that connects to database I get
the following error

[Servlet Error]-[action]: Failed to load servlet:
javax.servlet.UnavailableException: Initializing application data
source org.apache.struts.action.DATA_SOURCE
at
org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:1091)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at
com.ibm.ws.webcontainer.servlet.StrictServletInstance.doInit(StrictServletInstance.java:82)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._init(StrictLifecycleServlet.java:147)
at
com.ibm.ws.webcontainer.servlet.PreInitializedServletState.init(StrictLifecycleServlet.java:270)
at
com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.init(StrictLifecycleServlet.java:113)
at
com.ibm.ws.webcontainer.servlet.ServletInstance.init(ServletInstance.java:189)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at
com.ibm.ws.webcontainer.webapp.WebAppServletManager.addServlet(WebAppServletManager.java:870)
at
com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadServlet(WebAppServletManager.java:224)
at
com.ibm.ws.webcontainer.webapp.WebAppServletManager.getServletReference(WebAppServletManager.java:455)
at
com.ibm.ws.webcontainer.webapp.WebApp.getServletReference(WebApp.java:652)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcherInfo.calculateInfo(WebAppRequestDispatcherInfo.java:172)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcherInfo.<init>(WebAppRequestDispatcherInfo.java:59)
at
com.ibm.ws.webcontainer.webapp.WebApp.getRequestDispatcher(WebApp.java:1462)
at
com.ibm.ws.webcontainer.webapp.WebApp.getRequestDispatcher(WebApp.java:1421)
at
com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:268)
at
com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at
com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at
com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at
com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at
com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:443)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)


My struts-confic looks like this

<data-sources>

<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="driverClassName"
value="com.sybase.jdbc.SybDriver"/>
<set-property property="url"
value="jdbc:sybase:Tds:databaseservername:port/databasename"/>
<set-property property="username" value="uname"/>
<set-property property="password" value="pword"/>
</data-source>

</data-sources>

What do you guys think could be the problem.
Pl. help.
 
L

Larry

Sounds like one or more of your data-source attributes may be
incorrect. Try writing a short test class to test your DB connection
using DriverManager.getConnection. At the very least, you'll probably
get moire meaningful error messages that would help you troubleshoot
the problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top