留言板

ClassNotFoundException: javax.faces.webapp.FacesServlet when PACL enabled

donino pienni,修改在9 年前。

ClassNotFoundException: javax.faces.webapp.FacesServlet when PACL enabled

Junior Member 帖子: 81 加入日期: 11-7-2 最近的帖子
Hi,

I develop a portlet application which enables the security manager in liferay-plugin-package.properties:

security-manager-enabled=true


When the application starts, we get the stacktrace below in liferay 6.2 EE and 6.2.1 CE logs. It happens only once and it does not look to break anything, despite of this message the portlet works finely. If we disable the security manager in liferay-plugin-package.properties of the portlet, then this exception does not happen. This class "javax.faces.webapp.FacesServlet" is not in the .WAR of the portlet, and it is not invoked anywhere in the code. The portlet makes use of these dependencies, not sure if it could be related:

portal-dependency-jars=jstl-api.jar,jstl-impl.jar


Please has someone else experienced this issue? Any idea to workaround it?

Any suggestion wille be much appreciated!
Thanks!

20:23:06,406 ERROR [localhost-startStop-1][BasePortalLifecycle:94] java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet
java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
	at com.liferay.portal.kernel.util.InstanceFactory.newInstance(InstanceFactory.java:52)
	at com.liferay.portal.kernel.util.InstanceFactory.newInstance(InstanceFactory.java:27)
	at com.liferay.portal.kernel.servlet.SecureServlet.doPortalInit(SecureServlet.java:101)
	at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:44)
	at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:64)
	at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:56)
	at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:54)
	at com.liferay.portal.kernel.servlet.SecureServlet.init(SecureServlet.java:76)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:277)
	at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:274)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAsPrivileged(Subject.java:536)
	at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:309)
	at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:169)
	at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:123)
	at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1268)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5176)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5460)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
	at org.apache.catalina.core.ContainerBase.access$000(ContainerBase.java:133)
	at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerBase.java:156)
	at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerBase.java:145)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1113)
	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1671)
	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:724)
thumbnail
Subhash Pavuskar,修改在9 年前。

RE: ClassNotFoundException: javax.faces.webapp.FacesServlet when PACL enabl

Regular Member 帖子: 234 加入日期: 12-3-13 最近的帖子
No Sure !! did you added these Jars
1. jsf-api-2.0.3.jar
2. primefaces-2.2.RC2.jar in WEB-INF/lib folder ?
thumbnail
Neil Griffin,修改在9 年前。

RE: ClassNotFoundException: javax.faces.webapp.FacesServlet when PACL enabl

Liferay Legend 帖子: 2655 加入日期: 05-7-27 最近的帖子
Here is the relevant Java code from Liferay's SecureServlet:

	@Override
	protected void doPortalInit() throws Exception {
		ServletContext servletContext = servletConfig.getServletContext();

		ClassLoader classLoader = (ClassLoader)servletContext.getAttribute(
			PluginContextListener.PLUGIN_CLASS_LOADER);

		String servletClass = servletConfig.getInitParameter("servlet-class");

		servlet = (Servlet)InstanceFactory.newInstance(
			classLoader, servletClass);

		servlet.init(servletConfig);
	}


The error message you are seeing and the aforementioned Java code indicates that there is a servlet-mapping entry in your WEB-INF/web.xml descriptor for the FacesServlet.

Are you developing a JSF portlet, or a non-JSF portlet?
donino pienni,修改在9 年前。

RE: ClassNotFoundException: javax.faces.webapp.FacesServlet when PACL enabl

Junior Member 帖子: 81 加入日期: 11-7-2 最近的帖子
Brilliant! Thank you very much for replies!

Neil, i develop a non-JSF portlet. But thanks to your reply i realized i have this content below in my web.xml before it is deployed. I don't have any idea how it landed here, i assume it has been generated by maven after a wrong handling: i included javax faces as test dependency a few times ago to make use of org.springframework.mock.web.portlet in junit tests.

Anyway after removing this from web.xml it works like a charm. Thanks a million, i was struggling with this!

    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
thumbnail
Neil Griffin,修改在9 年前。

RE: ClassNotFoundException: javax.faces.webapp.FacesServlet when PACL enabl

Liferay Legend 帖子: 2655 加入日期: 05-7-27 最近的帖子
It was my pleasure Donino. Thanks for the kind words and for using Liferay Portal. emoticon