Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
Victor Lindberg
NullPointerException in InvokerFilter
21 de septiembre de 2012 14:09
Respuesta

Victor Lindberg

Ranking: New Member

Mensajes: 2

Fecha de incorporación: 21 de septiembre de 2012

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?
Mika Koivisto
RE: NullPointerException in InvokerFilter
25 de septiembre de 2012 13:27
Respuesta

Mika Koivisto

LIFERAY STAFF

Ranking: Liferay Legend

Mensajes: 1513

Fecha de incorporación: 7 de agosto de 2006

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?
James Falkner
RE: NullPointerException in InvokerFilter
19 de junio de 2013 13:35
Respuesta

James Falkner

Community Moderator

Ranking: Liferay Legend

Mensajes: 1406

Fecha de incorporación: 17 de septiembre de 2010

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).
Mika Koivisto
RE: NullPointerException in InvokerFilter
19 de junio de 2013 17:28
Respuesta

Mika Koivisto

LIFERAY STAFF

Ranking: Liferay Legend

Mensajes: 1513

Fecha de incorporación: 7 de agosto de 2006

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
RE: NullPointerException in InvokerFilter
15 de marzo de 2016 14:59
Respuesta

Aleksey Korolev

Ranking: New Member

Mensajes: 1

Fecha de incorporación: 15 de marzo de 2016

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.