Foros de discusión

Liferay In Action ClassNotFoundException for Hello You Portlet Example

Jaafar Altaie, modificado hace 11 años.

Liferay In Action ClassNotFoundException for Hello You Portlet Example

Junior Member Mensajes: 69 Fecha de incorporación: 26/04/12 Mensajes recientes
I'm following Chapter 2 and trying to create the Hello You plug in using Eclipse Indigo..

I get the following error:



20:37:48,501 ERROR [PortletBagFactory:123] java.lang.ClassNotFoundException: com.manaar.classes.ManHiTest
java.lang.ClassNotFoundException: com.manaar.classes.ManHiTest
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533)
at com.liferay.portlet.PortletBagFactory.create(PortletBagFactory.java:120)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.initPortlet(PortletHotDeployListener.java:524)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.doInvokeDeploy(PortletHotDeployListener.java:302)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:115)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._doFireDeployEvent(HotDeployUtil.java:111)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._fireDeployEvent(HotDeployUtil.java:188)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:40)
at com.liferay.portal.kernel.servlet.PortletContextListener.doPortalInit(PortletContextListener.java:101)
at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:61)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:53)
at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:52)
at com.liferay.portal.kernel.servlet.PortletContextListener.contextInitialized(PortletContextListener.java:55)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4765)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5260)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:842)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1095)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1617)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
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)
20:37:48,604 INFO [PortletHotDeployListener:433] 1 portlet for ManJuneTest2-portlet is available for use

THIS IS HOW I CREATED THE PLUGIN:

1) After configuring the Liferay plugins for Eclipse, I first create a New Liferay Project and update the portal.xml as follows:

<?xml version="1.0"?>

<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0">
<portlet>
<portlet-name>ManJuneTest2</portlet-name>
<display-name>ManJuneTest2</display-name>
<portlet-class>com.liferay.util.bridges.mvc.MVCPortlet</portlet-class>
<init-param>
<name>view-template</name>
<value>/view.jsp</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
</supports>
<portlet-info>
<title>ManJuneTest2</title>
<short-title>ManJuneTest2</short-title>
<keywords>ManJuneTest2</keywords>
</portlet-info>
<security-role-ref>
<role-name>administrator</role-name>
</security-role-ref>
<security-role-ref>
<role-name>guest</role-name>
</security-role-ref>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
<portlet>
<portlet-name>manhitest</portlet-name>
<display-name>ManHiTest</display-name>
<portlet-class>com.manaar.classes.ManHiTest</portlet-class>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
<portlet-mode>edit</portlet-mode>
</supports>
<portlet-info>
<title>ManHiTest</title>
<short-title>ManHiTest</short-title>
<keywords></keywords>
</portlet-info>
<security-role-ref>
<role-name>administrator</role-name>
</security-role-ref>
<security-role-ref>
<role-name>guest</role-name>
</security-role-ref>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
</portlet-app>

2) Modify my custom portlet class (ManJuneHi):


package com.manaar;

import java.io.IOException;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
import javax.portlet.PortletMode;
import javax.portlet.PortletPreferences;
import javax.portlet.PortletRequestDispatcher;
import javax.portlet.PortletURL;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


public class ManJuneHi extends GenericPortlet {

public void init() throws PortletException {
editJSP = getInitParameter("edit-jsp");
viewJSP = getInitParameter("view-jsp");
}


public void doEdit(RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException {
renderResponse.setContentType("text/html");
PortletURL addName = renderResponse.createActionURL();
addName.setParameter("addName", "addName");
renderRequest.setAttribute("addNameUrl", addName.toString());
include(editJSP, renderRequest, renderResponse);
}


public void doView(RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException {
PortletPreferences prefs = renderRequest.getPreferences();
String username = (String) prefs.getValue("name", "no");
if (username.equalsIgnoreCase("no")) {
username = "";
}
renderRequest.setAttribute("userName", username);
include(viewJSP, renderRequest, renderResponse);
}

public void processAction(
ActionRequest actionRequest, ActionResponse actionResponse)
throws IOException, PortletException {
String addName = actionRequest.getParameter("addName");
if (addName != null) {
PortletPreferences prefs = actionRequest.getPreferences();
prefs.setValue("name", actionRequest.getParameter("username"));
prefs.store();
actionResponse.setPortletMode(PortletMode.VIEW);
}
}

protected void include(
String path, RenderRequest renderRequest,
RenderResponse renderResponse)
throws IOException, PortletException {

PortletRequestDispatcher portletRequestDispatcher =
getPortletContext().getRequestDispatcher(path);

if (portletRequestDispatcher == null) {
_log.error(path + " is not a valid include");
}
else {
portletRequestDispatcher.include(renderRequest, renderResponse);
}
}

protected String editJSP;
protected String viewJSP;

private static Log _log = LogFactory.getLog(ManJuneHi.class);

}


I'd really appreciate any suggestions on what could be causing this error or what further information I need to provide. THANK YOU!
thumbnail
Hitoshi Ozawa, modificado hace 11 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

Liferay Legend Mensajes: 7942 Fecha de incorporación: 24/03/10 Mensajes recientes
20:37:48,501 ERROR [PortletBagFactory:123] java.lang.ClassNotFoundException: com.manaar.classes.ManHiTest


This seems to say it all.

Try changing the following package name to com.manaar.classes
package com.manaar;

OR

change
<portlet-class>com.manaar.ManHiTest</portlet-class>
Jaafar Altaie, modificado hace 11 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

Junior Member Mensajes: 69 Fecha de incorporación: 26/04/12 Mensajes recientes
Thank you. I tried creating another app with the same class references but seem to be getting exactly the same error:

19:33:32,421 ERROR [PortletBagFactory:123] java.lang.ClassNotFoundException: com.test.ManJuneHi
java.lang.ClassNotFoundException: com.test.ManJuneHi
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533)
at com.liferay.portlet.PortletBagFactory.create(PortletBagFactory.java:120)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.initPortlet(PortletHotDeployListener.java:524)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.doInvokeDeploy(PortletHotDeployListener.java:302)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:115)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._doFireDeployEvent(HotDeployUtil.java:111)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._fireDeployEvent(HotDeployUtil.java:188)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:40)
at com.liferay.portal.kernel.servlet.PortletContextListener.doPortalInit(PortletContextListener.java:101)
at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:61)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:53)
at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:52)
at com.liferay.portal.kernel.servlet.PortletContextListener.contextInitialized(PortletContextListener.java:55)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4765)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5260)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:842)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:649)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1581)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
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)
19:33:32,427 INFO [PortletHotDeployListener:438] 0 portlets for ManJune3-portlet are available for use


ManJuneHi.java
----------------------

package com.test;

import java.io.IOException;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
import javax.portlet.PortletMode;
import javax.portlet.PortletPreferences;
import javax.portlet.PortletRequestDispatcher;
import javax.portlet.PortletURL;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


public class ManJuneHi extends GenericPortlet {

public void init() throws PortletException {
editJSP = getInitParameter("edit-jsp");
viewJSP = getInitParameter("view-jsp");
}


public void doEdit(RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException {
renderResponse.setContentType("text/html");
PortletURL addName = renderResponse.createActionURL();
addName.setParameter("addName", "addName");
renderRequest.setAttribute("addNameUrl", addName.toString());
include(editJSP, renderRequest, renderResponse);
}


public void doView(RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException {
PortletPreferences prefs = renderRequest.getPreferences();
String username = (String) prefs.getValue("name", "no");
if (username.equalsIgnoreCase("no")) {
username = "";
}
renderRequest.setAttribute("userName", username);
include(viewJSP, renderRequest, renderResponse);
}

public void processAction(
ActionRequest actionRequest, ActionResponse actionResponse)
throws IOException, PortletException {
String addName = actionRequest.getParameter("addName");
if (addName != null) {
PortletPreferences prefs = actionRequest.getPreferences();
prefs.setValue("name", actionRequest.getParameter("username"));
prefs.store();
actionResponse.setPortletMode(PortletMode.VIEW);
}
}

protected void include(
String path, RenderRequest renderRequest,
RenderResponse renderResponse)
throws IOException, PortletException {

PortletRequestDispatcher portletRequestDispatcher =
getPortletContext().getRequestDispatcher(path);

if (portletRequestDispatcher == null) {
_log.error(path + " is not a valid include");
}
else {
portletRequestDispatcher.include(renderRequest, renderResponse);
}
}

protected String editJSP;
protected String viewJSP;

private static Log _log = LogFactory.getLog(ManJuneHi.class);

}


portlet.xml
--------------
<?xml version="1.0"?>

<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0">

<portlet>
<portlet-name>manjunehi</portlet-name>
<display-name>ManJuneHi</display-name>
<portlet-class>com.test.ManJuneHi</portlet-class>
<init-param>
<name>view-jsp</name>
<value>/view.jsp</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
</supports>
<portlet-info>
<title>ManJuneHi</title>
<short-title>ManJuneHi</short-title>
<keywords></keywords>
</portlet-info>
<security-role-ref>
<role-name>administrator</role-name>
</security-role-ref>
<security-role-ref>
<role-name>guest</role-name>
</security-role-ref>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
</portlet-app>
Jaafar Altaie, modificado hace 11 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

Junior Member Mensajes: 69 Fecha de incorporación: 26/04/12 Mensajes recientes
Could there be a problem with the LIferay Configuration for Eclipse? I tried creating ANOTHER portlet and SAME error:


19:55:14,928 ERROR [PortletBagFactory:123] java.lang.ClassNotFoundException: com.test.HiJune6
java.lang.ClassNotFoundException: com.test.HiJune6
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533)
at com.liferay.portlet.PortletBagFactory.create(PortletBagFactory.java:120)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.initPortlet(PortletHotDeployListener.java:524)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.doInvokeDeploy(PortletHotDeployListener.java:302)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:115)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._doFireDeployEvent(HotDeployUtil.java:111)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._fireDeployEvent(HotDeployUtil.java:188)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:40)
at com.liferay.portal.kernel.servlet.PortletContextListener.doPortalInit(PortletContextListener.java:101)
at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.flushInits(PortalLifecycleUtil.java:45)
at com.liferay.portal.servlet.MainServlet.initPlugins(MainServlet.java:813)
at com.liferay.portal.servlet.MainServlet.init(MainServlet.java:347)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
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:5001)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5289)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:842)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:649)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1581)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
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)
19:55:14,943 INFO [PortletHotDeployListener:438] 0 portlets for ManJune6-portlet are available for use


package com.test;

import java.io.IOException;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
import javax.portlet.PortletMode;
import javax.portlet.PortletPreferences;
import javax.portlet.PortletRequestDispatcher;
import javax.portlet.PortletURL;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


public class HiJune6 extends GenericPortlet {

public void init() throws PortletException {
editJSP = getInitParameter("edit-jsp");
viewJSP = getInitParameter("view-jsp");
}


public void doEdit(RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException {
renderResponse.setContentType("text/html");
PortletURL addName = renderResponse.createActionURL();
addName.setParameter("addName", "addName");
renderRequest.setAttribute("addNameUrl", addName.toString());
include(editJSP, renderRequest, renderResponse);
}


public void doView(RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException {
PortletPreferences prefs = renderRequest.getPreferences();
String username = (String) prefs.getValue("name", "no");
if (username.equalsIgnoreCase("no")) {
username = "";
}
renderRequest.setAttribute("userName", username);
include(viewJSP, renderRequest, renderResponse);
}

public void processAction(
ActionRequest actionRequest, ActionResponse actionResponse)
throws IOException, PortletException {
String addName = actionRequest.getParameter("addName");
if (addName != null) {
PortletPreferences prefs = actionRequest.getPreferences();
prefs.setValue("name", actionRequest.getParameter("username"));
prefs.store();
actionResponse.setPortletMode(PortletMode.VIEW);
}
}

protected void include(
String path, RenderRequest renderRequest,
RenderResponse renderResponse)
throws IOException, PortletException {

PortletRequestDispatcher portletRequestDispatcher =
getPortletContext().getRequestDispatcher(path);

if (portletRequestDispatcher == null) {
_log.error(path + " is not a valid include");
}
else {
portletRequestDispatcher.include(renderRequest, renderResponse);
}
}

protected String editJSP;
protected String viewJSP;

private static Log _log = LogFactory.getLog(HiJUne6.class);

}



<?xml version="1.0"?>

<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0">

<portlet>
<portlet-name>hijune6</portlet-name>
<display-name>HiJune6</display-name>
<portlet-class>com.test.HiJune6</portlet-class>
<init-param>
<name>view-jsp</name>
<value>/view.jsp</value>
</init-param>
<init-param>
<name>edit-jsp</name>
<value>/edit.jsp</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
<portlet-mode>edit</portlet-mode>
</supports>
<portlet-info>
<title>HiJune6</title>
<short-title>HiJune6</short-title>
<keywords></keywords>
</portlet-info>
<security-role-ref>
<role-name>administrator</role-name>
</security-role-ref>
<security-role-ref>
<role-name>guest</role-name>
</security-role-ref>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
</portlet-app>
thumbnail
Gregory Amerson, modificado hace 11 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

Liferay Legend Mensajes: 1123 Fecha de incorporación: 16/02/10 Mensajes recientes
Hi Jaafar,

Modify your .classpath in your project and change the default output folder from "build..." to "docroot/WEB-INF/classes", rebuild your project and redeploy.

There was a bug in new projects using Liferay IDE 1.5.2 and previous and the Eclipse 3.7.2 latest release where new projects would be mis-configured. So an alternative to fixing your existing project is to create a new project after you have install Liferay IDE 1.5.3 which you can install from this updatesite URL:

http://releases.liferay.com/tools/ide/eclipse/indigo/stable/
Jaafar Altaie, modificado hace 11 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

Junior Member Mensajes: 69 Fecha de incorporación: 26/04/12 Mensajes recientes
Gregory,

Thanks so much! I'll give this a try asap and update you.
Jaafar Altaie, modificado hace 11 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

Junior Member Mensajes: 69 Fecha de incorporación: 26/04/12 Mensajes recientes
Gregory,

This is how I modified my classpath using Eclipse:

1) Right click Project --> View Project Properties
2) Go to Java class path
3) Go to Source
4) See the Default Output folder ----> this is already set to ManJune6-portlet/docroot/WEB-INF/classes

If there's a bug in 1.5.2 could something else be preventing the new project. So should I try other options to fix my project or just go ahead and install 1.5.3 IDE?

Thanks Again!
Jaafar Altaie, modificado hace 11 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

Junior Member Mensajes: 69 Fecha de incorporación: 26/04/12 Mensajes recientes
I tried something slightly different in creating yet another portlet. ManaarNetV2a was created by simply going File --> New --> LifeRay Project --> TICK create custom portlet class, which resulted in the above errors.

This time I created ManaarNetV2b by first creating a new Project, THEN creating a new portlet separately. The error I got is slightly different:

16:18:55,178 ERROR [PortletBagFactory:123] java.lang.ClassNotFoundException: com.test.ManaarNetVb
java.lang.ClassNotFoundException: com.test.ManaarNetVb
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533)
at com.liferay.portlet.PortletBagFactory.create(PortletBagFactory.java:120)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.initPortlet(PortletHotDeployListener.java:524)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.doInvokeDeploy(PortletHotDeployListener.java:302)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:115)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._doFireDeployEvent(HotDeployUtil.java:111)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._fireDeployEvent(HotDeployUtil.java:188)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:40)
at com.liferay.portal.kernel.servlet.PortletContextListener.doPortalInit(PortletContextListener.java:101)
at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:61)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:53)
at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:52)
at com.liferay.portal.kernel.servlet.PortletContextListener.contextInitialized(PortletContextListener.java:55)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4765)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5260)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:842)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:649)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1581)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
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)
16:18:55,291 INFO [PortletHotDeployListener:433] 1 portlet for ManaarNetV2b-portlet is available for use

So it seems the default portlet created in the new project is recognized and the problem happens if I try to create a custom portlet which extends the GenericPortlet class. The class file for ManaarNetV2b is exactly the same as ManaarNetV2a (except for different class name). The portlet.xml for v2b is:

<?xml version="1.0"?>

<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0">
<portlet>
<portlet-name>ManaarNetV2b</portlet-name>
<display-name>ManaarNetV2b</display-name>
<portlet-class>com.liferay.util.bridges.mvc.MVCPortlet</portlet-class>
<init-param>
<name>view-template</name>
<value>/view.jsp</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
</supports>
<portlet-info>
<title>ManaarNetV2b</title>
<short-title>ManaarNetV2b</short-title>
<keywords>ManaarNetV2b</keywords>
</portlet-info>
<security-role-ref>
<role-name>administrator</role-name>
</security-role-ref>
<security-role-ref>
<role-name>guest</role-name>
</security-role-ref>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
<portlet>
<portlet-name>manaarnetvb</portlet-name>
<display-name>ManaarNetVb</display-name>
<portlet-class>com.test.ManaarNetVb</portlet-class>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
<portlet-mode>edit</portlet-mode>
</supports>
<portlet-info>
<title>ManaarNetVb</title>
<short-title>ManaarNetVb</short-title>
<keywords></keywords>
</portlet-info>
<security-role-ref>
<role-name>administrator</role-name>
</security-role-ref>
<security-role-ref>
<role-name>guest</role-name>
</security-role-ref>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
</portlet-app>
thumbnail
Gregory Amerson, modificado hace 11 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

Liferay Legend Mensajes: 1123 Fecha de incorporación: 16/02/10 Mensajes recientes
Can you post a zip file of your project source so I take a quick look at the settings? Thanks.
thumbnail
Hitoshi Ozawa, modificado hace 11 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

Liferay Legend Mensajes: 7942 Fecha de incorporación: 24/03/10 Mensajes recientes
As Gregory mentioned, it's very difficult to diagnos your problem without the entire project source or war file with source code.
Jaafar Altaie, modificado hace 11 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

Junior Member Mensajes: 69 Fecha de incorporación: 26/04/12 Mensajes recientes
Here you go
thumbnail
Gregory Amerson, modificado hace 11 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

Liferay Legend Mensajes: 1123 Fecha de incorporación: 16/02/10 Mensajes recientes
Hi Jaafar,

I found the problem. It was the WTP component description that was not finding your files to deploy correct to the server via the add/remove modules. I'm sorry you ran into this as it was a bug in the new project wizard and not your fault. Attached is the fixed sources. But just to show you the file that was changed, it was this one:

.settings/org.eclipse.wst.common.component

I changed line 6 to be this:
 <property name="java-output-path" value="/ManaarNetV2b-portlet/docroot/WEB-INF/classes" />


Remove your project from the serve and re-add it via add/remove modules dialog and try again.

Hope this helps.
Jaafar Altaie, modificado hace 11 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

Junior Member Mensajes: 69 Fecha de incorporación: 26/04/12 Mensajes recientes
Gregory,

I really appreciate your help but I still seem to be facing issues. I tried modifying the wst settings as you suggested but doesn't seem to be deploying correctly.

Please find the attached which produces:

15:16:09,587 ERROR [PortletBagFactory:123] java.lang.ClassNotFoundException: com.manaar.ManVd
java.lang.ClassNotFoundException: com.manaar.ManVd
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533)
at com.liferay.portlet.PortletBagFactory.create(PortletBagFactory.java:120)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.initPortlet(PortletHotDeployListener.java:524)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.doInvokeDeploy(PortletHotDeployListener.java:302)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:115)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._doFireDeployEvent(HotDeployUtil.java:111)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._fireDeployEvent(HotDeployUtil.java:188)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:40)
at com.liferay.portal.kernel.servlet.PortletContextListener.doPortalInit(PortletContextListener.java:101)
at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:61)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:53)
at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:52)
at com.liferay.portal.kernel.servlet.PortletContextListener.contextInitialized(PortletContextListener.java:55)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4765)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5260)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:842)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:649)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1581)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
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)
15:16:09,590 INFO [PortletHotDeployListener:438] 0 portlets for ManaarNetVd-portlet are available for use

I"m also going to try creating a portlet manually without the IDE
Jaafar Altaie, modificado hace 11 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

Junior Member Mensajes: 69 Fecha de incorporación: 26/04/12 Mensajes recientes
Hi Again Gregory,

OK I managed to successfully deploy ManaarNetV2b-portlet, BUT it is not functioning properly. Hopefully this is now just a matter of configuring portlet.xml file correctly.

What the plug in is supposed to do is simply displat Hello <%user name%> (ie: Hello Gregory!). Instead it has amnesia and only dsiplays Hello!, which means it's not picking up the user name.

I think the key is in the <init-param> part. In the attached portlet.xml <init-param> references ManaarNetV2b, which is the default portlet class which extends MVCPortlet when the portlet project is created in Eclipse. My custom class is ManaarNetVb (which extends GenericPortlet). If I try to create ONLY this custom class in the new project, I do not see an <init-param> generated in the portlet.xml.
So don't I need a way to implement <init-param> in my custom class in the portlet.xml?


If I try to add <init-param> manually to the generated portlet.xml, I get the following error:

19:48:21,543 INFO [PortletHotDeployListener:614] Registering portlets for ManaarNetVf-portlet
19:48:21,559 ERROR [PortletLocalServiceImpl:758] com.liferay.portal.kernel.xml.DocumentException: Error on line 9 of document : cvc-complex-type.2.4.a: Invalid content was found starting with element 'init-param'. One of '{"http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd":cache-scope, "http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd":supports}' is expected. Nested exception: cvc-complex-type.2.4.a: Invalid content was found starting with element 'init-param'. One of '{"http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd":cache-scope, "http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd":supports}' is expected.
com.liferay.portal.kernel.xml.DocumentException: Error on line 9 of document : cvc-complex-type.2.4.a: Invalid content was found starting with element 'init-param'. One of '{"http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd":cache-scope, "http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd":supports}' is expected. Nested exception: cvc-complex-type.2.4.a: Invalid content was found starting with element 'init-param'. One of '{"http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd":cache-scope, "http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd":supports}' is expected.
at com.liferay.portal.xml.SAXReaderImpl.read(SAXReaderImpl.java:403)
at com.liferay.portal.xml.SAXReaderImpl.read(SAXReaderImpl.java:419)
at com.liferay.portal.kernel.xml.SAXReaderUtil.read(SAXReaderUtil.java:157)
at com.liferay.portal.service.impl.PortletLocalServiceImpl._readPortletXML(PortletLocalServiceImpl.java:1918)
at com.liferay.portal.service.impl.PortletLocalServiceImpl.initWAR(PortletLocalServiceImpl.java:702)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:112)
at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:211)
at $Proxy64.initWAR(Unknown Source)
at com.liferay.portal.service.PortletLocalServiceUtil.initWAR(PortletLocalServiceUtil.java:403)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.doInvokeDeploy(PortletHotDeployListener.java:271)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:115)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._doFireDeployEvent(HotDeployUtil.java:111)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._fireDeployEvent(HotDeployUtil.java:188)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:40)
at com.liferay.portal.kernel.servlet.PortletContextListener.doPortalInit(PortletContextListener.java:101)
at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.flushInits(PortalLifecycleUtil.java:45)
at com.liferay.portal.servlet.MainServlet.initPlugins(MainServlet.java:813)
at com.liferay.portal.servlet.MainServlet.init(MainServlet.java:347)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
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:5001)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5289)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:842)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:649)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1581)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
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)
Caused by: org.dom4j.DocumentException: Error on line 9 of document : cvc-complex-type.2.4.a: Invalid content was found starting with element 'init-param'. One of '{"http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd":cache-scope, "http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd":supports}' is expected. Nested exception: cvc-complex-type.2.4.a: Invalid content was found starting with element 'init-param'. One of '{"http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd":cache-scope, "http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd":supports}' is expected.
at org.dom4j.io.SAXReader.read(SAXRead java:482)
at org.dom4j.io.SAXReader.read(SAXReader.java:365)
at com.liferay.portal.xml.SAXReaderImpl.read(SAXReaderImpl.java:400)
... 40 more
19:48:21,560 INFO [PortletHotDeployListener:438] 0 portlets for ManaarNetVf-portlet are available for use

So don't I need a way to implement <init-param> in my custom class in the portlet.xml?
thumbnail
Gregory Amerson, modificado hace 11 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

Liferay Legend Mensajes: 1123 Fecha de incorporación: 16/02/10 Mensajes recientes
Can you post your most recent source as a zip file here?
Jaafar Altaie, modificado hace 11 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

Junior Member Mensajes: 69 Fecha de incorporación: 26/04/12 Mensajes recientes
Here it is. On this one I just tried to create the custom class without first creating a new project then adding new portlet. I created New Project and simply chose the 'custom portlet' option.
Jaafar Altaie, modificado hace 11 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

Junior Member Mensajes: 69 Fecha de incorporación: 26/04/12 Mensajes recientes
Is my last attachment ok? I basically went as far as I could on the previous project. I could see no way to implement a functioning plugin. I tried a new project but even that does not seem to allow a functioning plugin. Please let me know if you need me to send anymore information. Thanks!
thumbnail
Gregory Amerson, modificado hace 11 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

Liferay Legend Mensajes: 1123 Fecha de incorporación: 16/02/10 Mensajes recientes
Hey Jaafar,

I think at this point your best bet is a fresh, clean start with the latest version of the Portal, 6.1.0 and latest version of Eclipse + Liferay IDE. I'll repost my info that I posted on another thread here to try to see if this can help get you going.

Download latest Liferay Portal and Liferay Plugins SDK from here:
http://sourceforge.net/projects/lportal/files/Liferay%20Portal/6.1.0%20GA1/

Then download the latest Eclipse 3.7.2+Liferay IDE 1.5.3 bundle from here:
http://sourceforge.net/projects/lportal/files/Liferay%20IDE/1.5.3/

Then follow the getting started guide (4 pages) here for creating your first custom portlet plugin and adding it to the portal:
http://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/set--4
http://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/testing-launching-liferay-tomcat-serv-4
http://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/creating-new-liferay-projec-4
http://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/deploying-new-liferay-projects-to-liferay-serv-4
Jaafar Altaie, modificado hace 11 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

Junior Member Mensajes: 69 Fecha de incorporación: 26/04/12 Mensajes recientes
Hey Gregory,

This basically means rebuilding the entire portal application from scratch unless there's some easy way to back up and restore the work already done. I'd also like to know any required steps for deleting the database schema. If that's practical enough I'm totally fine to do that, but if I have to start from scratch to simply get a basic plugin working I'd want to start thinking of a more efficient alternative.

Are plugins the only way to add (POJO) plain old java classes and associated jsps to the portal? Please advise! Many thanks!
Jaafar Altaie, modificado hace 11 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

Junior Member Mensajes: 69 Fecha de incorporación: 26/04/12 Mensajes recientes
Alternatively, is there a way I can run two portals whereby I can gradually transition data from the old portal to the new one? I think the trick here would be how to create or re-create the database schema? OR can I add the plugins without Liferay IDE. Would adding plugins using Eclipse manually work??
thumbnail
Luyen Tien Dinh, modificado hace 11 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

New Member Mensajes: 3 Fecha de incorporación: 8/06/12 Mensajes recientes
Hi Jaafar,
got many errors from your portlet.
+ in portlet.xml
<expiration-cache>0</expiration-cache>
<init-param>
<name>view-template</name>
<value>/view.jsp</value>
</init-param>
<init-param>
<name>edit-jsp</name>
<value>/edit.jsp</value>
</init-param>
you need to put <expiration-cache> tag after <init-param> tag:
<init-param>
<name>view-template</name>
<value>/view.jsp</value>
</init-param>
<init-param>
<name>edit-jsp</name>
<value>/edit.jsp</value>
</init-param>
<expiration-cache>0</expiration-cache>
+ in ManVf.java this line: viewJSP = getInitParameter("view-jsp"); (this line will work in 6.0.x version), in 6.1 you need to change like this: viewJSP = getInitParameter("view-template");
+ 1 more thing: in view.jsp: <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %> , why dont you use <%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
+ instead using <jsp:useBean> using can use <%=request.getAttribute("userName"%>
Jaafar Altaie, modificado hace 11 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

Junior Member Mensajes: 69 Fecha de incorporación: 26/04/12 Mensajes recientes
Hi Luyen!

Great suggestions!! Thank you, but looks like exactly the same error. The code modifications you suggested make a lot of sense but looks like they have minimal impact. Do you think this is a configuration issue? Bug? Corrupt installation?


I would have thought it would be easier than this to add such basic plug ins. Would appreciate any further advice. THANK YOU!
thumbnail
Luyen Tien Dinh, modificado hace 11 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

New Member Mensajes: 3 Fecha de incorporación: 8/06/12 Mensajes recientes
Hi Jaafar,
For me it's working fine.
+ I used Eclipse Indigo 3.7.2 (the lastest version from www.eclipse.org) - and fixed ECJ http://www.liferay.com/community/wiki/-/wiki/Main/ECJ)
+ liferay-ide-eclipse-updatesite-1.5.3.zip
+ liferay portal and plugin sdk 6.1bundle with tomcat 6.1 GA (CE)

Regards,
Luyen
Jaafar Altaie, modificado hace 11 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

Junior Member Mensajes: 69 Fecha de incorporación: 26/04/12 Mensajes recientes
Hi Luyen,

Seems like I might have a corrupt installation of Liferay bundle. To reinstall I need to figure if there's any way I can back up and restore the contents of my existing portal.

If you have any suggestions on that it would be great otherwise I will post a separate thread on that issue. THANK YOU!
thumbnail
Puspak Das, modificado hace 10 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

New Member Mensaje: 1 Fecha de incorporación: 20/03/14 Mensajes recientes
Hello Gregorry,

I am also getting the similar kind of exception .

Here it goes below...

04:50:35,646 INFO [localhost-startStop-1][PortletHotDeployListener:343] Registering portlets for library-portlet
04:50:35,686 ERROR [localhost-startStop-1][PortletBagFactory:411] java.lang.ClassNotFoundException: com.library.LibraryPortlet
java.lang.ClassNotFoundException: com.library.LibraryPortlet
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at com.liferay.portlet.PortletBagFactory.getPortletInstance(PortletBagFactory.java:408)
at com.liferay.portlet.PortletBagFactory.create(PortletBagFactory.java:121)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.doInvokeDeploy(PortletHotDeployListener.java:369)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:124)
at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:205)
at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:232)
at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:232)
at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:232)
at com.liferay.portal.deploy.hot.HotDeployImpl.fireDeployEvent(HotDeployImpl.java:96)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:27)
at com.liferay.portal.kernel.servlet.PluginContextListener.fireDeployEvent(PluginContextListener.java:164)
at com.liferay.portal.kernel.servlet.PluginContextListener.doPortalInit(PluginContextListener.java:154)
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.PluginContextListener.contextInitialized(PluginContextListener.java:116)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
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.addChild(ContainerBase.java:877)
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(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
04:50:35,905 ERROR [localhost-startStop-1][PortletBagFactory:340] javax.portlet.PortletException: java.lang.NullPointerException
javax.portlet.PortletException: java.lang.NullPointerException
at com.liferay.portlet.InvokerPortletFactoryImpl.create(InvokerPortletFactoryImpl.java:63)
at com.liferay.portlet.PortletInstanceFactoryImpl.init(PortletInstanceFactoryImpl.java:225)
at com.liferay.portlet.PortletInstanceFactoryImpl.create(PortletInstanceFactoryImpl.java:145)
at com.liferay.portlet.PortletInstanceFactoryUtil.create(PortletInstanceFactoryUtil.java:41)
at com.liferay.portlet.PortletBagFactory.create(PortletBagFactory.java:337)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.doInvokeDeploy(PortletHotDeployListener.java:369)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:124)
at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:205)
at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:232)
at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:232)
at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:232)
at com.liferay.portal.deploy.hot.HotDeployImpl.fireDeployEvent(HotDeployImpl.java:96)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:27)
at com.liferay.portal.kernel.servlet.PluginContextListener.fireDeployEvent(PluginContextListener.java:164)
at com.liferay.portal.kernel.servlet.PluginContextListener.doPortalInit(PluginContextListener.java:154)
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.PluginContextListener.contextInitialized(PluginContextListener.java:116)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
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.addChild(ContainerBase.java:877)
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(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at com.liferay.portlet.InvokerPortletImpl.<init>(InvokerPortletImpl.java:169)
at com.liferay.portlet.InvokerPortletFactoryImpl.create(InvokerPortletFactoryImpl.java:56)
... 33 more
04:50:35,907 ERROR [localhost-startStop-1][HotDeployImpl:208] com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering portlets for library-portletlibrary-portlet
com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering portlets for library-portletlibrary-portlet
at com.liferay.portal.kernel.deploy.hot.BaseHotDeployListener.throwHotDeployException(BaseHotDeployListener.java:46)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:127)
at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:205)
at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:232)
at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:232)
at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:232)
at com.liferay.portal.deploy.hot.HotDeployImpl.fireDeployEvent(HotDeployImpl.java:96)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:27)
at com.liferay.portal.kernel.servlet.PluginContextListener.fireDeployEvent(PluginContextListener.java:164)
at com.liferay.portal.kernel.servlet.PluginContextListener.doPortalInit(PluginContextListener.java:154)
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.PluginContextListener.contextInitialized(PluginContextListener.java:116)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
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.addChild(ContainerBase.java:877)
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(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.portlet.PortletException: java.lang.NullPointerException
at com.liferay.portlet.InvokerPortletFactoryImpl.create(InvokerPortletFactoryImpl.java:63)
at com.liferay.portlet.PortletInstanceFactoryImpl.init(PortletInstanceFactoryImpl.java:225)
at com.liferay.portlet.PortletInstanceFactoryImpl.create(PortletInstanceFactoryImpl.java:145)
at com.liferay.portlet.PortletInstanceFactoryUtil.create(PortletInstanceFactoryUtil.java:41)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.initPortletApp(PortletHotDeployListener.java:620)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.doInvokeDeploy(PortletHotDeployListener.java:376)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:124)
... 27 more
Caused by: java.lang.NullPointerException
at com.liferay.portlet.InvokerPortletImpl.<init>(InvokerPortletImpl.java:169)
at com.liferay.portlet.InvokerPortletFactoryImpl.create(InvokerPortletFactoryImpl.java:56)
... 33 more
Mar 20, 2014 4:50:36 AM org.apache.catalina.startup.HostConfig deployDirectory

i have tried setting :-

<property name="java-output-path" value="/library-portlet/docroot/WEB-INF/classes"/> in ( org.eclipse.wst.common.component)
and
<classpathentry kind="output" path="docroot/WEB-INF/classes"/>

Not working....at all


Kindly reply please...
thumbnail
Gregory Amerson, modificado hace 9 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

Liferay Legend Mensajes: 1123 Fecha de incorporación: 16/02/10 Mensajes recientes
What is the contents of the deployed folder in tomcat/webapps/... look like? Does it contain the web classes?
Jaafar Altaie, modificado hace 11 años.

RE: Liferay In Action ClassNotFoundException for Hello You Portlet Example

Junior Member Mensajes: 69 Fecha de incorporación: 26/04/12 Mensajes recientes
NOT SURE IF THIS BUG IS STILL PRESENT. I installed 1.5.3, created a new portlet and get the following error:

16:08:34,981 ERROR [PortletBagFactory:123] java.lang.ClassNotFoundException: com.test.ManaarNetVa
java.lang.ClassNotFoundException: com.test.ManaarNetVa
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533)
at com.liferay.portlet.PortletBagFactory.create(PortletBagFactory.java:120)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.initPortlet(PortletHotDeployListener.java:524)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.doInvokeDeploy(PortletHotDeployListener.java:302)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:115)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._doFireDeployEvent(HotDeployUtil.java:111)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._fireDeployEvent(HotDeployUtil.java:188)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:40)
at com.liferay.portal.kernel.servlet.PortletContextListener.doPortalInit(PortletContextListener.java:101)
at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:61)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:53)
at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:52)
at com.liferay.portal.kernel.servlet.PortletContextListener.contextInitialized(PortletContextListener.java:55)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4765)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5260)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:842)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1095)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1617)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
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)
16:08:34,986 INFO [PortletHotDeployListener:438] 0 portlets for ManaarNetv2a-portlet are available for use


package com.test;


import java.io.IOException;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
import javax.portlet.PortletMode;
import javax.portlet.PortletPreferences;
import javax.portlet.PortletRequestDispatcher;
import javax.portlet.PortletURL;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


public class ManaarNetVa extends GenericPortlet {

public void init() throws PortletException {
editJSP = getInitParameter("edit-jsp");
viewJSP = getInitParameter("view-jsp");
}


public void doEdit(RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException {
renderResponse.setContentType("text/html");
PortletURL addName = renderResponse.createActionURL();
addName.setParameter("addName", "addName");
renderRequest.setAttribute("addNameUrl", addName.toString());
include(editJSP, renderRequest, renderResponse);
}


public void doView(RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException {
PortletPreferences prefs = renderRequest.getPreferences();
String username = (String) prefs.getValue("name", "no");
if (username.equalsIgnoreCase("no")) {
username = "";
}
renderRequest.setAttribute("userName", username);
include(viewJSP, renderRequest, renderResponse);
}

public void processAction(
ActionRequest actionRequest, ActionResponse actionResponse)
throws IOException, PortletException {
String addName = actionRequest.getParameter("addName");
if (addName != null) {
PortletPreferences prefs = actionRequest.getPreferences();
prefs.setValue("name", actionRequest.getParameter("username"));
prefs.store();
actionResponse.setPortletMode(PortletMode.VIEW);
}
}

protected void include(
String path, RenderRequest renderRequest,
RenderResponse renderResponse)
throws IOException, PortletException {

PortletRequestDispatcher portletRequestDispatcher =
getPortletContext().getRequestDispatcher(path);

if (portletRequestDispatcher == null) {
_log.error(path + " is not a valid include");
}
else {
portletRequestDispatcher.include(renderRequest, renderResponse);
}
}

protected String editJSP;
protected String viewJSP;

private static Log _log = LogFactory.getLog(ManaarNetVa.class);

}


<?xml version="1.0"?>

<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0">

<portlet>
<portlet-name>manaarnetva</portlet-name>
<display-name>ManaarNetVa</display-name>
<portlet-class>com.test.ManaarNetVa</portlet-class>
<init-param>
<name>view-template</name>
<value>/view/view.jsp</value>
</init-param>
<init-param>
<name>edit-template</name>
<value>/view/edit.jsp</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
<portlet-mode>edit</portlet-mode>
</supports>
<portlet-info>
<title>ManaarNetVa</title>
<short-title>ManaarNetVa</short-title>
<keywords></keywords>
</portlet-info>
<security-role-ref>
<role-name>administrator</role-name>
</security-role-ref>
<security-role-ref>
<role-name>guest</role-name>
</security-role-ref>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
</portlet-app>