You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by F Da Costa <da...@xs4all.nl> on 2004/08/03 17:51:52 UTC

Re: Dealing with classLoaders

Howard Lewis Ship wrote:
> Tapestry uses the curernt Thread's contextClassLoader to instantiate
> instances of components, pages, visit object, global object, etc.
> 
Fair enough.
managed to get the whole db thing organized and working in a firly 
generic fashion. Through the contextClassLoader (which at startup always 
seems to be the Jetty one).

After dealing with that i tried the following method:
...
public ITableDataModel getData2bShown() {
  Object[] _objects;
  Visit v = (Visit) getEngine().getVisit();
  AGenericUser u = 
v.getUser();Thread.currentThread().getContextClassLoader()
  _objects = ((User) u).getInsuredOOVs();
  _tableDataModel = new SimpleListTableDataModel(_objects);
  return _tableDataModel;
}
...

Following the debug output for the classloader(s), appently, used.
Thread.currentThread().getContextClassLoader()
  (org.mortbay.http.ContextLoader) ContextLoader@13121485

*code: Visit visit = (Visit) getEngine().getVisit();*
getEngine().getClass().getClassLoader()
(sun.misc.Launcher$AppClassLoader)sun.misc.Launcher$AppClassLoader@53ba3d
visit.getClass().getClassLoader()
(sun.misc.Launcher$AppClassLoader)sun.misc.Launcher$AppClassLoader@53ba3d
	
*code: object[] _objects = ((User) u).getInsuredOOVs()*
User.class.getClassLoader()
(org.mortbay.http.ContextLoader) ContextLoader@13121485
u.getClass().getClassLoader()
(sun.misc.Launcher$AppClassLoader)sun.misc.Launcher$AppClassLoader@53ba3d

As one can see the getEngine() does not have the same classloader are 
the currentThread does. I have no idea whether this is correct or not 
but i do know i'm kinda caught between a rock and a hard place at the 
moment.
Any suggestions (more info required?)?

TIA
Fermin DCG


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Dealing with classLoaders

Posted by F Da Costa <da...@xs4all.nl>.
Howard Lewis Ship wrote:

> tapestry-xxx.jar must be on the system classpath and possibly in your
> WEB-INF/ilib folder as well. Check for out of date version of the
> tapestry jars in the wrong places.
> 
System.getProperty("java.class.path")
	 (java.lang.String)
	 C:\jetty4\lib\org.mortbay.jetty.jar;
	 C:\jetty4\lib\javax.servlet.jar;
	 C:\jetty4\ext\jasper-compiler.jar;
	 C:\jetty4\ext\jasper-runtime.jar;...;
c:\eclipse\workspace\oovregistrar\oovregistrar\WEB-INF\classes;...;
C:\eclipse\plugins\com.iw.plugins.spindle.core_0.1.6\tapestry-3.0.jar;
C:\eclipse\plugins\com.iw.plugins.spindle.core_0.1.6\tapestry-contrib-3.0.jar;...;
c:\eclipse\workspace\genericEngine\genericEngine\WEB-INF\classes;
	 C:\jetty4\lib\javax.servlet.jar;
	 C:\jetty4\lib\org.mortbay.jetty.jar;
	 C:\jetty4\lib\org.mortbay.jmx.jar;
	 C:\jetty4\ext\jsse.jar;...;
	 C:\jetty4\lib\org.mortbay.jmx.jar;
	 C:\jetty4\lib\org.mortbay.jetty.jar;
	 C:\jetty4\lib\javax.servlet.jar;
	 C:\j2sdk1.4.2_05\lib\tools.jar

Putting the tapestry.jar int the WEB-INF/lib immediately gives me a 
Servlet exception, so maybe i'm better of not doing that (at least 
within the Eclipse with Jetty environment).

Out of date verions would be strange for i'm only using Spindle to get a 
hold of the tapestry jars. No other ones on the machine anywhere. 
Actually implossible because i never touch WEB-INF/lib and i had to 
completely scratch my machine a couple of weeks ago.

Also tried the retrieval in a slightly different setting. Not getting 
the object via an object gotten through the engine but directly from the 
db. This worked fine. So at least the issue is reasonably narrowed down 
(or is it?)

Anything else i can look at or failed to supply?
I'm just not getting any of this.

It couldn't be the fact that i'm using two projects (the running project 
using the supporting one to supply standard stuff like db functionality 
etc.)

TIA,
Fermin

> On Tue, 03 Aug 2004 17:51:52 +0200, F Da Costa <da...@xs4all.nl> wrote:
> 
>>Howard Lewis Ship wrote:
>>
>>>Tapestry uses the curernt Thread's contextClassLoader to instantiate
>>>instances of components, pages, visit object, global object, etc.
>>>
>>
>>Fair enough.
>>managed to get the whole db thing organized and working in a firly
>>generic fashion. Through the contextClassLoader (which at startup always
>>seems to be the Jetty one).
>>
>>After dealing with that i tried the following method:
>>....
>>public ITableDataModel getData2bShown() {
>>  Object[] _objects;
>>  Visit v = (Visit) getEngine().getVisit();
>>  AGenericUser u =
>>v.getUser();Thread.currentThread().getContextClassLoader()
>>  _objects = ((User) u).getInsuredOOVs();
>>  _tableDataModel = new SimpleListTableDataModel(_objects);
>>  return _tableDataModel;
>>}
>>....
>>
>>Following the debug output for the classloader(s), appently, used.
>>Thread.currentThread().getContextClassLoader()
>>  (org.mortbay.http.ContextLoader) ContextLoader@13121485
>>
>>*code: Visit visit = (Visit) getEngine().getVisit();*
>>getEngine().getClass().getClassLoader()
>>(sun.misc.Launcher$AppClassLoader)sun.misc.Launcher$AppClassLoader@53ba3d
>>visit.getClass().getClassLoader()
>>(sun.misc.Launcher$AppClassLoader)sun.misc.Launcher$AppClassLoader@53ba3d
>>        
>>*code: object[] _objects = ((User) u).getInsuredOOVs()*
>>User.class.getClassLoader()
>>(org.mortbay.http.ContextLoader) ContextLoader@13121485
>>u.getClass().getClassLoader()
>>(sun.misc.Launcher$AppClassLoader)sun.misc.Launcher$AppClassLoader@53ba3d
>>
>>As one can see the getEngine() does not have the same classloader are
>>the currentThread does. I have no idea whether this is correct or not
>>but i do know i'm kinda caught between a rock and a hard place at the
>>moment.
>>Any suggestions (more info required?)?
>>
>>
>>
>>TIA
>>Fermin DCG
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Dealing with classLoaders

Posted by Howard Lewis Ship <hl...@gmail.com>.
tapestry-xxx.jar must be on the system classpath and possibly in your
WEB-INF/ilib folder as well. Check for out of date version of the
tapestry jars in the wrong places.

On Tue, 03 Aug 2004 17:51:52 +0200, F Da Costa <da...@xs4all.nl> wrote:
> Howard Lewis Ship wrote:
> > Tapestry uses the curernt Thread's contextClassLoader to instantiate
> > instances of components, pages, visit object, global object, etc.
> > 
> Fair enough.
> managed to get the whole db thing organized and working in a firly
> generic fashion. Through the contextClassLoader (which at startup always
> seems to be the Jetty one).
> 
> After dealing with that i tried the following method:
> ....
> public ITableDataModel getData2bShown() {
>   Object[] _objects;
>   Visit v = (Visit) getEngine().getVisit();
>   AGenericUser u =
> v.getUser();Thread.currentThread().getContextClassLoader()
>   _objects = ((User) u).getInsuredOOVs();
>   _tableDataModel = new SimpleListTableDataModel(_objects);
>   return _tableDataModel;
> }
> ....
> 
> Following the debug output for the classloader(s), appently, used.
> Thread.currentThread().getContextClassLoader()
>   (org.mortbay.http.ContextLoader) ContextLoader@13121485
> 
> *code: Visit visit = (Visit) getEngine().getVisit();*
> getEngine().getClass().getClassLoader()
> (sun.misc.Launcher$AppClassLoader)sun.misc.Launcher$AppClassLoader@53ba3d
> visit.getClass().getClassLoader()
> (sun.misc.Launcher$AppClassLoader)sun.misc.Launcher$AppClassLoader@53ba3d
>         
> *code: object[] _objects = ((User) u).getInsuredOOVs()*
> User.class.getClassLoader()
> (org.mortbay.http.ContextLoader) ContextLoader@13121485
> u.getClass().getClassLoader()
> (sun.misc.Launcher$AppClassLoader)sun.misc.Launcher$AppClassLoader@53ba3d
> 
> As one can see the getEngine() does not have the same classloader are
> the currentThread does. I have no idea whether this is correct or not
> but i do know i'm kinda caught between a rock and a hard place at the
> moment.
> Any suggestions (more info required?)?
> 
> 
> 
> TIA
> Fermin DCG
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org