Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
giorgio morini
NoClassDefFoundError: com/liferay/portlet/StrutsPortlet
4 de noviembre de 2009 6:28
Respuesta

giorgio morini

Ranking: New Member

Mensajes: 20

Fecha de incorporación: 3 de julio de 2007

Mensajes recientes

I've developed a struts portlet with the SDK plugin liferay environment for liferay 5.2.3.
I have followed all the step needs but when I deploy it I'have the following error:

11:43:12,055 ERROR [PortletHotDeployListener:436] java.lang.NoClassDefFoundError: com/liferay/portlet/StrutsPortlet
java.lang.NoClassDefFoundError: com/liferay/portlet/StrutsPortlet
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1876)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:889)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1353)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1232)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.initPortlet(PortletHotDeployListener.java:432) ....

Have you some suggestions to solve the problem?


[Thanks in advance for your help.
Minhchau Dang
RE: NoClassDefFoundError: com/liferay/portlet/StrutsPortlet
4 de noviembre de 2009 11:56
Respuesta

Minhchau Dang

LIFERAY STAFF

Ranking: Expert

Mensajes: 349

Fecha de incorporación: 22 de octubre de 2007

Mensajes recientes

Did you follow Step 8 in the Struts Action Portlet tutorial?
carlos alberto
RE: NoClassDefFoundError: com/liferay/portlet/StrutsPortlet
27 de julio de 2010 5:03
Respuesta

carlos alberto

Ranking: New Member

Mensajes: 10

Fecha de incorporación: 12 de mayo de 2010

Mensajes recientes

Minhchau Dang:
Did you follow Step 8 in the Struts Action Portlet tutorial?


hi! i have the same problem. I have followed the step 8 and dont work emoticon

i use liferay last version 6.0.3 with tomcat 6.0.26. Are there problems with the last version?
carlos alberto
RE: NoClassDefFoundError: com/liferay/portlet/StrutsPortlet
29 de julio de 2010 2:11
Respuesta

carlos alberto

Ranking: New Member

Mensajes: 10

Fecha de incorporación: 12 de mayo de 2010

Mensajes recientes

Nobody has the same problem with the last version??
Tina Agrawal
RE: NoClassDefFoundError: com/liferay/portlet/StrutsPortlet
29 de julio de 2010 5:32
Respuesta

Tina Agrawal

Ranking: Expert

Mensajes: 255

Fecha de incorporación: 2 de enero de 2008

Mensajes recientes

Looks like you have defined your portlet class to be something like this -
1<portlet-class>com.liferay.portlet.StrutsPortlet</portlet-class>


If you are doing so you need to change the class loader.

A better idea is to use the Apache Struts Bridge Portlet class in Plugins SDK.

1<portlet-class>org.apache.portals.bridges.struts.StrutsPortlet</portlet-class>


Regards,
Tina
carlos alberto
RE: NoClassDefFoundError: com/liferay/portlet/StrutsPortlet
30 de julio de 2010 0:53
Respuesta

carlos alberto

Ranking: New Member

Mensajes: 10

Fecha de incorporación: 12 de mayo de 2010

Mensajes recientes

Tina Agrawal:
Looks like you have defined your portlet class to be something like this -
1<portlet-class>com.liferay.portlet.StrutsPortlet</portlet-class>


If you are doing so you need to change the class loader.

A better idea is to use the Apache Struts Bridge Portlet class in Plugins SDK.

1<portlet-class>org.apache.portals.bridges.struts.StrutsPortlet</portlet-class>


Regards,
Tina


thks for your answer, but i think this is a "patch" because the real problem exists yet. If i want to use libreries that is in webapps\ROOT\WEB-INF\lib, what will i do? context.xml in version 6 don't work me!!
Vikas Jindal
RE: NoClassDefFoundError: com/liferay/portlet/StrutsPortlet
30 de julio de 2010 1:40
Respuesta

Vikas Jindal

Ranking: New Member

Mensajes: 18

Fecha de incorporación: 6 de noviembre de 2008

Mensajes recientes

Hi,

This solution will work if you are using tomcat :

Chekck if META-INF/context.xml exists in your portlet war with folloing content:


<?xml version="1.0" encoding="UTF-8"?>

<Context>
<Loader
loaderClass="com.liferay.support.tomcat.loader.PortalClassLoader"
/>

</Context>


Also check if "support-tomcat.jar" in your tomcat 's server\lib.

Thanks
-Vikas
carlos alberto
RE: NoClassDefFoundError: com/liferay/portlet/StrutsPortlet
30 de julio de 2010 4:14
Respuesta

carlos alberto

Ranking: New Member

Mensajes: 10

Fecha de incorporación: 12 de mayo de 2010

Mensajes recientes

Vikas Jindal:
Hi,

This solution will work if you are using tomcat :

Chekck if META-INF/context.xml exists in your portlet war with folloing content:


<?xml version="1.0" encoding="UTF-8"?>

<Context>
<Loader
loaderClass="com.liferay.support.tomcat.loader.PortalClassLoader"
/>

</Context>


Also check if "support-tomcat.jar" in your tomcat 's server\lib.

Thanks
-Vikas


yes, this is "the step 8" that said Minhchau Dang in the second answer, but dont work me. I think is a problem with a liferay 6.0.3, because with 5.2 works me! emoticon
george xiang
RE: NoClassDefFoundError: com/liferay/portlet/StrutsPortlet
10 de agosto de 2010 19:28
Respuesta

george xiang

Ranking: New Member

Mensajes: 7

Fecha de incorporación: 17 de octubre de 2007

Mensajes recientes

I hava the same situation,my portlet can work on liferay 5.2.* version ,but cannot work on liferay 6.0.* version ,I doubt it is a liferay 6.0.* bug ,anyone who can help me to solve the problem ?
stephan t
RE: NoClassDefFoundError: com/liferay/portlet/StrutsPortlet
24 de enero de 2011 1:27
Respuesta

stephan t

Ranking: Junior Member

Mensajes: 48

Fecha de incorporación: 19 de octubre de 2010

Mensajes recientes

Hi there,

I have the same problem with 5.2.9. (haven't tried with anything else).
Step 8 mentioned above doesn't help here either.
My portlet class extends com.liferay.portlet.StrutsPortlet.
At the beginning it didn't even compile with ant. I had to add the portal-impl.jar to the classpath in build-common.xml

Anybody out there knowing a solution to this?

Thanks for any advice
s t
Gianluca Pindinelli
RE: NoClassDefFoundError: com/liferay/portlet/StrutsPortlet
24 de enero de 2011 2:05
Respuesta

Gianluca Pindinelli

Ranking: Junior Member

Mensajes: 30

Fecha de incorporación: 17 de marzo de 2010

Mensajes recientes

If that can help you, I had same problem with LF 6.0.5. I had to use an apache struts portlet instead of a com.liferay.portlet.StrutsPortlet.
In the past I always used StrutsPortlet without problems (LF 5.2.3/Tomcat bundled).

Is this a bug?
Minhchau Dang
RE: NoClassDefFoundError: com/liferay/portlet/StrutsPortlet
24 de enero de 2011 19:19
Respuesta

Minhchau Dang

LIFERAY STAFF

Ranking: Expert

Mensajes: 349

Fecha de incorporación: 22 de octubre de 2007

Mensajes recientes

Gianluca Pindinelli:
Is this a bug?

Well, specifying class loaders is a feature specific to each application server. If you compare the Tomcat 5.5 documentation (where any class loader is valid) and the Tomcat 6.0 documentation (where only specific class loaders inheriting from Tomcat's class loader are valid), you'll find that it's technically not a bug, but rather intended behavior.

If you want to be able to use Liferay's portal-impl.jar classes in your plugins portlet, you'll have to figure out how to put Liferay 6.0 back onto Tomcat 5.5 (and lose any of the bugs or performance fixes that occurred between the Tomcat releases), since we no longer provide a bundle for it.
Gianluca Pindinelli
RE: NoClassDefFoundError: com/liferay/portlet/StrutsPortlet
25 de enero de 2011 0:53
Respuesta

Gianluca Pindinelli

Ranking: Junior Member

Mensajes: 30

Fecha de incorporación: 17 de marzo de 2010

Mensajes recientes

Ok..all clear emoticon
I believe the same problem also occurs with JBoss 5.1.0 then, because even with this AS the problem persists.
I hope we can find a solution as soon as possible.

Thanks Minhchau ;)
stephan t
RE: NoClassDefFoundError: com/liferay/portlet/StrutsPortlet
25 de enero de 2011 6:39
Respuesta

stephan t

Ranking: Junior Member

Mensajes: 48

Fecha de incorporación: 19 de octubre de 2010

Mensajes recientes

hi there,

thanks for your replies.

I found a few links that might be of interest:
http://www.liferay.com/community/forums/-/message_boards/message/4824410
http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Developing+Struts+Based+Portlets+on+Liferay+Portal

However the workarounds in those links either didn't work for me or opened up other problems (like class cast exceptions).


@Minhchau: Is there an official Liferay suggestion for developing struts portlets? Or is this topic out of scope completely. I couldn't find any answer out there so far. (I mean there are sample projects in the trunk that don't work with new tomcat versions, like the sample-struts-liferay-portlet.)


Any help is appreciated
Thanks
s t
Minhchau Dang
RE: NoClassDefFoundError: com/liferay/portlet/StrutsPortlet
25 de enero de 2011 11:00
Respuesta

Minhchau Dang

LIFERAY STAFF

Ranking: Expert

Mensajes: 349

Fecha de incorporación: 22 de octubre de 2007

Mensajes recientes

s t:
@Minhchau: Is there an official Liferay suggestion for developing struts portlets? Or is this topic out of scope completely.

The answer largely boils down to why you're choosing Struts as a framework as opposed to all the other frameworks that are available out there (JSF, Spring MVC, GWT, etc.).

If what you want is something that is Struts specific and cannot be easily achieved in another framework, then the Struts portlet 1.0 bridge is known to work, but since it's no longer maintained, there are limitations to what you can do with it as well as bugs you need to workaround when using it.
stephan t
RE: NoClassDefFoundError: com/liferay/portlet/StrutsPortlet
3 de febrero de 2011 8:07
Respuesta

stephan t

Ranking: Junior Member

Mensajes: 48

Fecha de incorporación: 19 de octubre de 2010

Mensajes recientes

The answer largely boils down to why you're choosing Struts as a framework as opposed to all the other frameworks that are available out there (JSF, Spring MVC, GWT, etc.).


I wouldn't do struts if I didn't have portlets within a portal that is about to receive an upgrade from 5.2 SP4 to SP5 (and that is where the tomcat version changed and struts portlets aren't working in the way they did).


Thanks
s t
Brian Scott Schupbach
RE: NoClassDefFoundError: com/liferay/portlet/StrutsPortlet
11 de mayo de 2011 8:34
Respuesta

Brian Scott Schupbach

Ranking: Expert

Mensajes: 329

Fecha de incorporación: 23 de octubre de 2008

Mensajes recientes

So, it is decided that in order to fix this the only way to do so is to use tomcat 5.5 instead of 6?
stephan t
RE: NoClassDefFoundError: com/liferay/portlet/StrutsPortlet
11 de mayo de 2011 23:57
Respuesta

stephan t

Ranking: Junior Member

Mensajes: 48

Fecha de incorporación: 19 de octubre de 2010

Mensajes recientes

Hi Brian,

after reading a while I came to the conclusion that the way the newer tomcat 6 works is the way it should work and you should develop portlets. That is: do not include jars of the ROOT application (in this case Liferay's portal-impl.jar). This is on first sight a limitation but enforces cleaner architecture and dependencies. Portlet should be independent of the container they run in.

In a post on a random website I found this quote:
You should use apache struts bridge to handle lifecycle of struts portlet (refer sample-struts-portlet in community svn plugin repository

https://liferaycms.wordpress.com/2011/01/25/why-i-cant-use-portal-impl-in-my-portlet/

I actually never tried the sample portlet and converted the portlets I had into MVCPortlets.

Hope that helps.
Much success
Stephan