Forums de discussion

NullPointerException in InvokerFilter

Victor Lindberg, modifié il y a 11 années.

NullPointerException in InvokerFilter

New Member Publications: 2 Date d'inscription: 21/09/12 Publications récentes
When I access my liferay application:

java.lang.NullPointerException
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.getInvokerFilterChain(InvokerFilter.java:177)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:64)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)

How can i solve that?
thumbnail
Mika Koivisto, modifié il y a 11 années.

RE: NullPointerException in InvokerFilter

Liferay Legend Publications: 1519 Date d'inscription: 07/08/06 Publications récentes
Too little information to even start beginning to guess what could be the cause. You should post the full stacktrace and Liferay version you are using. Have you added any custom filters or filter hooks?
thumbnail
James Falkner, modifié il y a 10 années.

RE: NullPointerException in InvokerFilter

Liferay Legend Publications: 1399 Date d'inscription: 17/09/10 Publications récentes
Victor Lindberg:
When I access my liferay application:

java.lang.NullPointerException
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.getInvokerFilterChain(InvokerFilter.java:177)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:64)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)

How can i solve that?


So, I am going to take a wild stab at this, because I just debugged an issue with the same NPE. It was because they were including their own copy of portal-service.jar inside of their plugin's WEB-INF/lib directory, which is a big no-no (because of Liferay's classloading mechanism, it will create instances of Liferay core classes using your plugin's classloader, instead of the Liferay/appserver one (which has its own copy of portal-service.jar). There is stateful information inside classes, so your app ends up using uninintialized versions of many Liferay core classes, including the InvokerServlet, thereby throwing the NPE. So check your build processes and ensure that your plugins never include WEB-INF/lib/portal-service.jar).
thumbnail
Mika Koivisto, modifié il y a 10 années.

RE: NullPointerException in InvokerFilter

Liferay Legend Publications: 1519 Date d'inscription: 07/08/06 Publications récentes
Good catch James. That would definitely cause that. Never ever copy portal-service.jar or portal-impl.jar into your plugin.
Aleksey Korolev, modifié il y a 8 années.

RE: NullPointerException in InvokerFilter

New Member Envoyer: 1 Date d'inscription: 15/03/16 Publications récentes
I'm on latest Liferay 6.2 ga6 and was getting the same error. It took me some time to realize that this was due to inclusionn of Liferay API as a dependency into my project' pom file:
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>com.liferay.portal.kernel</artifactId>
<version>2.0.0</version>
</dependency>

It would be nice to have better error handling for such case and provide some clues about the reason of the error.
For example check ClassLoader of some class, e.g. InvokerFilter, on startup and printing error if "wrong" classloader is detected.