掲示板

NullPointerException UIViewRoot upon deploy

10年前 に Micael Ericsson によって更新されました。

NullPointerException UIViewRoot upon deploy

Regular Member 投稿: 169 参加年月日: 12/12/11 最新の投稿
I have several portlets with the same problem. When I deploy them I get the following in tomcat consol:
14:21:57,822 INFO [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][PortletAutoDeployListener:87] Portlets for C:\Product\Liferay\l
iferay-portal-6.1.1-ce-ga2\deploy\AktivaUppdrag-1.0-SNAPSHOT.war copied successfully. Deployment will start in a few seconds.
sep 04, 2013 2:22:04 EM org.apache.catalina.startup.HostConfig checkResources
INFO: Undeploying context [/AktivaUppdrag-1.0-SNAPSHOT]
sep 04, 2013 2:22:04 EM org.apache.catalina.core.StandardContext listenerStop
SEVERE: Exception sending context destroyed event to listener instance of class com.sun.faces.config.ConfigureListener
java.lang.NullPointerException
at javax.faces.component.UIViewRoot.getViewMap(UIViewRoot.java:1541)
at com.sun.faces.config.InitFacesContext.release(InitFacesContext.java:223)
at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:352)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4819)
at org.apache.catalina.core.StandardContext.__stop(StandardContext.java:5466)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1030)
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1219)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1454)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:295)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1379)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1537)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1547)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1526)
at java.lang.Thread.run(Thread.java:722)

As far as I have read this could be a problem with the f:view tag placement but various tries gives the same answer. At current I have the following structure in my xhtml files.
<html...
<f:view...
<h:head..
<h:body...
...several jsf 2.0 tags such as ui:repeat
end tag for those above.
Liferay 6.1. JSF 2.1.16.

The portlet is deployed and runs fine. So far I have ignored above error, but we are close to production and this is not good in production log.

Suggestions?
10年前 に Micael Ericsson によって更新されました。

RE: NullPointerException UIViewRoot upon deploy

Regular Member 投稿: 169 参加年月日: 12/12/11 最新の投稿
No suggestions how to fix this?
thumbnail
10年前 に Juan Gonzalez によって更新されました。

RE: NullPointerException UIViewRoot upon deploy

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
Mmm I guess that <html> tag doesn't make sense. isn't it?

Try using :

<f:view ....>
..
..
</f:view>
10年前 に Micael Ericsson によって更新されました。

RE: NullPointerException UIViewRoot upon deploy

Regular Member 投稿: 169 参加年月日: 12/12/11 最新の投稿
Juan Gonzalez:
Mmm I guess that <html> tag doesn't make sense. isn't it?

Try using :

<f:view ....>
..
..
</f:view>


Current start of xhtml page is:
<?xml version="1.0"?>
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<f:view>
<f:event type="preRenderView" listener="#{aktivaUppdragController.initPage}"/>

Should I drop <html...> completely? How do I include taglibs (for JSF 2) ?
thumbnail
10年前 に Juan Gonzalez によって更新されました。

RE: NullPointerException UIViewRoot upon deploy

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
Simply add those schemas to f:view:

<f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"></f:view>
thumbnail
10年前 に Vernon Singleton によって更新されました。

RE: NullPointerException UIViewRoot upon deploy

Expert 投稿: 315 参加年月日: 13/01/14 最新の投稿
Micael Ericsson:
Should I drop <html...> completely? How do I include taglibs (for JSF 2) ?

Juan is correct. And ... let's briefly explain why ...

The html tag may not be completely ignored, but it certainly will not be rendered, and it is not necessary for a portlet.

In all of our demos, we use the f:view tag instead for the following reasons:
  • Since <html> doesn't get rendered, it is kind of out of place in a portlet
  • using f:view makes an explicit declaration that the xhtml file is a Facelet VIEW and not a Facelet ui:composition, and the benefit is that you can declare all the namespaces in the f:view tag.

Just my 2 cents + $5000 worth of training from my guru peers.
10年前 に Micael Ericsson によって更新されました。

RE: NullPointerException UIViewRoot upon deploy

Regular Member 投稿: 169 参加年月日: 12/12/11 最新の投稿
Thanks for the answers both Juan and Vernon. I'll change my code and see what happens.

Regarding demos at https://www.liferay.com/community/liferay-projects/liferay-faces/demos I only could find the java-code. I downloaded source for 6.1 but it didn't contain any xhtml-files and thus no header samples I could use. I don't have Git installed so I can't checka them out. Am I missing something? Why isn't web pages included?
thumbnail
10年前 に Juan Gonzalez によって更新されました。

RE: NullPointerException UIViewRoot upon deploy

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
10年前 に Micael Ericsson によって更新されました。

RE: NullPointerException UIViewRoot upon deploy

Regular Member 投稿: 169 参加年月日: 12/12/11 最新の投稿
I have updated my portlets with above suggestion but I still get error in my log.
Error:
INFO: Undeploying context [/Information-1.0-SNAPSHOT]
sep 11, 2013 7:56:10 FM org.apache.catalina.core.StandardContext listenerStop
SEVERE: Exception sending context destroyed event to listener instance of class com.sun.faces.config.ConfigureListener
java.lang.NullPointerException
at javax.faces.component.UIViewRoot.getViewMap(UIViewRoot.java:1541)
at com.sun.faces.config.InitFacesContext.release(InitFacesContext.java:223)
at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:352)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4819)
at org.apache.catalina.core.StandardContext.__stop(StandardContext.java:5466)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1030)
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1219)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1454)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:295)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1379)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1537)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1547)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1526)
at java.lang.Thread.run(Thread.java:722)

My xhtml-page:
<?xml version="1.0" encoding="UTF-8"?>
<f:view xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<f:event type="preRenderView" listener="#{informationController.initPage}"/>
<h:head>
... some javascript ...
</h:head>
<h:body>
<h:messages />
<div>
... plenty of h:outputtext ...
</div>
</h:body>
</f:view>
thumbnail
10年前 に Juan Gonzalez によって更新されました。

RE: NullPointerException UIViewRoot upon deploy

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
Please can you attach your portlet so we can investigate?

What Liferay Portal version are you using?

Thanks.
10年前 に Micael Ericsson によって更新されました。

RE: NullPointerException UIViewRoot upon deploy

Regular Member 投稿: 169 参加年月日: 12/12/11 最新の投稿
Juan Gonzalez:
Please can you attach your portlet so we can investigate?

What Liferay Portal version are you using?

Thanks.


Information Portlet attached. Netbeans Maven project.
Liferay portal version 3.1.1.

添付ファイル:

thumbnail
10年前 に Juan Gonzalez によって更新されました。

RE: NullPointerException UIViewRoot upon deploy

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
Micael Ericsson:

Liferay portal version 3.1.1.


I guess you said Liferay Faces version.

Please can you post your Liferay Portal version?
10年前 に Micael Ericsson によって更新されました。

RE: NullPointerException UIViewRoot upon deploy

Regular Member 投稿: 169 参加年月日: 12/12/11 最新の投稿
Juan Gonzalez:
Micael Ericsson:

Liferay portal version 3.1.1.


I guess you said Liferay Faces version.

Please can you post your Liferay Portal version?


Yes. liferay-faces-portal jar is 3.1.1.
Running plattform Liferay is liferay-portal-6.1.1-ce-ga2.
thumbnail
10年前 に Neil Griffin によって更新されました。

RE: NullPointerException UIViewRoot upon deploy

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
I looked at the portlet project you attached, but the versions of all the dependencies are declared in the parent pom, which was not included.

When you get a chance, please make sure that you are using version 3.1.3-ga4 of all the Liferay Faces JARs, and also version 2.1.21 of Mojarra. My best guess it that the stacktrace you reported will go away if you use those versions.
10年前 に Micael Ericsson によって更新されました。

RE: NullPointerException UIViewRoot upon deploy

Regular Member 投稿: 169 参加年月日: 12/12/11 最新の投稿
Neil Griffin:
I looked at the portlet project you attached, but the versions of all the dependencies are declared in the parent pom, which was not included.

When you get a chance, please make sure that you are using version 3.1.3-ga4 of all the Liferay Faces JARs, and also version 2.1.21 of Mojarra. My best guess it that the stacktrace you reported will go away if you use those versions.

I upgraded following jars from 3.1.1-ga2 to 3.1.3-ga4:
- liferay-faces-api
- liferay-faces-impl
- liferay-faces-portal
- liferay-faces-util

Rebuilt and deployed (cleaning cache) all my portlets gives following below error for each portlet.
Current Liferay version is 6.1.1-ce-ga2 and we can't upgrade at the moment.

As far as I can see we are not using any mojarra jar in our portlets.

Each portlets is a Maven project in NetBeans. WIth maven dependencies I am unable to find recommended mojarra version. api-2.0 and impl-2.0 is found.

Which jars and what version do I need? Are they possible to run on our Liferay version?

Stack trace from console:
13:45:42,143 INFO [BridgeImpl] Initializing Liferay Faces Bridge 3.1.3-ga4 (Galatia / Sep 5, 2013 AD)
13:45:42,197 ERROR [BridgeFlashFactory:85] Classloader unable to find either the Mojarra or MyFaces Flash implementations
2013-09-30 13:45:42 JRebel: Listening 'file:/C:/Project/Web/webapp/MittNastaSteg/src/main/webapp/WEB-INF/liferay-display.xml' for changes on
class com.liferay.portal.deploy.hot.PortletHotDeployListener in MittNastaSteg-1.0-SNAPSHOT
13:45:42,253 INFO [BridgeSessionListener:87] Context initialized for contextPath=[/MittNastaSteg-1.0-SNAPSHOT]
13:45:42,253 INFO [StartupListener:50] Context initialized for contextPath=[/MittNastaSteg-1.0-SNAPSHOT]
13:45:42,293 INFO [StartupListener:77] Copied input-editor.jsp from LiferayFaces JAR to context path file=[C:\Project\Web\webapp\MittNastaS
teg\src\main\webapp\resources\liferay-ui\jsp\input-editor.jsp]
sep 30, 2013 1:45:42 EM org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
java.lang.IllegalStateException: Could not find backup for factory javax.faces.context.FacesContextFactory.
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1010)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:342)
at javax.faces.webapp.FacesServlet.init(FacesServlet.java:302)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5015)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5302)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1099)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1621)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
thumbnail
10年前 に Neil Griffin によって更新されました。

RE: NullPointerException UIViewRoot upon deploy

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
Looks like you need to add the following to your pom.xml descriptor:

<dependency>
    <groupid>com.sun.faces</groupid>
    <artifactid>jsf-api</artifactid>
    <version>2.1.21</version>
</dependency>
<dependency>
    <groupid>com.sun.faces</groupid>
    <artifactid>jsf-impl</artifactid>
    <version>2.1.21</version>
</dependency>
10年前 に Micael Ericsson によって更新されました。

RE: NullPointerException UIViewRoot upon deploy

Regular Member 投稿: 169 参加年月日: 12/12/11 最新の投稿
Neil Griffin:
Looks like you need to add the following to your pom.xml descriptor:

<dependency>
    <groupid>com.sun.faces</groupid>
    <artifactid>jsf-api</artifactid>
    <version>2.1.21</version>
</dependency>
<dependency>
    <groupid>com.sun.faces</groupid>
    <artifactid>jsf-impl</artifactid>
    <version>2.1.21</version>
</dependency>

Thanks!! This solved my problem. I had an older version of jsf-api and jsf-impl was not included at all.

But this gave me another problem.
I am using "xmlns:aui="http://liferay.com/faces/aui" for layout management in forms, like: <aui:layout cssClass="aui-rm-layout"> and <aui:column columnWidth="33" first="true" last="false">.

This doesn't work at all - each input field gets a new row instead of three in each row. I also receive "Warning: This page calls for XML namespace http://liferay.com/faces/aui declared with prefix aui but no taglibrary exists for that namespace.". Has this been excluded/changed?

This only thing I changed in my portlets was version number for faces and jsf jars.
thumbnail
10年前 に Neil Griffin によって更新されました。

RE: NullPointerException UIViewRoot upon deploy

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
The error message indicates that you need this one too:

<dependency>
    <groupid>com.liferay.faces</groupid>
    <artifactid>liferay-faces-alloy</artifactid>
    <version>3.1.3-ga4</version>
</dependency>
10年前 に Micael Ericsson によって更新されました。

RE: NullPointerException UIViewRoot upon deploy

Regular Member 投稿: 169 参加年月日: 12/12/11 最新の投稿
Neil Griffin:
The error message indicates that you need this one too:

<dependency>
    <groupid>com.liferay.faces</groupid>
    <artifactid>liferay-faces-alloy</artifactid>
    <version>3.1.3-ga4</version>
</dependency>


Thanks again! Now all forms looks ok again.

A little question. After adding liferay-faces-alloy Netbeans/Maven generated resources/liferay-ui/jsp/input-editor.jsp. Is this file needed? What does it do?
thumbnail
10年前 に Neil Griffin によって更新されました。

RE: NullPointerException UIViewRoot upon deploy

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
Before I answer, are you using JRebel?
10年前 に Micael Ericsson によって更新されました。

RE: NullPointerException UIViewRoot upon deploy

Regular Member 投稿: 169 参加年月日: 12/12/11 最新の投稿
Neil Griffin:
Before I answer, are you using JRebel?


That is correct. Is it a problem?
thumbnail
10年前 に Neil Griffin によって更新されました。

RE: NullPointerException UIViewRoot upon deploy

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
No, using JRebel is fine -- it is not a problem. But it will help me answer your question:

Netbeans/Maven generated resources/liferay-ui/jsp/input-editor.jsp. Is this file needed? What does it do?


JRebel is actually the reason why the input-editor.jsp file is appearing in your project. When your project WAR is deployed to Liferay, the com.liferay.faces.portal.listener.StartupListener class inside of liferay-faces-portal.jar will extract the input-editor.jsp file from itself so that it the servlet container will be able to issue a request dispatcher to it. Since you have JRebel installed, JRebel tricks the StartupListener into thinking that the servlet context is actually your project folder, and so it gets copied there instead. You can delete it from your project if you want to, but JRebel will cause it to be copied back there again the next time the server is started or the next time the portlet is re-deployed. It is just an unfortunate side-effect of using JRebel in conjunction with the Liferay Faces Portal project.

The purpose of the input-editor.jsp file is to support the Facelet version of the liferay-ui:input-editor tag.
10年前 に Micael Ericsson によって更新されました。

RE: NullPointerException UIViewRoot upon deploy

Regular Member 投稿: 169 参加年月日: 12/12/11 最新の投稿
Thanks for all the help. I think we can close this issue.

I can live with input-editor.jsp.