Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4901

ClassCastException in JarEntryRevision

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.5.14.1
    • 2.5.16
    • None
    • None
    • Websphere 8.5.5.12

    Description

      After upgrading to struts 2.5.14.1 we are unable to startup the application on websphere. The logs show class cast exceptions in the JarEntryRevision class:

      [12/7/17 16:50:18:323 EST] 00000502 JarEntryRevis W com.opensymphony.xwork2.util.fs.JarEntryRevision build Could not create JarEntryRevision for [wsjar:file:/icosdata/IBM/WebSphere/AppServer/profiles/CmpAppSrv01/installedApps/CMPDMDEVCell01/icos-dev.ear/icos-web.war/WEB-INF/lib/struts2-core-2.5.14.1.jar!/struts-default.xml]!
                                       java.lang.ClassCastException: com.ibm.ws.classloader.Handler$ClassLoaderURLConnection incompatible with java.net.JarURLConnection
          at com.opensymphony.xwork2.util.fs.JarEntryRevision.build(JarEntryRevision.java:44)
          at com.opensymphony.xwork2.util.fs.DefaultFileManager.monitorFile(DefaultFileManager.java:94)
          at com.opensymphony.xwork2.util.fs.DefaultFileManager.loadFile(DefaultFileManager.java:73)
          at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:1054)
          at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:198)
          at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:165)
          at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:166)
          at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
          at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:957)
          at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:463)
          at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:496)
          at org.apache.struts2.dispatcher.InitOperations.initDispatcher(InitOperations.java:73)
          at org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:61)
          at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:145)
          at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:607)
          at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:514)
          at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:319)
          at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:392)
          at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:931)
          at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1107)
          at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3980)
          at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
          at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1016)
          at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
          at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
          at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463)
          at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530)
          at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316)
          at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:287)
          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:175)
          at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
          at com.ibm.io.async.AsyncChannelFuture$1.run(AsyncChannelFuture.java:205)
          at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1892)
      

      We took a look at tracked it down to WW-4869 which modified the code to cast to JarURLConnection:

       JarURLConnection conn = null;
              try {
                  conn = (JarURLConnection) fileUrl.openConnection();
      ...
      

      Unfortunately the URLConnection in websphere doesn't inherit from JarURLConnection:

      static class ClassLoaderURLConnection extends URLConnection { ... }
      

      Attachments

        Issue Links

          Activity

            People

              yasserzamani Yasser Zamani
              MichaelHum Michael Hum
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: