You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by john lee <sh...@yahoo.com> on 2013/03/05 23:35:36 UTC

Struts 2 -> java.lang.ClassNotFoundException

 
 I use struts at webserver, and create proxy action , that proxy action forward to spring, but when executed result is the following
 
please advise
 
thanks in advance
 
john
 
[CODE]
Struts Problem Report
Struts has detected an unhandled exception: 
Messages: loginAction 
Invalid action class configuration that references an unknown class named [loginAction] 
Stacktraces
java.lang.RuntimeException: Invalid action class configuration that references an unknown class named [loginAction] 
java.lang.ClassNotFoundException: loginAction 
[/CODE]
 
[CODE]
  alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce # cat login.jsp
<s:actionerror/>
<s:form action="login">
<s:textfield name="loginId" label="login"/>
<s:textfield name="password" label="password"/>
<s:submit value="logint"/>
</s:form>
[/CODE]
 
[CODE]
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF # cat web.xml
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<context-param> 
  <param-name>contextConfigLocation</param-name> 
  <param-value>/WEB-INF/applicationContext.xml</param-value> 
</context-param> 
</web-app>
[/CODE]

[CODE]
   alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/classes # cat struts.xml
   
<struts>
  <include file="struts-default.xml"/>
  <constant name="struts.enable.DynamicMethodInvocation" value="false" />
  <constant name="struts.devMode" value="true" />
  <constant name="struts.objectFactory" value="spring" />
  <package name="default" extends="struts-default">
                 <action name="login" class="loginAction">
                    <result name="success">success.jsp</result>
                    <result name="error">error.jsp</result>
                </action>
 </package>
</struts>[/CODE]
 
 
[CODE]
   alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF # cat applicationContext.xml
    
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  <property name="dataSource" ref="dataSource"/>
  <property name="mappingResources">
    <list>
        <value>Acctsecurity.hbm.xml</value>
    </list>
  </property>
   </bean>   
<bean id="loginAction" class="neuco.AcctAction" scope="prototype">
    <property name="mgr" ref="acctmgr"/>
</bean>

<bean id="acctsecurityDao" class="neuco.AcctsecurityDaoHibernate">
    <property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="acctmgr" class="neuco.AcctManagerImpl">
    <property name="acctsecurityDao" ref="acctsecurityDao"/>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
     <property name="sessionFactory" ref="sessionFactory"/>
</bean>
<tx:advice id="txAdvice" transaction-manager="transactionManager"> 
  <tx:attributes>
     <tx:method name="get*" read-only="true"/>
     <tx:method name="*"/>
  </tx:attributes>
</tx:advice>
<aop:config>
   <aop:pointcut id="leePointcut" expression="execution(* neuco.*Impl.*(..))"/>
   <aop:advisor advice-ref="txAdvice" pointcut-ref="leePointcut"/>
</aop:config>
</beans>
[/CODE]
 
[CODE]
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/classes/neuco # ls *.class
AcctAction.class   AcctManagerImpl.class  AcctsecurityDao.class
AcctManager.class  Acctsecurity.class     AcctsecurityDaoHibernate.class
[/CODE]

Re: Struts 2 -> java.lang.ClassNotFoundException

Posted by René Gielen <gi...@it-neering.net>.
John,

please ask support questions like this in the Struts user list.
This list is for development of the framework itself.
See http://struts.apache.org/mail.html

Thanks,
René



john lee <sh...@yahoo.com> schrieb:

> 
> I use struts at webserver, and create proxy action , that proxy action
>forward to spring, but when executed result is the following
> 
>please advise
> 
>thanks in advance
> 
>john
> 
>[CODE]
>Struts Problem Report
>Struts has detected an unhandled exception: 
>Messages: loginAction 
>Invalid action class configuration that references an unknown class
>named [loginAction] 
>Stacktraces
>java.lang.RuntimeException: Invalid action class configuration that
>references an unknown class named [loginAction] 
>java.lang.ClassNotFoundException: loginAction 
>[/CODE]
> 
>[CODE]
>  alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce # cat login.jsp
><s:actionerror/>
><s:form action="login">
><s:textfield name="loginId" label="login"/>
><s:textfield name="password" label="password"/>
><s:submit value="logint"/>
></s:form>
>[/CODE]
> 
>[CODE]
>alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF # cat web.xml
><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>xmlns="http://java.sun.com/xml/ns/javaee"
>xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
>xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
>version="2.5">
><filter>
><filter-name>struts2</filter-name>
><filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
></filter>
><listener>
><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
></listener>
><filter-mapping>
><filter-name>struts2</filter-name>
><url-pattern>/*</url-pattern>
></filter-mapping>
><context-param> 
>  <param-name>contextConfigLocation</param-name> 
>  <param-value>/WEB-INF/applicationContext.xml</param-value> 
></context-param> 
></web-app>
>[/CODE]
>
>[CODE]
>   alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/classes #
>cat struts.xml
>   
><struts>
>  <include file="struts-default.xml"/>
>  <constant name="struts.enable.DynamicMethodInvocation" value="false"
>/>
>  <constant name="struts.devMode" value="true" />
>  <constant name="struts.objectFactory" value="spring" />
>  <package name="default" extends="struts-default">
>                 <action name="login" class="loginAction">
>                    <result name="success">success.jsp</result>
>                    <result name="error">error.jsp</result>
>                </action>
> </package>
></struts>[/CODE]
> 
> 
>[CODE]
>   alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF # cat
>applicationContext.xml
>    
><bean id="sessionFactory"
>class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
>  <property name="dataSource" ref="dataSource"/>
>  <property name="mappingResources">
>    <list>
>        <value>Acctsecurity.hbm.xml</value>
>    </list>
>  </property>
>   </bean>   
><bean id="loginAction" class="neuco.AcctAction" scope="prototype">
>    <property name="mgr" ref="acctmgr"/>
></bean>
>
><bean id="acctsecurityDao" class="neuco.AcctsecurityDaoHibernate">
>    <property name="sessionFactory" ref="sessionFactory"/>
></bean>
><bean id="acctmgr" class="neuco.AcctManagerImpl">
>    <property name="acctsecurityDao" ref="acctsecurityDao"/>
></bean>
><bean id="transactionManager"
>class="org.springframework.orm.hibernate3.HibernateTransactionManager">
>     <property name="sessionFactory" ref="sessionFactory"/>
></bean>
><tx:advice id="txAdvice" transaction-manager="transactionManager"> 
>  <tx:attributes>
>     <tx:method name="get*" read-only="true"/>
>     <tx:method name="*"/>
>  </tx:attributes>
></tx:advice>
><aop:config>
>   <aop:pointcut id="leePointcut" expression="execution(*
>neuco.*Impl.*(..))"/>
>   <aop:advisor advice-ref="txAdvice" pointcut-ref="leePointcut"/>
></aop:config>
></beans>
>[/CODE]
> 
>[CODE]
>alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/classes/neuco
># ls *.class
>AcctAction.class   AcctManagerImpl.class  AcctsecurityDao.class
>AcctManager.class  Acctsecurity.class    
>AcctsecurityDaoHibernate.class
>[/CODE]

-- 
http://twitter.com/rgielen
Sent from my mobile, please excuse brevity