WebSphere Portal Server - Forcing Class Loader

This is Interesting: Free IT Magazines  
Home > Archive > WebSphere Portal Server > May 2004 > Forcing Class Loader





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Forcing Class Loader
Justin F. Knotzke

2004-05-10, 5:40 pm

Hi,

I have some code which works fine inside WSAD Runtime but when I deploy, I
get a NoClassDefFound error:

Nested Exception is java.lang.NoClassDefFoundError:
org/apache/commons/beanutils/MethodUtils
at org.apache.commons.beanutils.PropertyUtils.getReadMethod(PropertyUtils.java:1114)
at org.apache.commons.beanutils.PropertyUtils.getSimpleProperty(PropertyUtils.java:1178)
at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:772)
at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:801)
at gov.pgse.expressions.GenericExpressionSolver.solveProperty(GenericExpressionSolver.java:18)
at gov.pgse.expressions.Property.solve(Property.java:28)
at gov.pgse.expressions.AbstractExpressionSolver.solveContains(AbstractExpressionSolver.java:75)
at gov.pgse.expressions.ContainsExpression.solve(ContainsExpression.java:19)
at gov.pgse.communs.util.CollectionUtils.select(CollectionUtils.java:123)
at gov.pgse.portlet.PGSEToolsPortlet.doAideAction(PGSEToolsPortlet.java:691)

My thinking is that Portal or WAS is packaging PropertyUtils and not
MethodUtils. My Portlet has all the required JARS. That I am sure of. But I
think Portal is picking up its PropertyUtils first..

Any ideas how to fix this?

Thanks

J




--
Justin F. Knotzke
jknotzke@shampoo.ca
http://www.shampoo.ca PGP: http://www.shampoo.ca/pubkey.txt
I told you the Leafs Suck.
Arvind

2004-05-10, 5:40 pm

Assuming it is just the class loading problem...you will have to
set/reset classloading to PARENT_LAST.

Based on my understanding ; portal defaults classloading to
PARENT_LAST.

This would mean that, the WAR class loader tries first then goes to
the top of the hier and then starts climbing down the ladder - finally
reaching the parent.... Hence the name PARENT_LAST.

Be advised that such a move; might potentially crash Portal; coz
portal has done this; not for nothing ;)


Assuming it is not this problem - try to write a simple servlet; that
tries to load any given class (Class.forName) and then get the real
path.

this way you will exactly know the location(including the physical
path)

Arvind



"Justin F. Knotzke" <jknotzke@shampoo.ca> wrote in message news:<slrnc9v3i0.387.jknotzke@shampoo.ca>...
> Hi,
>
> I have some code which works fine inside WSAD Runtime but when I deploy, I
> get a NoClassDefFound error:
>
> Nested Exception is java.lang.NoClassDefFoundError:
> org/apache/commons/beanutils/MethodUtils
> at org.apache.commons.beanutils.PropertyUtils.getReadMethod(PropertyUtils.java:1114)
> at org.apache.commons.beanutils.PropertyUtils.getSimpleProperty(PropertyUtils.java:1178)
> at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:772)
> at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:801)
> at gov.pgse.expressions.GenericExpressionSolver.solveProperty(GenericExpressionSolver.java:18)
> at gov.pgse.expressions.Property.solve(Property.java:28)
> at gov.pgse.expressions.AbstractExpressionSolver.solveContains(AbstractExpressionSolver.java:75)
> at gov.pgse.expressions.ContainsExpression.solve(ContainsExpression.java:19)
> at gov.pgse.communs.util.CollectionUtils.select(CollectionUtils.java:123)
> at gov.pgse.portlet.PGSEToolsPortlet.doAideAction(PGSEToolsPortlet.java:691)
>
> My thinking is that Portal or WAS is packaging PropertyUtils and not
> MethodUtils. My Portlet has all the required JARS. That I am sure of. But I
> think Portal is picking up its PropertyUtils first..
>
> Any ideas how to fix this?
>
> Thanks
>
> J

Justin F. Knotzke

2004-05-10, 5:40 pm

<quote who= Arvind email=asrinivasan@worldbank.org/>:

> Assuming it is not this problem - try to write a simple servlet; that
> tries to load any given class (Class.forName) and then get the real
> path.


Ok. I tried the following:

Class foo = Class.forName("org.apache.commons.beanutils.MethodUtils");

Inside WSAD, this works like a charm.

When I deploy to Portal, it does not.

All of the required jars including MethodUtils are in WEB-INF/lib of my
Portlet.

Any ideas because I am SO stumped.

Thanks

J


--
Justin F. Knotzke
jknotzke@shampoo.ca
http://www.shampoo.ca PGP: http://www.shampoo.ca/pubkey.txt
I told you the Leafs Suck.
Dexthor

2004-05-17, 1:35 pm

Can you check if other Jars in the WEB-INF/lib folder are accessible to your
Portlet ?? It is class pathing problem for sure, not sure if it is inflicted
by the way you have packaged the Portlet or the Mainfest setting.

Sometimes dropping the Jar that you are in trouble with in the
$WAS_HOME/java/jre/lib/ext folder might help. I dont like this idea though.

-Dexthor.

"Justin F. Knotzke" <jknotzke@shampoo.ca> wrote in message
news:slrnc9vn4h.387.jknotzke@shampoo.ca...
> <quote who= Arvind email=asrinivasan@worldbank.org/>:
>
>
> Ok. I tried the following:
>
> Class foo = Class.forName("org.apache.commons.beanutils.MethodUtils");
>
> Inside WSAD, this works like a charm.
>
> When I deploy to Portal, it does not.
>
> All of the required jars including MethodUtils are in WEB-INF/lib of my
> Portlet.
>
> Any ideas because I am SO stumped.
>
> Thanks
>
> J
>
>
> --
> Justin F. Knotzke
> jknotzke@shampoo.ca
> http://www.shampoo.ca PGP: http://www.shampoo.ca/pubkey.txt
> I told you the Leafs Suck.



Justin F. Knotzke

2004-05-20, 5:36 pm

<quote who= Dexthor email=gopalaratnam_forgetit@hotemail.com/>:
> Can you check if other Jars in the WEB-INF/lib folder are accessible to your
> Portlet ?? It is class pathing problem for sure, not sure if it is inflicted
> by the way you have packaged the Portlet or the Mainfest setting.
>
> Sometimes dropping the Jar that you are in trouble with in the
> $WAS_HOME/java/jre/lib/ext folder might help. I dont like this idea though.


I have solved the problem. However, I am not entirely sure anyone will
believe me when I tell you what the problem was.

We are using a package supplied by a partner which sorts and select values
inside a List. If we attempt to sort or select on a value which is either not
there or null, the classpath is wiped out. We have to fix the bug and then
restart Portal.

I can reproduce it time and time again and I wrote some code to actually
view the before and after of the classpath.

Thanks to all who helped.

J


--
Justin F. Knotzke
jknotzke@shampoo.ca
http://www.shampoo.ca PGP: http://www.shampoo.ca/pubkey.txt
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com