Devendra

 

did you contact the local struts resource as suggested..?

Martin--
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung


Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.

 

> Date: Fri, 21 May 2010 19:53:42 -0700
> From: devendra_tiwari12...@yahoo.com
> To: user@struts.apache.org
> Subject: Re: Struts2+Spring2+Interceptor+Invalid action class configuration 
> that references an unknown class named
> 
> 
> 
> 
> > 
> > Hantsy Bai-2 wrote:
> >> 
> >> 于 2010/5/22 1:05, rocks 写道:
> >>> Dear,
> >>>
> >>> Apologize the posting same subject, but I did not find any solution so
> >>> far.
> >>> I am developing a web application based on struts 2.1.8.1+ spring 2+
> >>> hibernate 3 + tomcat 5.5. There is requisite library like
> >>> struts2-convention-plugin-2.1.8.1.jar in my classpath.
> >>>
> >>> For authentication I am using struts interceptor.
> >>> Below are my configuration files.
> >>>
> >>> struts.xml :=
> >>>
> >>> <?xml version="1.0" encoding="UTF-8" ?>
> >>> <!DOCTYPE struts PUBLIC
> >>> "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
> >>> "http://struts.apache.org/dtds/struts-2.0.dtd";>
> >>>
> >>>
> >>> <struts>
> >>> <constant name="struts.objectFactory" value="spring" />
> >>> <constant name="struts.devMode" value="false" />
> >>> <constant name="struts.action.extension" value="do"/>
> >>> <constant name="struts.objectFactory.spring.autoWire"
> >>> value="AUTOWIRE_BY_NAME"/>
> >>>
> >>> <!-- Add packages here -->
> >>> <package name="dafault" extends="struts-default">
> >>> 
> >>> <result-types>
> >>> <result-type name="tiles"
> >>> class="org.apache.struts2.views.tiles.TilesResult" />
> >>> </result-types>
> >>> 
> >>> <interceptors>
> >>> <interceptor name="loginInterceptor"
> >>> class="com.ncr.framework.interceptor.LoginInterceptor"/>
> >>>
> >>> <interceptor-stack name="capabilityStack">
> >>> <interceptor-ref name="defaultStack"/>
> >>> <interceptor-ref name="loginInterceptor"/>
> >>> </interceptor-stack>
> >>> 
> >>> </interceptors>
> >>>
> >>> <default-interceptor-ref name="capabilityStack"/>
> >>> 
> >>> <action name="logon" class="loginAction" method="execute">
> >>> <result name="success" type="tiles">page.Login</result>
> >>> </action>
> >>> </package>
> >>> </struts>
> >>>
> >>> applicationContext.xml :-
> >>>
> >>> <?xml version="1.0" encoding="UTF-8"?>
> >>> <!DOCTYPE beans SYSTEM "WEB-INF/spring-beans-2.0.dtd">
> >>> <beans>
> >>> <bean id="loginAction" scope="prototype"
> >>> class="com.ncr.user.actions.LoginAction">
> >>> <constructor-arg ref="adminService" />
> >>> </bean>
> >>> </beans>
> >>>
> >>> LoginInterceptor.java
> >>>
> >>> public class LoginInterceptor extends AbstractInterceptor {
> >>> public String intercept(ActionInvocation invocation) throws Exception {
> >>> ActionContext context = invocation.getInvocationContext();
> >>> Map<String, Object> contextMap = context.getContextMap();
> >>> HttpServletRequestWrapper request = (HttpServletRequestWrapper)
> >>> contextMap
> >>> .get(HTTP_REQUEST);
> >>> synchronized (request) {
> >>> ThreadContext.setRequest(request);
> >>> UserInfo userInfo = UserContext.getCurrentUserInfo();
> >>>
> >>> if (userInfo == null
> >>> && !"authenticate".equals(contextMap.get(ACTION_NAME))) {
> >>> return "logon";
> >>> }
> >>> return invocation.invoke();
> >>> }
> >>> }}
> >>>
> >>> When I hit url http://localhost:8080/mytest/logon.do it throws an error.
> >>>
> >>> java.lang.RuntimeException: Invalid action class configuration that
> >>> references an unknown class named [loginAction]
> >>>
> >>> org.apache.struts2.convention.ConventionsServiceImpl.determineResultPath(ConventionsServiceImpl.java:100)
> >>>
> >>> org.apache.struts2.convention.ConventionUnknownHandler.determinePath(ConventionUnknownHandler.java:385)
> >>>
> >>> org.apache.struts2.convention.ConventionUnknownHandler.handleUnknownResult(ConventionUnknownHandler.java:274)
> >>>
> >>> com.opensymphony.xwork2.DefaultUnknownHandlerManager.handleUnknownResult(DefaultUnknownHandlerManager.java:76)
> >>>
> >>> com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActionInvocation.java:215)
> >>>
> >>> com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:356)
> >>>
> >>> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:266)
> >>>
> >>> com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)
> >>>
> >>>
> >>> As per my investigation, I found that ClassLoaderUtils's below method
> >>> could
> >>> not return class name for 'loginAction'. There should be some way for to
> >>> map
> >>> 'loginAction' to the class com.ncr.user.actions.LoginAction.
> >>>
> >>> public static Class loadClass(String className, Class callingClass)
> >>> throws ClassNotFoundException {
> >>> try {
> >>> 
> >>> return Thread.currentThread().getContextClassLoader().loadClass(
> >>> className);
> >>> } catch (ClassNotFoundException e) {
> >>> try {
> >>> return Class.forName(className);
> >>> } catch (ClassNotFoundException ex) {
> >>> try {
> >>> return ClassLoaderUtils.class.getClassLoader().loadClass(
> >>> className);
> >>> } catch (ClassNotFoundException exc) {
> >>> return callingClass.getClassLoader().loadClass(className);
> >>> }
> >>> }
> >>> }
> >>> }
> >>>
> >>> When I remove the entry '<default-interceptor-ref
> >>> name="capabilityStack"/>'
> >>> from struts.xml then it's working perfectly fine i.e desired page is
> >>> coming.
> >>>
> >>> I also noticed that in the classes variable of
> >>> Thread.currentThread().getContextClassLoader()(WebappClassLoader) which
> >>> is
> >>> private contains class com.ncr.user.actions.LoginAction but i did not
> >>> find
> >>> any way to get it.
> >>>
> >>> Your kind guesture is appreciated.
> >>>
> >>> -Dev
> >>> 
> >> Convention plugin provide annotation configration for struts2 instead of 
> >> the XML configuration.
> >> But it is optional, if you do not use it, there is no need add it to 
> >> your project. From you provided, I do not know the content of
> >> LoginAction.
> >> 
> >> 
> >> 
> >> 
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> >> For additional commands, e-mail: user-h...@struts.apache.org
> >> 
> >> 
> >> 
> > 
> > Thanks Hantsy for quick reply. Right now I want to work with XML, may be
> > switch to annotations later. FYI, when I don't use interceptor it's workly
> > perfectly. so it seems there is disconnect with spring object factory and
> > ClassLoaderUtils.
> > 
> > Here is content of LoginAction.
> > 
> > package com.ncr.user.actions;
> > 
> > import com.ncr.ncr.module.IAdminModule;
> > import com.ncr.user.forms.UserForm;
> > import com.opensymphony.xwork2.ActionSupport;
> > 
> > public class LoginAction extends ActionSupport {
> > public LoginAction(IAdminModule adminModule) {
> > this.adminModule = adminModule;
> > userForm = new UserForm();
> > }
> > 
> > private UserForm userForm = null;
> > 
> > private IAdminModule adminModule = null;
> > 
> > public UserForm getUserForm() {
> > return userForm;
> > }
> > 
> > public String execute() throws Exception {
> > System.out.println("hello execute");
> > return SUCCESS;
> > }
> > }
> > 
> -- 
> View this message in context: 
> http://old.nabble.com/Struts2%2BSpring2%2BInterceptor%2BInvalid-action-class-configuration-that-references-an-unknown-class-named-tp28636590p28640776.html
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
                                          
_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your 
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

Reply via email to