You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by todd thorner <tt...@lycos.com> on 2003/11/12 04:52:41 UTC
Rephrased: MysqlDataSource problem?
...because my webapp only started punking out once I tried to add my first <data-source> element, I've rephrased this post (even though I'm not sure that it's the data source where I'm going wrong).
--
--------- Original Message ---------
DATE: Mon, 10 Nov 2003 05:29:59
From: "todd thorner" <tthorner@lycos.com
To: struts-user@jakarta.apache.org
Cc:
Hi,
I'm having some (newbie) problems with my Struts-based webapp running on Tomcat 4.1.x
Something is going wrong when I try to access the first jsp page that has a form. One thing I have tried to add recently to my webapp's functionality is a <data-source (I had been using straight JDBC), so I'm wondering if someone could clarify to me if that's where I'm making a mistake (I'm especially concerned about the "url" parameters I'm trying to use).
The following are the relevant stack trace and/or log files that I could find:
---------------------------------------------
Nov 10, 2003 4:22:57 AM org.apache.struts.util.RequestUtils createActionForm
SEVERE: Error creating form bean of class pu.strutsapp.actionform.LogonForm
java.lang.ClassNotFoundException: pu.strutsapp.actionform.LogonForm
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1444)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1289)
at org.apache.struts.util.RequestUtils.applicationClass(RequestUtils.java:207)
...etc.
at java.lang.Thread.run(Thread.java:534)
Nov 10, 2003 4:22:57 AM org.apache.jk.server.JkCoyoteHandler action
INFO: RESET
2003-11-10 04:22:57 ApplicationDispatcher[/porturla] Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Exception creating bean of class pu.strutsapp.actionform.LogonForm: {1}
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
...etc.
----- Root Cause -----
javax.servlet.ServletException: Exception creating bean of class pu.strutsapp.actionform.LogonForm: {1}
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533)
2003-11-10 04:22:57 ApplicationDispatcher[/porturla] Servlet.service() for servlet action threw exception
org.apache.jasper.JasperException: Exception creating bean of class pu.strutsapp.actionform.LogonForm: {1}
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
at java.lang.Thread.run(Thread.java:534)
...etc.
----- Root Cause -----
javax.servlet.ServletException: Exception creating bean of class pu.strutsapp.actionform.LogonForm: {1}
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533)
at org.apache.jsp.Logon_jsp._jspService(Logon_jsp.java:90)
---------------------------------------------
The "Logon" jsp page that tries to create the LogonForm bean looks like this (the relevant parts):
<html:form action="/LogonSubmit_FromMainPage" focus="emailAddress">
<table border="0" width="100%">
<tr>
<th align="right"Username:></th>
<td align="left"><html:text property="emailAddress" size="50"/></td>
</tr>
<tr>
<th align="right"Password:></th>
<td align="left"><html:password property="password" size="50"/></td>
</tr>
<tr>
<td align="right"><html:submit/></td>
<td align="left"><html:reset/></td>
</tr>
</table>
</html:form>
---------------------------------------------
My webapp's "web.xml" file looks like this (the relevant parts):
<resource-ref>
<description>
Resource reference to a com.mysql.jdbc.jdbc2.optional.MysqlDataSource
instance that may be used for data access for the porturla domain,
preconfigured to connect to the appropriate MySql server.
</description>
<res-ref-name>
jdbc/porturla
</res-ref-name>
<res-type>
com.mysql.jdbc.jdbc2.optional.MysqlDataSource
</res-type>
<res-auth>
Container
</res-auth>
</resource-ref>
<resource-ref>
<description>
Resource reference to a factory for javax.mail.Session
instances that may be used for sending electronic mail
messages, preconfigured to connect to the appropriate
SMTP server.
</description>
<res-ref-name>
mail/Session
</res-ref-name>
<res-type>
javax.mail.Session
</res-type>
<res-auth>
Container
</res-auth>
</resource-ref>
---------------------------------------------
My "struts-config.xml" file looks like this (the relevant parts):
<data-sources>
<data-source type="com.mysql.jdbc.jdbc2.optional.MysqlDataSource">
<set-property property="autoCommit" value="true"/>
<set-property property="description" value="MySql Data Source for domain DB#1"/>
<set-property property="driverClass" value="com.mysql.jdbc.Driver"/>
<set-property property="minCount" value="2"/>
<set-property property="maxCount" value="10"/>
<set-property property="username" value="mydomain"/>
<set-property property="password" value="**********"/>
<set-property property="url" value="jdbc:mysql://mysql:3306/mydomain?autoReconnect=true"/>
</data-source>
</data-sources>
<form-beans>
<form-bean
name="logonForm"
type="pu.strutsapp.actionform.LogonForm"/>
</form-beans>
<action-mappings>
<action path="/LogonSubmit_FromMainPage"
type="pu.strutsapp.action.LogonAction"
name="logonForm"
scope="session"
validate="true"
input="/pages/Logon.jsp">
<forward name="success"
path="/pages/WelcomeToANewSession.jsp"/>
<forward name="fail"
path="/pages/Logon_Failed.jsp"/>
</action>
</action-mappings>
---------------------------------------------
My Tomcat "server.xml" file looks like this (the relevant parts):
<Context className="org.apache.catalina.core.StandardContext" cachingAllowed="true" charsetMapperClass="org.apache.catalina.util.CharsetMapper" cookies="true" crossContext="false" debug="0" docBase="/usr/ngasi/contexts/mydomain/appservers/jakarta-tomcat-4.1.27/webapps/mydomain" mapperClass="org.apache.catalina.core.StandardContextMapper" path="/mydomain" privileged="false" reloadable="false" swallowOutput="false" useNaming="true" wrapperClass="org.apache.catalina.core.StandardWrapper">
<Resource auth="Container" name="jdbc/mydatasource" scope="Shareable" type="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"/>
<Resource auth="Container" name="mail/Session" scope="Shareable" type="javax.mail.Session"/>
<ResourceParams name="jdbc/mydatasource">
<parameter>
<name>url</name>
<value>jdbc:mysql://mysql:3306/mydomain?autoReconnect=true</value>
</parameter>
<parameter>
<name>password</name>
<value>********</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<parameter>
<name>username</name>
<value>mydomain</value>
</parameter>
</ResourceParams>
<ResourceParams name="mail/Session">
<parameter>
<name>mail.smtp.host</name>
<value>localhost</value>
</parameter>
</ResourceParams>
</Context>
---------------------------------------------
Also, all my proper class files are in the WEB-INF/classes directory. Only "struts.jar" and "struts-legacy.jar" are in WEB-INF/lib.
So, where am I messing up? Should the data-source "auth" be "Container"? Should I be using MysqlDataSourceFactory instead (I'm not sure how to do that)? Anything else that might be wrong?
Thanks for any suggestions or guesses.
____________________________________________________________
Enter now for a chance to win a 42" Plasma Television!
http://ad.doubleclick.net/clk;6413623;3807821;f?http://mocda1.com/1/c/563632/113422/313631/313631
AOL users go here: http://ad.doubleclick.net/clk;6413623;3807821;f?http://mocda1.com/1/c/563632/113422/313631/313631
This offer applies to U.S. Residents Only
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Rephrased: MysqlDataSource problem?
Posted by Max Cooper <ma...@maxcooper.com>.
1. Here is at least one problem, fix this first:
> java.lang.ClassNotFoundException: pu.strutsapp.actionform.LogonForm
Perhaps the package structure does not match the structure in
WEB-INF/classes?
2. You need the other jars that come with Struts in your WEB-INF/lib
directory.
3. There are some HTML errors here:
> <th align="right"Username:></th>
> <th align="right"Password:></th>
-Max
----- Original Message -----
From: "todd thorner" <tt...@lycos.com>
To: <st...@jakarta.apache.org>
Sent: Tuesday, November 11, 2003 7:52 PM
Subject: Rephrased: MysqlDataSource problem?
> ...because my webapp only started punking out once I tried to add my first
<data-source> element, I've rephrased this post (even though I'm not sure
that it's the data source where I'm going wrong).
> --
>
> --------- Original Message ---------
>
> DATE: Mon, 10 Nov 2003 05:29:59
> From: "todd thorner" <tthorner@lycos.com
> To: struts-user@jakarta.apache.org
> Cc:
>
> Hi,
>
> I'm having some (newbie) problems with my Struts-based webapp running on
Tomcat 4.1.x
>
> Something is going wrong when I try to access the first jsp page that has
a form. One thing I have tried to add recently to my webapp's functionality
is a <data-source (I had been using straight JDBC), so I'm wondering if
someone could clarify to me if that's where I'm making a mistake (I'm
especially concerned about the "url" parameters I'm trying to use).
>
> The following are the relevant stack trace and/or log files that I could
find:
>
> ---------------------------------------------
>
> Nov 10, 2003 4:22:57 AM org.apache.struts.util.RequestUtils
createActionForm
> SEVERE: Error creating form bean of class
pu.strutsapp.actionform.LogonForm
> java.lang.ClassNotFoundException: pu.strutsapp.actionform.LogonForm
> at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1444)
> at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1289)
> at
org.apache.struts.util.RequestUtils.applicationClass(RequestUtils.java:207)
> ...etc.
> at java.lang.Thread.run(Thread.java:534)
> Nov 10, 2003 4:22:57 AM org.apache.jk.server.JkCoyoteHandler action
> INFO: RESET
>
>
> 2003-11-10 04:22:57 ApplicationDispatcher[/porturla] Servlet.service() for
servlet jsp threw exception
> org.apache.jasper.JasperException: Exception creating bean of class
pu.strutsapp.actionform.LogonForm: {1}
> at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
54)
> at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
> ...etc.
> ----- Root Cause -----
> javax.servlet.ServletException: Exception creating bean of class
pu.strutsapp.actionform.LogonForm: {1}
> at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:533)
>
>
> 2003-11-10 04:22:57 ApplicationDispatcher[/porturla] Servlet.service() for
servlet action threw exception
> org.apache.jasper.JasperException: Exception creating bean of class
pu.strutsapp.actionform.LogonForm: {1}
> at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
54)
> at java.lang.Thread.run(Thread.java:534)
> ...etc.
> ----- Root Cause -----
> javax.servlet.ServletException: Exception creating bean of class
pu.strutsapp.actionform.LogonForm: {1}
> at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:533)
> at org.apache.jsp.Logon_jsp._jspService(Logon_jsp.java:90)
>
> ---------------------------------------------
>
>
> The "Logon" jsp page that tries to create the LogonForm bean looks like
this (the relevant parts):
>
> <html:form action="/LogonSubmit_FromMainPage" focus="emailAddress">
> <table border="0" width="100%">
> <tr>
> <th align="right"Username:></th>
> <td align="left"><html:text property="emailAddress" size="50"/></td>
> </tr>
> <tr>
> <th align="right"Password:></th>
> <td align="left"><html:password property="password" size="50"/></td>
> </tr>
> <tr>
> <td align="right"><html:submit/></td>
> <td align="left"><html:reset/></td>
> </tr>
> </table>
> </html:form>
>
> ---------------------------------------------
>
> My webapp's "web.xml" file looks like this (the relevant parts):
>
> <resource-ref>
> <description>
> Resource reference to a com.mysql.jdbc.jdbc2.optional.MysqlDataSource
> instance that may be used for data access for the porturla domain,
> preconfigured to connect to the appropriate MySql server.
> </description>
> <res-ref-name>
> jdbc/porturla
> </res-ref-name>
> <res-type>
> com.mysql.jdbc.jdbc2.optional.MysqlDataSource
> </res-type>
> <res-auth>
> Container
> </res-auth>
> </resource-ref>
>
> <resource-ref>
> <description>
> Resource reference to a factory for javax.mail.Session
> instances that may be used for sending electronic mail
> messages, preconfigured to connect to the appropriate
> SMTP server.
> </description>
> <res-ref-name>
> mail/Session
> </res-ref-name>
> <res-type>
> javax.mail.Session
> </res-type>
> <res-auth>
> Container
> </res-auth>
> </resource-ref>
>
> ---------------------------------------------
>
> My "struts-config.xml" file looks like this (the relevant parts):
>
> <data-sources>
>
> <data-source type="com.mysql.jdbc.jdbc2.optional.MysqlDataSource">
>
> <set-property property="autoCommit" value="true"/>
> <set-property property="description" value="MySql Data Source for
domain DB#1"/>
> <set-property property="driverClass" value="com.mysql.jdbc.Driver"/>
> <set-property property="minCount" value="2"/>
> <set-property property="maxCount" value="10"/>
> <set-property property="username" value="mydomain"/>
> <set-property property="password" value="**********"/>
> <set-property property="url"
value="jdbc:mysql://mysql:3306/mydomain?autoReconnect=true"/>
>
> </data-source>
>
> </data-sources>
>
> <form-beans>
>
> <form-bean
> name="logonForm"
> type="pu.strutsapp.actionform.LogonForm"/>
>
> </form-beans>
>
>
> <action-mappings>
>
> <action path="/LogonSubmit_FromMainPage"
> type="pu.strutsapp.action.LogonAction"
> name="logonForm"
> scope="session"
> validate="true"
> input="/pages/Logon.jsp">
>
> <forward name="success"
> path="/pages/WelcomeToANewSession.jsp"/>
> <forward name="fail"
> path="/pages/Logon_Failed.jsp"/>
>
> </action>
>
> </action-mappings>
>
> ---------------------------------------------
>
> My Tomcat "server.xml" file looks like this (the relevant parts):
>
> <Context className="org.apache.catalina.core.StandardContext"
cachingAllowed="true"
charsetMapperClass="org.apache.catalina.util.CharsetMapper" cookies="true"
crossContext="false" debug="0"
docBase="/usr/ngasi/contexts/mydomain/appservers/jakarta-tomcat-4.1.27/webap
ps/mydomain" mapperClass="org.apache.catalina.core.StandardContextMapper"
path="/mydomain" privileged="false" reloadable="false" swallowOutput="false"
useNaming="true" wrapperClass="org.apache.catalina.core.StandardWrapper">
> <Resource auth="Container" name="jdbc/mydatasource" scope="Shareable"
type="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"/>
> <Resource auth="Container" name="mail/Session" scope="Shareable"
type="javax.mail.Session"/>
> <ResourceParams name="jdbc/mydatasource">
> <parameter>
> <name>url</name>
> <value>jdbc:mysql://mysql:3306/mydomain?autoReconnect=true</value>
> </parameter>
> <parameter>
> <name>password</name>
> <value>********</value>
> </parameter>
> <parameter>
> <name>driverClassName</name>
> <value>com.mysql.jdbc.Driver</value>
> </parameter>
> <parameter>
> <name>username</name>
> <value>mydomain</value>
> </parameter>
> </ResourceParams>
> <ResourceParams name="mail/Session">
> <parameter>
> <name>mail.smtp.host</name>
> <value>localhost</value>
> </parameter>
> </ResourceParams>
> </Context>
>
> ---------------------------------------------
>
> Also, all my proper class files are in the WEB-INF/classes directory.
Only "struts.jar" and "struts-legacy.jar" are in WEB-INF/lib.
>
> So, where am I messing up? Should the data-source "auth" be "Container"?
Should I be using MysqlDataSourceFactory instead (I'm not sure how to do
that)? Anything else that might be wrong?
>
> Thanks for any suggestions or guesses.
>
>
> ____________________________________________________________
> Enter now for a chance to win a 42" Plasma Television!
>
http://ad.doubleclick.net/clk;6413623;3807821;f?http://mocda1.com/1/c/563632/113422/313631/313631
> AOL users go here:
http://ad.doubleclick.net/clk;6413623;3807821;f?http://mocda1.com/1/c/563632/113422/313631/313631
> This offer applies to U.S. Residents Only
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org