Re: Classloader - WEB-INF/lib
Can you post the actual relevant lines of code? Also, I suspect for classes, Class.forName() is enough -- no need to find the class first w/ Classloader.getResource( "..." ). --David Albert Greinoecker wrote: I'm sorry I just found out that the cause of the failure described below lies one step before the class.forName-statement. Before I'm trying to load the classes with ClassLoader cld [...] URL resource = cld.getResource('path/to/the/class/file.class'); so it's clear to me that this cannot work with class-files located within a java-archive. But how can resources be loaded from jars this way? sorry for the last posting, Albert Am Mittwoch, den 10.10.2007, 08:59 -0400 schrieb David Smith: Could you post more info -- e.g. tomcat version, jvm version, class package and name you are trying to load, any relevant stack traces in the logs, etc., ... --David Albert Greinoecker wrote: Hi, I have a problem concerning the classloader tomcat is using, When I try to load a class dynamically, which is located witihn a jar-archive under /WEB-INF/lib with class.forName(), an exception is thrown. If the class is located at WEB-INF/classes, everything works fine. As classloader I am using: Thread.currentThread().getContextClassLoader(); Should I use a different one? What would be the best approach to solve this? thx, Albert - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Classloader - WEB-INF/lib
Hi AlbertWhich classloader you want depends on where you loaded your jarTake a look at http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html HTH/Martin Gainty__Disclaimer and confidentiality noteEverything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.> > I'm sorry I just found out that the cause of the failure described below> lies one step before the class.forName-statement.> > Before I'm trying to load the classes with > ClassLoader cld [...]> URL resource = cld.getResource('path/to/the/class/file.class');> so it's clear to me that this cannot work with class-files located> within a java-archive. But how can resources be loaded from jars this> way?> > sorry for the last posting,> Albert> > Am Mittwoch, den 10.10.2007, 08:59 -0400 schrieb David Smith:> > Could you post more info -- e.g. tomcat version, jvm version, class > > package and name you are trying to load, any relevant stack traces in > > the logs, etc., ...> > > > --David> > > > Albert Greinoecker wrote:> > > > >Hi,> > >> > >I have a problem concerning the classloader tomcat is using, When I try> > >to load a class dynamically, which is located witihn a jar-archive> > >under /WEB-INF/lib with class.forName(), an exception> > >is thrown. If the class is located at WEB-INF/classes, everything works> > >fine.> > >> > >As classloader I am using:> > >Thread.currentThread().getContextClassLoader(); Should I use a different> > >one? What would be the best approach to solve this?> > >> > >thx,> > >Albert> > >> > >> > >-> > >To start a new topic, e-mail: users@tomcat.apache.org> > >To unsubscribe, e-mail: [EMAIL PROTECTED]> > >For additional commands, e-mail: [EMAIL PROTECTED]> > >> > > > > >> > > > > > -> > To start a new topic, e-mail: users@tomcat.apache.org> > To unsubscribe, e-mail: [EMAIL PROTECTED]> > For additional commands, e-mail: [EMAIL PROTECTED]> > > > > -> To start a new topic, e-mail: users@tomcat.apache.org> To unsubscribe, e-mail: [EMAIL PROTECTED]> For additional commands, e-mail: [EMAIL PROTECTED]> _ Help yourself to FREE treats served up daily at the Messenger Café. Stop by today. http://www.cafemessenger.com/info/info_sweetstuff2.html?ocid=TXT_TAGLM_OctWLtagline
Re: Classloader - WEB-INF/lib
I'm sorry I just found out that the cause of the failure described below lies one step before the class.forName-statement. Before I'm trying to load the classes with ClassLoader cld [...] URL resource = cld.getResource('path/to/the/class/file.class'); so it's clear to me that this cannot work with class-files located within a java-archive. But how can resources be loaded from jars this way? sorry for the last posting, Albert Am Mittwoch, den 10.10.2007, 08:59 -0400 schrieb David Smith: > Could you post more info -- e.g. tomcat version, jvm version, class > package and name you are trying to load, any relevant stack traces in > the logs, etc., ... > > --David > > Albert Greinoecker wrote: > > >Hi, > > > >I have a problem concerning the classloader tomcat is using, When I try > >to load a class dynamically, which is located witihn a jar-archive > >under /WEB-INF/lib with class.forName(), an exception > >is thrown. If the class is located at WEB-INF/classes, everything works > >fine. > > > >As classloader I am using: > >Thread.currentThread().getContextClassLoader(); Should I use a different > >one? What would be the best approach to solve this? > > > >thx, > >Albert > > > > > >- > >To start a new topic, e-mail: users@tomcat.apache.org > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > - > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Classloader - WEB-INF/lib
Could you post more info -- e.g. tomcat version, jvm version, class package and name you are trying to load, any relevant stack traces in the logs, etc., ... --David Albert Greinoecker wrote: Hi, I have a problem concerning the classloader tomcat is using, When I try to load a class dynamically, which is located witihn a jar-archive under /WEB-INF/lib with class.forName(), an exception is thrown. If the class is located at WEB-INF/classes, everything works fine. As classloader I am using: Thread.currentThread().getContextClassLoader(); Should I use a different one? What would be the best approach to solve this? thx, Albert - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Classloader - WEB-INF/lib
Hi, I have a problem concerning the classloader tomcat is using, When I try to load a class dynamically, which is located witihn a jar-archive under /WEB-INF/lib with class.forName(), an exception is thrown. If the class is located at WEB-INF/classes, everything works fine. As classloader I am using: Thread.currentThread().getContextClassLoader(); Should I use a different one? What would be the best approach to solve this? thx, Albert - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]