Foros de discusión

NullPointerException in InvokerFilter

Victor Lindberg, modificado hace 11 años.

NullPointerException in InvokerFilter

New Member Mensajes: 2 Fecha de incorporación: 21/09/12 Mensajes recientes
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, modificado hace 11 años.

RE: NullPointerException in InvokerFilter

Liferay Legend Mensajes: 1519 Fecha de incorporación: 7/08/06 Mensajes recientes
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, modificado hace 10 años.

RE: NullPointerException in InvokerFilter

Liferay Legend Mensajes: 1399 Fecha de incorporación: 17/09/10 Mensajes recientes
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, modificado hace 10 años.

RE: NullPointerException in InvokerFilter

Liferay Legend Mensajes: 1519 Fecha de incorporación: 7/08/06 Mensajes recientes
Good catch James. That would definitely cause that. Never ever copy portal-service.jar or portal-impl.jar into your plugin.
Aleksey Korolev, modificado hace 8 años.

RE: NullPointerException in InvokerFilter

New Member Mensaje: 1 Fecha de incorporación: 15/03/16 Mensajes recientes
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.