2

I'm running weblogic 10.3.5 with mavenized struts 2/spring application. the application runs fine when published to server via eclipse but when i export the application to a .war file and deploy via the admin console and run it it gives me error with following stacktrace.

[[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'] WARN org.apache.struts2.dispatcher.Dispatcher - Could not find action or result: /eServices/login.action There is no Action mapped for namespace [/] and action name [login] associated with context path [/eServices]. - [unknown location] at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185) at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63) at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:37) at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:552) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111) at java.security.AccessController.doPrivileged(Native Method) at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313) at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413) at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94) at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161) at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209) at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)

I found couple posts suggesting to add struts.properties file with following configurations in my class-path but did not solve my issue.

struts.convention.action.mapAllMatches = true struts.convention.action.includeJars=.?/eServices.?jar(!/)? struts.convention.action.fileProtocols=jar,zip

any help to understand or fix this issue would be great! :)

following is my struts.xml, I have used annotation based configuration for mapping the actions to its results.

<!-- Struts Constants that override the struts.properties file -->
<constant name="struts.devMode" value="false" />
<constant name="struts.custom.i18n.resources" value="global" />
<constant name="struts.ui.theme" value="simple" />
<!-- <constant name="struts.ui.theme" value="css_xhtml" /> -->

following is the web.xml:

<display-name>eServices</display-name>
<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <!-- Needed to manage the Java based @Configuration classes for Spring -->
    <context-param>
        <param-name>contextClass</param-name>
        <param-value>
         org.springframework.web.context.support.AnnotationConfigWebApplicationContext
        </param-value>
    </context-param>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>com.ceiwc.es.config</param-value>
    </context-param>

    <!-- Handles Strut2 URL requests -->
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
Roman C
  • 49,761
  • 33
  • 66
  • 176
Gurkha
  • 1,104
  • 4
  • 20
  • 37
  • i have updated the post with struts.xml. I would like to iterate that i have used annotation based configuration so i dont have much on this file. @AndreaLigios – Gurkha Jun 04 '14 at 15:31
  • Please, show your web.xml too... and the login.java / .class position in your directory tree – Andrea Ligios Jun 04 '14 at 15:51
  • @AndreaLigios I have again updated with web.xml. Login.java is inside src/main/java -->com.packagename -->Login.java. There must be some kind of weblogic configuration somewhere since the application runs fine when deployed via eclipse. – Gurkha Jun 04 '14 at 16:44
  • It is not clear to me if you are trying to use Convention plugin (Struts2 annotations) or Spring stuff to instantiate Actions. In both cases there may be missing pieces: with convention, you may need a package named struts, struts2, action, or actions to be considered the root folder for annotation scanning; with Spring, I've always seen struts2 actions managed by Spring in another way, and eventually instantiated in another further way... (you can find them on SO). Please clarify the question to get a better help... +1 for the effort btw – Andrea Ligios Jun 05 '14 at 08:18
  • hello @AndreaLigios all the actions are instantiated and managed by spring. I so far as i know the only struts2 annotations used are `@action` and `@results` to define action and their respective results and `@Namespace` to define the namespace for the action. – Gurkha Jun 05 '14 at 13:22

1 Answers1

1

Here is the solution that finally worked! I added the following Struts2 properties:

<constant name="struts.convention.action.includeJars" value=".*?\.jar(!/|/)?" />
<constant name="struts.convention.action.fileProtocols" value="jar,zip" />

This was based on what I found in this post.

Also, what also may help is adding this property to weblogic.xml:

<wls:container-descriptor>
    <wls:prefer-web-inf-classes>true</wls:prefer-web-inf-classes>
</wls:container-descriptor>
Gurkha
  • 1,104
  • 4
  • 20
  • 37