Discussions

Web tier: servlets, JSP, Web frameworks: Struts data-source problem

  1. Struts data-source problem (5 messages)

    Hi,
    I can not solve this problem form more then one week:
    I am trying to create simple web application using Struts
    in JBuilder X.
    Here are the steps I am doing:
    1. Create new project
    2. Create new Web-App
    3. Create new JSP with simple submit form
    Now the application can be runned and everything is ok.
    4. Add new dataSource to struts-config.xml so it looks like this:



    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
    <struts-config>
      <data-sources>
        <data-source key="dataSource" type="org.apache.struts.util.GenericDataSource">
          <set-property property="driverClassName" value="com.borland.datastore.jdbc.DataStoreDriver" />
          <set-property property="url" value="jdbc:borland:dslocal:C:\xjozo\test.jds" />
          <set-property property="username" value="jozo" />
          <set-property property="password" value="jozo" />
        </data-source>
      </data-sources>
    </struts-config>


    And when I try to run the app noe it throws this an exception (see log below).
    These libraries I have in my WEB-INF\lib\:

    beandt.jar
    commons-beanutils.jar
    commons-collections.jar
    commons-digester.jar
    commons-fileupload.jar
    commons-lang.jar
    commons-logging.jar
    commons-validator.jar
    dx.jar
    jakarta-oro.jar
    jds.jar
    struts.jar

    The file test.jds exists.

    Can anybody help me, I am realy out of any ideas.
    Here is the tomcat log:

    C:\xjozo\JBuilderX\jdk1.4\bin\javaw -classpath "C:\xjozo\JBuilderX\thirdparty\jakarta-tomcat-4.0.6-LE-jdk14\bin\bootstrap.jar; C:\xjozo\JBuilderX\jdk1.4\lib\tools.jar" -Dcatalina.home="C:/xjozo/JBuilderX/thirdparty/jakarta-tomcat-4.0.6-LE-jdk14" org.apache.catalina.startup.Bootstrap -config C:\xjozo\jbproject\proj5\Tomcat\conf\server8080.xml start
    HttpConnector Opening server socket on all host IP addresses
    Starting service Tomcat-Standalone
    Apache Tomcat/4.0.6
    WebappLoader[/WebModule1]: Deploying class repositories to work directory C:\xjozo\jbproject\proj5\Tomcat\work\WebModule1
    WebappLoader[/WebModule1]: Deploy JAR /WEB-INF/lib/beandt.jar to C:\xjozo\jbproject\proj5\WebModule1\WEB-INF\lib\beandt.jar
    WebappLoader[/WebModule1]: Deploy JAR /WEB-INF/lib/commons-beanutils.jar to C:\xjozo\jbproject\proj5\WebModule1\WEB-INF\lib\commons-beanutils.jar
    WebappLoader[/WebModule1]: Deploy JAR /WEB-INF/lib/commons-collections.jar to C:\xjozo\jbproject\proj5\WebModule1\WEB-INF\lib\commons-collections.jar
    WebappLoader[/WebModule1]: Deploy JAR /WEB-INF/lib/commons-digester.jar to C:\xjozo\jbproject\proj5\WebModule1\WEB-INF\lib\commons-digester.jar
    WebappLoader[/WebModule1]: Deploy JAR /WEB-INF/lib/commons-fileupload.jar to C:\xjozo\jbproject\proj5\WebModule1\WEB-INF\lib\commons-fileupload.jar
    WebappLoader[/WebModule1]: Deploy JAR /WEB-INF/lib/commons-lang.jar to C:\xjozo\jbproject\proj5\WebModule1\WEB-INF\lib\commons-lang.jar
    WebappLoader[/WebModule1]: Deploy JAR /WEB-INF/lib/commons-logging.jar to C:\xjozo\jbproject\proj5\WebModule1\WEB-INF\lib\commons-logging.jar
    WebappLoader[/WebModule1]: Deploy JAR /WEB-INF/lib/commons-validator.jar to C:\xjozo\jbproject\proj5\WebModule1\WEB-INF\lib\commons-validator.jar
    WebappLoader[/WebModule1]: Deploy JAR /WEB-INF/lib/dx.jar to C:\xjozo\jbproject\proj5\WebModule1\WEB-INF\lib\dx.jar
    WebappLoader[/WebModule1]: Deploy JAR /WEB-INF/lib/jakarta-oro.jar to C:\xjozo\jbproject\proj5\WebModule1\WEB-INF\lib\jakarta-oro.jar
    WebappLoader[/WebModule1]: Deploy JAR /WEB-INF/lib/jds.jar to C:\xjozo\jbproject\proj5\WebModule1\WEB-INF\lib\jds.jar
    WebappLoader[/WebModule1]: Deploy JAR /WEB-INF/lib/struts.jar to C:\xjozo\jbproject\proj5\WebModule1\WEB-INF\lib\struts.jar
    WebappLoader[/WebModule1]: Reloading checks are enabled for this Context
    StandardManager[/WebModule1]: Seeding random number generator class java.security.SecureRandom
    StandardManager[/WebModule1]: Seeding of random number generator has been completed
    ContextConfig[/WebModule1]: Added certificates -> request attribute Valve
    StandardWrapper[/WebModule1:default]: Loading container servlet default
    StandardWrapper[/WebModule1:action]: Marking servlet action as unavailable
    StandardContext[/WebModule1]: Servlet /WebModule1 threw load() exception: javax.servlet.ServletException: Error instantiating servlet class org.apache.struts.action.ActionServlet
    javax.servlet.ServletException: Error instantiating servlet class org.apache.struts.action.ActionServlet
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:895)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:810)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:327 9)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3421)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:638)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343)
    at org.apache.catalina.core.StandardService.start(StandardService.java:388)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:506)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:781)
    at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
    at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja va:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)
    StandardWrapper[/WebModule1:invoker]: Loading container servlet invoker
    HttpConnector[8080] Starting background thread
    Stopping service Tomcat-Standalone
    HttpConnector[8080] Stopping background thread
    StandardHost[localhost]: Removing web application at context path /WebModule1

    Threaded Messages (5)

  2. Struts data-source problem[ Go to top ]

    IS your JDBC connect string correct? I'd expect it to have unix style slashes:
    jdbc:borland:dslocal:C:/xjozo/test.jds
  3. Struts data-source problem[ Go to top ]

    Thanx but I have the same exception with unix style slashes.
    IS your JDBC connect string correct? I'd expect it to have unix style slashes:jdbc:borland:dslocal:C:/xjozo/test.jds
  4. Struts data-source problem[ Go to top ]

    Actually looking at the stack it seems that the Struts Jar cannot be found. is it present in /WEB-INF/lib?
    Or Struts basically work fine, until you add this datasource instruction. If that's the case then check that the JDBC driver JAR is also available.
  5. Struts data-source problem[ Go to top ]

    struts.jar is present in WEB-INF/lib.
    Everything works fine until the data-source ia added.
    JDBC driver(com.borland.datastore.jdbc.DataStoreDriver)
    is in the WEB-INF/lib/jds.jar .

    Could it be some kind of versioning problem?

    If there is somebody here who owns JBuilder X,
    could he, please, try the same steps as me and write here the result?

    thank you
  6. Struts data-source problem[ Go to top ]

    Hi Daniela-

    I've had a lot of trouble getting the struts datasource feature to work. There is an easier way to make the data avilable to your application, since you are using Tomcat. You can add a JNDI entry in Tomcat for the JDBC datasource. This can be easily done using the Tomcat web-based admin tool. Then, you can use JNDI lookups and the Service Locator pattern to hide the lookup operations.

    HTH,

    P