• Post Reply Bookmark Topic Watch Topic
  • New Topic

struts problem  RSS feed

 
jameel ahmed
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi i am having getting the error message like
javax.servlet.ServletException: Servlet.init() for servlet action threw exception
org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:66)
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:150)
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:54)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
java.lang.Thread.run(Thread.java:534)

root cause

java.lang.NoClassDefFoundError: org/apache/struts/util/GenericDataSource
org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:1082)
org.apache.struts.action.ActionServlet.init(ActionServlet.java:471)
javax.servlet.GenericServlet.init(GenericServlet.java:211)
org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:66)
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:150)
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:54)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
java.lang.Thread.run(Thread.java:534)

AND MY struts-config.xml is as follows.............
<?xml version="1.0" encoding="ISO-8859-1" ?>



<!DOCTYPE struts-config PUBLIC

"-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"

"http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">



<struts-config>

<data-sources>

<!-- configuration for commons BasicDataSource -->
<data-source type="org.apache.commons.dbcp.BasicDataSource">

<set-property property="description" value="My MySQL Database Connection" />
<set-property property="driverClassName" value="com.mysql.jdbc.Driver" />
<set-property property="url" value="jdbc:mysql://localhost:3306/test" />
<set-property property="username" value="" />
<set-property property="password" value="" />
<set-property property="maxActive" value="10" />
<set-property property="maxWait" value="5000" />
<set-property property="defaultAutoCommit" value="false" />
<set-property property="defaultReadOnly" value="false" />
</data-source>
</data-sources>






<form-beans>

<form-bean name="employeeForm"

type="com.strutsapplication.EmployeeForm"/>

</form-beans>



<action-mappings>

<action path="/Add"

type="com.strutsapplication.AddEmployeeAction"

name="employeeForm"
scope = "request"

validate="no"

unknown="true">

<forward name="success" path="/result.jsp" />
<forward name="error" path="/fail.jsp" />



</action>
<action path="/Test"

type="com.strutsapplication.TestAction"

name="employeeForm"
scope = "request"

validate="no"

unknown="true">

<forward name="success" path="/result.jsp" />
<forward name="error" path="/fail.jsp" />



</action>


</action-mappings>

</struts-config>


and i have kept all the jar files...
commons-dbcp
commons-pool
jboss-common-jdbc-wrapper
jdbc2_0-stdext
struts
mysql-connector-java-3.0.9-stable-bin
and many more..........
and i getting the error and the all the file are correctely placed...
but i am not understading what to do
reply soon
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll give you the same advice I give everyone who has a Struts dataSource problem: Don't use it.

In my experience, you're much better off defining the dataSource in your application server. The implementation details of a datasource must ultimately be handled by the Application Server. Struts has attempted to create a generic dataSource definition that will work on all App Servers, but the problem is that each Application server has it's little quirks and special requirements (e.g. Where to put the Driver jar file?) Since you appear to be using JBoss, Check the JBoss doucmentation on how to set up a datasource for MYSQL.
[ January 23, 2006: Message edited by: Merrill Higginson ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!