Struts 2
  1. Struts 2
  2. WW-2999

Convention plugin and jar scanning failing on Websphere

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.1.6
    • Fix Version/s: 2.1.8
    • Component/s: Plugin - Convention
    • Labels:
      None
    • Environment:

      Websphere 6.1

      Description

      Hi,

      I am upgrading an existing project from struts 2.0.14 to 2.1.6. We are using the zero configuration approach, and the classpath scanning ability.

      The application is running on Websphere 6.1, and I had a lot of trouble having it work. My 2 major issues were :

      • Classes of the current project not being scanned : This url file:/C:/Program Files/IBM/WebSphere/AppServer/profiles/AppSrv02/installedApps/F6FMSWASTSTNode02Cell/fms-ear.ear/fms-web.war/WEB-INF/classes/ was originally excluded by the filters in the convention plugin. I'll let you know exactly which one did that
      • We had some action classes in a dependency jar, and it didn't get included because of the wsjar protocol. See http://jira.opensymphony.com/browse/XW-669 for more documentation on this protocol and its inclusion in Xwork. The url look like :
        wsjar:file:/C:/Program Files/IBM/WebSphere/AppServer/profiles/AppSrv02/installedApps/F6FMSWASTSTNode02Cell/fms-ear.ear/fms-web.war/WEB-INF/lib/axis-1.4.jar!/
        And are not processed by com.opensymphony.xwork2.util.finder.ClassFinder.

      I'll add more detail as I dig into this and let you know how I worked around it (except by moving to a real application server.... )

        Activity

        Hide
        musachy added a comment -

        A new setting was added to convention in trunk (you would have to build it yourself):

        <constant name="struts.convention.action.fileProtocols" value="jar" />

        you can add wsjar like:

        <constant name="struts.convention.action.fileProtocols" value="jar,wsjar" />

        to make Convention recognize those files, I haven't been able to test it in Websphere, could you please test it and report back?

        Show
        musachy added a comment - A new setting was added to convention in trunk (you would have to build it yourself): <constant name="struts.convention.action.fileProtocols" value="jar" /> you can add wsjar like: <constant name="struts.convention.action.fileProtocols" value="jar,wsjar" /> to make Convention recognize those files, I haven't been able to test it in Websphere, could you please test it and report back?
        Hide
        musachy added a comment -
        Show
        musachy added a comment - You can also grab a snapshot: http://people.apache.org/builds/struts/nightlies/2.x/
        Hide
        Denis Cabasson added a comment -

        So the thing breaking on the first point was the line :

        urlSet = urlSet.excludeJavaEndorsedDirs();
        

        The system variable was empty "", and that messed up the classpath. Commenting out this line re-established the expected behaviour.

        Show
        Denis Cabasson added a comment - So the thing breaking on the first point was the line : urlSet = urlSet.excludeJavaEndorsedDirs(); The system variable was empty "", and that messed up the classpath. Commenting out this line re-established the expected behaviour.
        Hide
        musachy added a comment - - edited

        This was fixed in XWork trunk. See: http://jira.opensymphony.com/browse/XW-675

        Show
        musachy added a comment - - edited This was fixed in XWork trunk. See: http://jira.opensymphony.com/browse/XW-675
        Hide
        Andrew Cooper added a comment -

        Do you not think it may be a good idea to have real cross compatibility and utilise the getResourceAsStream() method to resolve classes instead of getResource().

        I have raise another JIRA in the xwork project (http://jira.opensymphony.com/browse/XW-678) to acknowledge this fact.

        Overall surely it would probably be a better solution to make the software truly cross container compatible?

        Show
        Andrew Cooper added a comment - Do you not think it may be a good idea to have real cross compatibility and utilise the getResourceAsStream() method to resolve classes instead of getResource(). I have raise another JIRA in the xwork project ( http://jira.opensymphony.com/browse/XW-678 ) to acknowledge this fact. Overall surely it would probably be a better solution to make the software truly cross container compatible?
        Hide
        musachy added a comment -

        If you have a patch that makes it work, and you can share it, it would be great. thanks.

        Show
        musachy added a comment - If you have a patch that makes it work, and you can share it, it would be great. thanks.
        Hide
        Kobe Nys added a comment -

        When I run my code on rational 7.5.1 and I publish (to WAS 6.1) my application with resources within workspace (minimize application files copied to the server option on) rather then copy resources to server, I get this exception:

        [9/03/09 13:56:47:250 CET] 0000002a WebApp E [Servlet Error]-[Filter [struts2]: could not be initialized]: Unable to load configuration. - Class: java.io.File
        File: File.java
        Method: <init>
        Line: 362 - java/io/File.java:362:-1
        at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
        at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:360)
        at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:403)
        at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
        at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:48)
        at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:142)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:471)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:385)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:244)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:302)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:792)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:742)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:695)
        at com.ibm.ws.wswebcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:101)
        at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.invokeFilters(DefaultExtensionProcessor.java:818)
        at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:768)
        at com.ibm.ws.wswebcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:113)
        at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3440)
        at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:267)
        at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:815)
        at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1461)
        at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:118)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:267)
        at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
        at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
        at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
        at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
        at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
        at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
        at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
        at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)
        at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
        at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
        Caused by: Caught exception while loading file struts-default.xml - Class: java.io.File
        File: File.java
        Method: <init>
        Line: 362 - java/io/File.java:362:-1
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:894)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:144)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:111)
        at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:164)
        at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
        ... 34 more
        Caused by: java.lang.IllegalArgumentException: URI is not hierarchical
        at java.io.File.<init>(File.java:362)
        at com.opensymphony.xwork2.util.FileManager$FileRevision.build(FileManager.java:191)
        at com.opensymphony.xwork2.util.FileManager.loadFile(FileManager.java:126)
        at com.opensymphony.xwork2.util.FileManager.loadFile(FileManager.java:89)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:879)
        ... 38 more

        Show
        Kobe Nys added a comment - When I run my code on rational 7.5.1 and I publish (to WAS 6.1) my application with resources within workspace (minimize application files copied to the server option on) rather then copy resources to server, I get this exception: [9/03/09 13:56:47:250 CET] 0000002a WebApp E [Servlet Error] -[Filter [struts2] : could not be initialized]: Unable to load configuration. - Class: java.io.File File: File.java Method: <init> Line: 362 - java/io/File.java:362:-1 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:360) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:403) at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:48) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:142) at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:471) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:385) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:244) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:302) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:792) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:742) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:695) at com.ibm.ws.wswebcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:101) at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.invokeFilters(DefaultExtensionProcessor.java:818) at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:768) at com.ibm.ws.wswebcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:113) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3440) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:267) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:815) at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1461) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:118) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:267) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136) at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195) at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743) at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473) Caused by: Caught exception while loading file struts-default.xml - Class: java.io.File File: File.java Method: <init> Line: 362 - java/io/File.java:362:-1 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:894) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:144) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:111) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:164) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55) ... 34 more Caused by: java.lang.IllegalArgumentException: URI is not hierarchical at java.io.File.<init>(File.java:362) at com.opensymphony.xwork2.util.FileManager$FileRevision.build(FileManager.java:191) at com.opensymphony.xwork2.util.FileManager.loadFile(FileManager.java:126) at com.opensymphony.xwork2.util.FileManager.loadFile(FileManager.java:89) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:879) ... 38 more
        Hide
        musachy added a comment -

        Kobe, can you try using a recent xwork snapshot, or building xwork by yourself?

        Show
        musachy added a comment - Kobe, can you try using a recent xwork snapshot, or building xwork by yourself?
        Show
        Kobe Nys added a comment - I used the version @ http://people.apache.org/builds/struts/nightlies/2.x/struts-2.1.7-SNAPSHOT-all-200903081615.zip
        Hide
        musachy added a comment -

        Thanks Kobe. Can you debug the app at all? can you set a breakpoint at com.opensymphony.xwork2.util.FileManager$FileRevision.build(FileManager.java:191) and post what the fileUrl looks like?

        Show
        musachy added a comment - Thanks Kobe. Can you debug the app at all? can you set a breakpoint at com.opensymphony.xwork2.util.FileManager$FileRevision.build(FileManager.java:191) and post what the fileUrl looks like?
        Hide
        Kobe Nys added a comment - - edited
        Show
        Kobe Nys added a comment - - edited All my jars are inside my EAR project and I get: wsjar: file:/C:/workspacePath/EarProject/struts2-core-2.1.7-SNAPSHOT.jar!/struts-default.xml
        Hide
        musachy added a comment -

        We are talking about 2 different problems here. The original problem is fixed in http://jira.opensymphony.com/browse/XW-675. That's why I am closing the ticket. The other problem is being tracked here: http://jira.opensymphony.com/browse/XW-678

        Show
        musachy added a comment - We are talking about 2 different problems here. The original problem is fixed in http://jira.opensymphony.com/browse/XW-675 . That's why I am closing the ticket. The other problem is being tracked here: http://jira.opensymphony.com/browse/XW-678

          People

          • Assignee:
            Unassigned
            Reporter:
            Denis Cabasson
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development