StripesFramework / stripes

Stripes is a Java framework with the goal of making Servlet/JSP based web development in Java as easy, intuitive and straight-forward as it should be. It's stripey and it doesn't suck.
http://www.stripesframework.org/
172 stars 72 forks source link

Stripes 1.6.0 will not run in a WebSphere Liberty #57

Open NiklasA opened 8 years ago

NiklasA commented 8 years ago

Hi,

I just included Stripes into my JEE application but every time I will get this error message during start up. I am using a WebSphere Application Server 8.5.5.X. I am searching for awhile now and I've heard that there are some troubles with IBM WebSphere in combination with the Stripes Framework. Is there anyone, who get a JEE application running in a similar combination or know what I have to consider?

Error Log:

    [5/9/16 21:59:39:743 CEST] 00000079 com.ibm.ws.webcontainer.servlet                              I SRVE0242I: [skillDB-ear-0.0.1] [/skillDB] [StripesDispatcher]: Initialization successful.
    [5/9/16 21:59:39:810 CEST] 00000079 com.ibm.ws.webcontainer.filter                               E SRVE0321E: The [StripesFilter] filter did not load during start up.
    javax.servlet.ServletException: Filter [StripesFilter]: could not be initialized
        at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:163)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:655)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:518)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.init(WebAppFilterManager.java:246)
        at com.ibm.ws.webcontainer.osgi.webapp.WebApp.initializeFilterManager(WebApp.java:854)
        at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinally(WebApp.java:1164)
        at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:1053)
        at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6463)
        at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:446)
        at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.createRunnableHandler(DynamicVirtualHost.java:248)
        at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.createRunnableHandler(DynamicVirtualHost.java:313)
        at com.ibm.ws.http.internal.VirtualHostImpl.discriminate(VirtualHostImpl.java:251)
        at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:306)
        at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:471)
        at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:405)
        at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:285)
        at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:256)
        at com.ibm.ws.channel.ssl.internal.SSLConnectionLink.determineNextChannel(SSLConnectionLink.java:1037)
        at com.ibm.ws.channel.ssl.internal.SSLConnectionLink$MyReadCompletedCallback.complete(SSLConnectionLink.java:626)
        at com.ibm.ws.channel.ssl.internal.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1777)
        at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:504)
        at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:574)
        at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:929)
        at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:1018)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: net.sourceforge.stripes.exception.StripesServletException: Could not instantiate specified Configuration. Class name specified was [net.sourceforge.stripes.config.RuntimeConfiguration].
        at net.sourceforge.stripes.controller.StripesFilter.createConfiguration(StripesFilter.java:145)
        at net.sourceforge.stripes.controller.StripesFilter.init(StripesFilter.java:103)
        at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:149)
        ... 26 more
    Caused by: net.sourceforge.stripes.exception.StripesRuntimeException: Problem instantiating default configuration objects.
        at net.sourceforge.stripes.config.DefaultConfiguration.init(DefaultConfiguration.java:245)
        at net.sourceforge.stripes.config.RuntimeConfiguration.init(RuntimeConfiguration.java:291)
        at net.sourceforge.stripes.controller.StripesFilter.createConfiguration(StripesFilter.java:137)
        ... 28 more
    Caused by: java.lang.NullPointerException
    [5/9/16 21:59:39:813 CEST] 00000079 com.ibm.ws.webcontainer.filter                               E SRVE0321E: The [StripesFilter] filter did not load during start up.
    javax.servlet.ServletException: Filter [StripesFilter]: could not be initialized
        at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:163)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:655)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:518)
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.init(WebAppFilterManager.java:246)
        at com.ibm.ws.webcontainer.osgi.webapp.WebApp.initializeFilterManager(WebApp.java:854)
        at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinally(WebApp.java:1164)
        at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:1053)
        at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6463)
        at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:446)
        at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.createRunnableHandler(DynamicVirtualHost.java:248)
        at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.createRunnableHandler(DynamicVirtualHost.java:313)
        at com.ibm.ws.http.internal.VirtualHostImpl.discriminate(VirtualHostImpl.java:251)
        at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:306)
        at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:471)
        at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:405)
        at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:285)
        at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:256)
        at com.ibm.ws.channel.ssl.internal.SSLConnectionLink.determineNextChannel(SSLConnectionLink.java:1037)
        at com.ibm.ws.channel.ssl.internal.SSLConnectionLink$MyReadCompletedCallback.complete(SSLConnectionLink.java:626)
        at com.ibm.ws.channel.ssl.internal.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1777)
        at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:504)
        at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:574)
        at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:929)
        at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:1018)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: net.sourceforge.stripes.exception.StripesServletException: Could not instantiate specified Configuration. Class name specified was [net.sourceforge.stripes.config.RuntimeConfiguration].
        at net.sourceforge.stripes.controller.StripesFilter.createConfiguration(StripesFilter.java:145)
        at net.sourceforge.stripes.controller.StripesFilter.init(StripesFilter.java:103)
        at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:149)
        ... 26 more
    Caused by: net.sourceforge.stripes.exception.StripesRuntimeException: Problem instantiating default configuration objects.
        at net.sourceforge.stripes.config.DefaultConfiguration.init(DefaultConfiguration.java:245)
        at net.sourceforge.stripes.config.RuntimeConfiguration.init(RuntimeConfiguration.java:291)
        at net.sourceforge.stripes.controller.StripesFilter.createConfiguration(StripesFilter.java:137)
        ... 28 more
    Caused by: java.lang.NullPointerException

Web.xml:

    [...]
    <filter>
        <display-name>Stripes Filter</display-name>
        <filter-name>StripesFilter</filter-name>
        <filter-class>net.sourceforge.stripes.controller.StripesFilter</filter-class>

        <init-param>
            <param-name>ActionResolver.Packages</param-name>
            <param-value>de.fom.skillDB.war.actionbeans</param-value>
        </init-param>
    </filter>

    <filter-mapping>
        <filter-name>StripesFilter</filter-name>
        <url-pattern>*.jsp</url-pattern>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>

    <filter-mapping>
        <filter-name>StripesFilter</filter-name>
        <servlet-name>StripesDispatcher</servlet-name>
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping>

    <servlet>
        <servlet-name>StripesDispatcher</servlet-name>
        <servlet-class>net.sourceforge.stripes.controller.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>StripesDispatcher</servlet-name>
        <url-pattern>*.action</url-pattern>
    </servlet-mapping>

Server.xml(including all WebSphere features):

    <feature>appSecurity-2.0</feature>
    <feature>servlet-3.1</feature>
    <feature>jaxrs-2.0</feature>
    <feature>localConnector-1.0</feature>
    <feature>jdbc-4.1</feature>
    <feature>jpa-2.1</feature>
    <feature>jsp-2.3</feature>
    <feature>ejb-3.2</feature>
    <feature>ejbRemote-3.2</feature>

TestActionBean.java:

    package de.fom.skillDB.war.actionbeans;

    import net.sourceforge.stripes.action.ActionBeanContext;
    import net.sourceforge.stripes.action.DefaultHandler;
    import net.sourceforge.stripes.action.ForwardResolution;
    import net.sourceforge.stripes.action.Resolution;
    import net.sourceforge.stripes.action.UrlBinding;

    @UrlBinding("/example/")
    public class TestActionBean {

        protected ActionBeanContext context;

        protected String title = "Titel";

        public ActionBeanContext getContext() {
            return context;
        }

        public void setContext(ActionBeanContext context) {
            this.context = context;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        @DefaultHandler
        public Resolution view() {
            return new ForwardResolution( "/index.jsp" );
        }
    }

Thank you in advance! :+1: Niklas

NiklasA commented 8 years ago

Hi,

I changed my web.xml to:

    <filter>
        <display-name>Stripes Filter</display-name>
        <filter-name>StripesFilter</filter-name>
        <filter-class>net.sourceforge.stripes.controller.StripesFilter</filter-class>

        <init-param>
            <param-name>ActionResolver.Packages</param-name>
            <param-value>de.fom.skillDB.war.actionbeans</param-value>
        </init-param>
    </filter>

    <filter>
        <description>Dynamically maps URLs to ActionBeans.</description>
        <display-name>Stripes Dynamic Mapping Filter</display-name>
        <filter-name>DynamicMappingFilter</filter-name>
        <filter-class>net.sourceforge.stripes.controller.DynamicMappingFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>DynamicMappingFilter</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
    </filter-mapping>

    <filter-mapping>
        <filter-name>StripesFilter</filter-name>
        <url-pattern>*.jsp</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
    </filter-mapping>

    <filter-mapping>
        <filter-name>StripesFilter</filter-name>
        <servlet-name>StripesDispatcher</servlet-name>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
    </filter-mapping>

    <servlet>
        <servlet-name>StripesDispatcher</servlet-name>
        <servlet-class>net.sourceforge.stripes.controller.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>StripesDispatcher</servlet-name>
        <url-pattern>*.action</url-pattern>
    </servlet-mapping>

But now I will getting all the time: Error 404: SRVE0295E: Error reported: 404, when I am trying to open the following site https://localhost/<ctx_root>/example/.

rgrashel commented 8 years ago

Hi Niklas, were you able to get Stripes running on Websphere 8.5? If not, I can download it and give it a try to see if I can get it going.

-- Rick

vankeisb commented 8 years ago

We have a JIRA issue for this one I think :

https://stripesframework.atlassian.net/browse/STS-922

NiklasA commented 8 years ago

Hi Rick,

no, I was not able to get Stripes running with a current IBM WebSphere Liberty version. I tested Stripes with serveral versions of WebSphere Application Server (8.5.5.4, .7 and .9).

@vankeisb: Yes, you could be right Bluemix uses a similar WebSphere Liberty version.

@rgrashel: Do you need any help to reproduce this issue? Then i would create a test project (Maven / EAR-File).

Thank you in advance. Niklas

vankeisb commented 8 years ago

That's a VFS issue. In short, Stripes has a pluggable way of scanning the classpath, called VFS. This allows to discover your @ActionBeans etc. (see ResolverUtil). VFSs are provided for some ASs (Tomcat, JBoss, etc), but not all of them.

Unfortunately, we have no VFS for liberty.

@rgrashel I should be able to find the code that I wrote in order to leverage Servlet 3+ API class discovery. I think it should be checked in, in order to workaround issues like this one. It's much simpler than to write a VFS, and I still think it should be the standard, since it's built-in the Servlet spec. So if you have a servlet 3+ container, you should not be concerned about this VFS thing. VFS should be kept only for Mock testing IMHO.

rgrashel commented 8 years ago

Hi Niklas,

If you have an EAR file that you could provide, that would be hugely helpful. Thanks.

-- Rick

On Sun, Aug 21, 2016 at 5:46 AM, NiklasA notifications@github.com wrote:

Hi Rick,

no, I was not able to get Stripes running with a current IBM WebSphere Liberty version. I tested Stripes with serveral versions of WebSphere Application Server (8.5.5.4, .7 and .9).

@vankeisb https://github.com/vankeisb: Yes, you could be right Bluemix uses a similar WebSphere Liberty version.

@rgrashel https://github.com/rgrashel: Do you need any help to reproduce this issue? Then i would create a test project (Maven / EAR-File).

Thank you in advance. Niklas

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/StripesFramework/stripes/issues/57#issuecomment-241250595, or mute the thread https://github.com/notifications/unsubscribe-auth/AEv4H_liy-R1lOZMqW2dYsbyMnqS1w4_ks5qiCx9gaJpZM4IafIm .

NiklasA commented 8 years ago

Hi Rick,

sorry, for the late response. I uploaded a war file here: Link.

I used the following AppServer: WebSphere Liberty Profile

If you need further help, please let me know.

Niklas

rgrashel commented 8 years ago

Niklas,

I just installed the latest version of Liberty (16.0.0.3) with Java EE 7 Web Profile. Running on JDK1.8. I dropped your WAR right in the defaultServer/dropins directory and got no errors. I even pulled up the test helloworld page at http://localhost:9080/test.

Then, I went ahead and built the Stripes Examples WAR file from master and copied that into the defaultServer/dropins directory. That also deployed successfully. There are a couple of bugs because of relative pathing, but you can hit http://localhost:9080/stripes-examples/rockandroll/artists and get a JSON response from a RestActionBean.

Is there something I am not doing to duplicate the error you are getting?

-- Rick

NiklasA commented 8 years ago

Hi Rick,

sorry, the issue was that I could not call http(s)://localhost:9080/test/example/. But you gave me the right hint with the Stripes examples. I compared both web.xml files and I was able to get it running (Commit).

But I am wondering, because I'm pretty sure that I have tried the DynamicMappingFilter in same way earlier and it did not work. And in the log the warning is still thrown "[WARNING ] No MultipartWrapper implementation could be loaded".

That's why I looked again at the JIRA ticket, which @vankeisb has mentioned. And then I remembered that I used a Multi-Module Maven Project, where the WAR file includes the Stripes staff and was packaged to an EAR file. Perhaps the problem can only be reproduced in this way.

Niklas

NiklasA commented 8 years ago

Hi Rick,

because I could not reproduced the issue with a single WAR file, I have expanded my test project and created a Multiple Module Maven project. With it, I was able to reproduce the issue. Sorry that it takes so long and the ticket gets longer and longer...

Steps:

  1. Download the files from Link
  2. After you add war file to WebSphere Liberty Profile and tried to open the application on http(s)://{DOMAIN}:{PORT}/LibertyWAR/example/, you will get an error "The [StripesFilter] filter did not load during start up." in log file.

I hope you can use my test project to investigate the issue and I hope too that is not an issue of misconfiguration on my side and I wasted your time ;-).

Thank you in advance. Niklas