• Post Reply Bookmark Topic Watch Topic
  • New Topic

Data Source trouble - javax.servlet.UnavailableException: Initializing applic (SOLVED)  RSS feed

Matt Kohanek
Village Idiot
Ranch Hand
Posts: 484
Java jQuery Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SOLUTION - not really a solution, just found out that the server at my school will not allow remote access, I can only work with it on campus. Basically I ned to set this all up on my home server and database. Then I will put it all on the remote zeus server and change the datasource as necessary. Then, since it will all be on that server, access will no longer be blocked.

Here is my data source. I know the database is there, but I am not sure if there are connection problems, and I do not really know how to find out.

<data-source type="org.apache.commons.dbcp.BasicDataSource">
value="org.postgresql.Driver" />
value="jdbc:mysql://localhost:3306/users" />
value="Dr" />
value="se" />
value="15" />
value="5000" />
value="false" />
value="false" />

I get this stack trace:

SEVERE: Servlet /db_test threw load() exception
javax.servlet.UnavailableException: Initializing application data source stocksDS
at org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:812)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:335)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4042)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4348)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Apr 20, 2010 8:03:21 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Apr 20, 2010 8:03:21 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /
Apr 20, 2010 8:03:21 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/21 config=null
Apr 20, 2010 8:03:21 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1288 ms

From what i am finding online, it seems like the problem might be with connecting to the database.

I am about to start a struts 1.1 project and see if I get any resolution, but I would really like to find out how to make it work with 1.2 if you have any ideas.

Also, when I comment out that data source and run the project, I can login to the pages I created, without using the login info from the database of course (I just add the userid and password in the java code). However, as soon as I uncomment out the data source, and change nothing else, not even the java code, I get this when I hit the login button:

message Servlet action is not available

description The requested resource (Servlet action is not available) is not available.

No stack trace to go with that though. I know that is a little ambiguous so ignore that part if you want, I just thought it might be helpful to someone possibly

edit - also, is there a way to change a project from struts 1.2 to 1.1 in myeclipse, or is that set in stone once you make the choice?
Matt Kohanek
Village Idiot
Ranch Hand
Posts: 484
Java jQuery Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am starting to think I have the url for the database wrong. This is a database on a zeus server. This is for a class project. Well not really any project, but just something I am trying to do for myself. But still, I am just unsure what is wrong. Is my database url incorrect in that data source for a database located on a separate computer in my professor's office? Or does that look right? I am starting to think the url I have there should only work for a database on my local machine.

edit - even using the example the professor used in class gives me this same stack trace. I wish I knew what I were missing here ><

This is his faces-config file from his own example:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">

<data-sources >

<data-source key="stocksDS" type="org.apache.struts.util.GenericDataSource">
<set-property property="autoCommit" value="false" />
<set-property property="readOnly" value="false" />
<set-property property="description" value="" />
<set-property property="driverClass" value="com.mysql.jdbc.Driver" />
<set-property property="minCount" value="1" />
<set-property property="loginTimeout" value="" />
<set-property property="password" value="se" />
<set-property property="user" value="Dr" />
<set-property property="maxCount" value="15" />
<set-property property="url" value="jdbc:mysql://localhost:3306/stocks" />


<form-bean name="lookupForm" type="ch03.LookupForm" />
<form-bean name="loginform" type="ch04.LoginForm" />
<global-exceptions />
<forward name="mainindex" path="/index.jsp" />
<forward name="exception" path="/Errors/exception_error.jsp" />
<action path="/Lookup" name="lookupForm" type="ch03.LookupAction"
attribute="LookupForm" input="/ch03/index.jsp" scope="request">
<forward name="failure" path="/ch03/index.jsp" />
<forward name="success" path="/ch03/quote.jsp" />
<action path="/Lookup4" name="lookupForm"
type="ch04.LookupAction" attribute="lookupForm" scope="request">
<forward name="failure" path="/ch04/index.jsp" />
<forward name="success" path="/ch04/quote.jsp" />
<action path="/LoginAction" name="loginform"
type="ch04.LoginAction" attribute="loginform" input="/ch04/login.jsp"
<forward name="failure" path="/ch04/login.jsp" />
<forward name="success" path="/ch04/Welcome.jsp" />
<controller processorClass="ch04.RP" />
<message-resources parameter="ApplicationResources" />
<plug-in className="ch04.ch04Plugin" />

again, things work fine when that data source is commented out, but once it is not I have trouble
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!