You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Reinwald Warapen <re...@directi.com> on 2011/01/19 20:17:41 UTC

Why cant the the classes (in the jars) places in Tomcat/lib see the classes from the webapp/WEB-INF/lib.

I am writing a serializer/deserializer functionality (used in my custom 
session manager that extends ManagerBase). When deserializing I get 
loads of java.lang.ClassNotFoundException: exceptions. All the classes 
for which the exceptions are thrown can be found in my 
webapp/WEB-INF/classes. How do I configure it such that the 
webapp/WEB-INF/classes are visible to the libs placed in Tomcat/lib.?

Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Why cant the the classes (in the jars) places in Tomcat/lib see the classes from the webapp/WEB-INF/lib.

Posted by Mark Thomas <ma...@apache.org>.
On 20/01/2011 14:55, Reinwald Warapen wrote:
> On 1/20/2011 8:03 PM, Caldarale, Charles R wrote:
>>> From: Reinwald Warapen [mailto:reinwald.w@directi.com]
>>> Subject: Re: Why cant the the classes (in the jars) places in
>>> Tomcat/lib see the classes from the webapp/WEB-INF/lib.
>>> After reading the docs I figured that one work around would be to define
>>> my web-app/lib in the common class loader section which can be defined
>>> in catalina.properties.
>> If I read the above properly, I think you're suggesting that the
>> common class loader be responsible for loading classes from a webapp's
>> WEB-INF/lib directory; that would be a complete disaster.  Don't even
>> think about it.

+1

>>   - Chuck
> Then how do you suggest going about it?
> 
> ClassLoader cl = manager.getContainer().getLoader().getClassLoader()
> Class.forName( className, true, cl )

That is pretty much how the FileStore and JDBCStore do it. Take a look
at the source for the exact details.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Why cant the the classes (in the jars) places in Tomcat/lib see the classes from the webapp/WEB-INF/lib.

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Reinwald Warapen [mailto:reinwald.w@directi.com] 
> Subject: Re: Why cant the the classes (in the jars) places in Tomcat/lib see the classes from the webapp/WEB-INF/lib.

> Then how do you suggest going about it?

Exactly as others have suggested.  For example:
http://marc.info/?l=tomcat-user&m=129553509607733&w=2

- Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


Re: Why cant the the classes (in the jars) places in Tomcat/lib see the classes from the webapp/WEB-INF/lib.

Posted by Reinwald Warapen <re...@directi.com>.
On 1/20/2011 8:03 PM, Caldarale, Charles R wrote:
>> From: Reinwald Warapen [mailto:reinwald.w@directi.com]
>> Subject: Re: Why cant the the classes (in the jars) places in Tomcat/lib see the classes from the webapp/WEB-INF/lib.
>> After reading the docs I figured that one work around would be to define
>> my web-app/lib in the common class loader section which can be defined
>> in catalina.properties.
> If I read the above properly, I think you're suggesting that the common class loader be responsible for loading classes from a webapp's WEB-INF/lib directory; that would be a complete disaster.  Don't even think about it.
>
>   - Chuck
Then how do you suggest going about it?

ClassLoader cl = manager.getContainer().getLoader().getClassLoader()
Class.forName( className, true, cl )
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Why cant the the classes (in the jars) places in Tomcat/lib see the classes from the webapp/WEB-INF/lib.

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Reinwald Warapen [mailto:reinwald.w@directi.com] 
> Subject: Re: Why cant the the classes (in the jars) places in Tomcat/lib see the classes from the webapp/WEB-INF/lib.

> After reading the docs I figured that one work around would be to define 
> my web-app/lib in the common class loader section which can be defined 
> in catalina.properties.

If I read the above properly, I think you're suggesting that the common class loader be responsible for loading classes from a webapp's WEB-INF/lib directory; that would be a complete disaster.  Don't even think about it.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


Re: Why cant the the classes (in the jars) places in Tomcat/lib see the classes from the webapp/WEB-INF/lib.

Posted by Reinwald Warapen <re...@directi.com>.
On 1/20/2011 4:23 AM, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Mark,
>
> On 1/19/2011 2:27 PM, Reinwald Warapen wrote:
>> On 1/20/2011 12:47 AM, Mark Thomas wrote:
>>> On 19/01/2011 19:17, Reinwald Warapen wrote:
>>>> I am writing a serializer/deserializer functionality (used in my custom
>>>> session manager that extends ManagerBase). When deserializing I get
>>>> loads of java.lang.ClassNotFoundException: exceptions. All the classes
>>>> for which the exceptions are thrown can be found in my
>>>> webapp/WEB-INF/classes. How do I configure it such that the
>>>> webapp/WEB-INF/classes are visible to the libs placed in Tomcat/lib.?
>>> http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
>> I did go through this before posting here. Its mentioned "All unpacked
>> classes and resources in |$CATALINA_HOME/lib|, as well as classes and
>> resources in JAR files are made visible through this class loader". But
>> theres no mention about the visibility of the webapp/WEB-INF/classes to
>> the classes in |$CATALINA_HOME/lib.So is there no way to configure the
>> same?
> Pretty much no.
>
> Tomcat can deserialize your webapp's sessions after a redeploy because
> it uses the webapp's ClassLoader to resolve everything. In your case,
> you have no way to get to the webapp's ClassLoader so you are pretty
> much stuck.
>
> What kind of serialization/deserialization are you writing? Why is this
> running at the Tomcat level instead of within your webapp?
I am writing a Tomcat Manager to custom handle sessions (custom jar is 
placed in Tomcat/lib). When de-serializing ,the objects stored in the 
sessions are related to my web-app.Hence was receiving  the 
classnotfound exception.
After reading the docs I figured that one work around would be to define 
my web-app/lib in the common class loader section which can be defined 
in catalina.properties.

> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk03a0wACgkQ9CaO5/Lv0PBikgCfYuyPaY/XyqkiPJP7MtqVsSCW
> PkYAmgP7lRbxvV7ilDeKTV4BJwQKEmui
> =dkUe
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Why cant the the classes (in the jars) places in Tomcat/lib see the classes from the webapp/WEB-INF/lib.

Posted by Reinwald Warapen <re...@directi.com>.
On 1/20/2011 8:20 PM, Martin Grotzke wrote:
> On Thu, Jan 20, 2011 at 2:24 PM, Reinwald Warapen<re...@directi.com>wrote:
>> @Martin :Actually I was trying to write my own Session Manager since i
>> wanted to store the session into mysql. The issue was when deserializing
>> Tomcat could not find the classes since the objects stored in the sessions
>> are related to my web-app.
>> Reading the docs I found another solution which worked in my case
>> http://wiki.apache.org/tomcat/HowTo#How_do_I_add_JARs_or_classes_to_the_common_classloader_without_adding_them_to_.24CATALINA_HOME.2BAC8-common.2BAC8-lib.3F
>
> Another option would be to extend PersistentManager to satisfy your
> requirements, as it provides much of what you want. IIRC the main "issue"
> for you was that swapOut/swapIn is done in the background thread right now.
> If you extend PersistentManager you could reuse JDBCStore (and friends) -
> this would also be a nice contribution to the tomcat community :-)
>
> Cheers,
> Martin
Will give it a thought. Will let you know how it goes :)
>
>
>>
>> @ All : Also wanted to mentioned that the memcached-session-manager which
>> Martin has created is an awesome idea if you want to back up sessions to
>> memcache.
>>
>>
>>> Christopher Schultz-2 wrote:
>>>
>>>> -----BEGIN PGP SIGNED MESSAGE-----
>>>> Hash: SHA1
>>>>
>>>> Mark,
>>>>
>>>> On 1/19/2011 2:27 PM, Reinwald Warapen wrote:
>>>>
>>>>> On 1/20/2011 12:47 AM, Mark Thomas wrote:
>>>>>
>>>>>> On 19/01/2011 19:17, Reinwald Warapen wrote:
>>>>>>
>>>>>>> I am writing a serializer/deserializer functionality (used in my
>>>>>>> custom
>>>>>>> session manager that extends ManagerBase). When deserializing I get
>>>>>>> loads of java.lang.ClassNotFoundException: exceptions. All the classes
>>>>>>> for which the exceptions are thrown can be found in my
>>>>>>> webapp/WEB-INF/classes. How do I configure it such that the
>>>>>>> webapp/WEB-INF/classes are visible to the libs placed in Tomcat/lib.?
>>>>>>>
>>>>>> http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
>>>>>>
>>>>> I did go through this before posting here. Its mentioned "All unpacked
>>>>> classes and resources in |$CATALINA_HOME/lib|, as well as classes and
>>>>> resources in JAR files are made visible through this class loader". But
>>>>> theres no mention about the visibility of the webapp/WEB-INF/classes to
>>>>> the classes in |$CATALINA_HOME/lib.So is there no way to configure the
>>>>> same?
>>>>>
>>>> Pretty much no.
>>>>
>>>> Tomcat can deserialize your webapp's sessions after a redeploy because
>>>> it uses the webapp's ClassLoader to resolve everything. In your case,
>>>> you have no way to get to the webapp's ClassLoader so you are pretty
>>>> much stuck.
>>>>
>>>> What kind of serialization/deserialization are you writing? Why is this
>>>> running at the Tomcat level instead of within your webapp?
>>>>
>>>> - -chris
>>>> -----BEGIN PGP SIGNATURE-----
>>>> Version: GnuPG v1.4.10 (MingW32)
>>>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>>>>
>>>> iEYEARECAAYFAk03a0wACgkQ9CaO5/Lv0PBikgCfYuyPaY/XyqkiPJP7MtqVsSCW
>>>> PkYAmgP7lRbxvV7ilDeKTV4BJwQKEmui
>>>> =dkUe
>>>> -----END PGP SIGNATURE-----
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>>
>>>>
>>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Why cant the the classes (in the jars) places in Tomcat/lib see the classes from the webapp/WEB-INF/lib.

Posted by Martin Grotzke <ma...@googlemail.com>.
On Thu, Jan 20, 2011 at 2:24 PM, Reinwald Warapen <re...@directi.com>wrote:
>
> @Martin :Actually I was trying to write my own Session Manager since i
> wanted to store the session into mysql. The issue was when deserializing
> Tomcat could not find the classes since the objects stored in the sessions
> are related to my web-app.
> Reading the docs I found another solution which worked in my case
> http://wiki.apache.org/tomcat/HowTo#How_do_I_add_JARs_or_classes_to_the_common_classloader_without_adding_them_to_.24CATALINA_HOME.2BAC8-common.2BAC8-lib.3F


Another option would be to extend PersistentManager to satisfy your
requirements, as it provides much of what you want. IIRC the main "issue"
for you was that swapOut/swapIn is done in the background thread right now.
If you extend PersistentManager you could reuse JDBCStore (and friends) -
this would also be a nice contribution to the tomcat community :-)

Cheers,
Martin



>
>
> @ All : Also wanted to mentioned that the memcached-session-manager which
> Martin has created is an awesome idea if you want to back up sessions to
> memcache.
>
>
>>
>> Christopher Schultz-2 wrote:
>>
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>>> Mark,
>>>
>>> On 1/19/2011 2:27 PM, Reinwald Warapen wrote:
>>>
>>>> On 1/20/2011 12:47 AM, Mark Thomas wrote:
>>>>
>>>>> On 19/01/2011 19:17, Reinwald Warapen wrote:
>>>>>
>>>>>> I am writing a serializer/deserializer functionality (used in my
>>>>>> custom
>>>>>> session manager that extends ManagerBase). When deserializing I get
>>>>>> loads of java.lang.ClassNotFoundException: exceptions. All the classes
>>>>>> for which the exceptions are thrown can be found in my
>>>>>> webapp/WEB-INF/classes. How do I configure it such that the
>>>>>> webapp/WEB-INF/classes are visible to the libs placed in Tomcat/lib.?
>>>>>>
>>>>> http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
>>>>>
>>>> I did go through this before posting here. Its mentioned "All unpacked
>>>> classes and resources in |$CATALINA_HOME/lib|, as well as classes and
>>>> resources in JAR files are made visible through this class loader". But
>>>> theres no mention about the visibility of the webapp/WEB-INF/classes to
>>>> the classes in |$CATALINA_HOME/lib.So is there no way to configure the
>>>> same?
>>>>
>>> Pretty much no.
>>>
>>> Tomcat can deserialize your webapp's sessions after a redeploy because
>>> it uses the webapp's ClassLoader to resolve everything. In your case,
>>> you have no way to get to the webapp's ClassLoader so you are pretty
>>> much stuck.
>>>
>>> What kind of serialization/deserialization are you writing? Why is this
>>> running at the Tomcat level instead of within your webapp?
>>>
>>> - -chris
>>> -----BEGIN PGP SIGNATURE-----
>>> Version: GnuPG v1.4.10 (MingW32)
>>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>>>
>>> iEYEARECAAYFAk03a0wACgkQ9CaO5/Lv0PBikgCfYuyPaY/XyqkiPJP7MtqVsSCW
>>> PkYAmgP7lRbxvV7ilDeKTV4BJwQKEmui
>>> =dkUe
>>> -----END PGP SIGNATURE-----
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Martin Grotzke
http://twitter.com/martin_grotzke <http://twitter.com/#!/martin_grotzke>

Re: Why cant the the classes (in the jars) places in Tomcat/lib see the classes from the webapp/WEB-INF/lib.

Posted by Reinwald Warapen <re...@directi.com>.
On 1/20/2011 2:54 PM, Martin Grotzke wrote:
> Hi,
>
> I just got pinged by Reinwald (we're already on contact via email) regarding
> this issue. I created the memcached-session-manager (
> http://code.google.com/p/memcached-session-manager/ ) for which Reinwald is
> trying to create a custom serializer/transcoder (memcached-session-manager,
> msm, basically additionally uses memcached as additional session backup
> store where session can be loaded from in the case of a tomcat/hardware
> crash).
>
> I just signed up here on nabble to be able to get into the thread, therefore
> quoting is not that good / I'm top posting.
>
> Now let me try to clarify how msm works regarding
> serialization/classloading.
>
> It is a Manager which is configured as usual via context.xml/server.xml. It
> supports standard java serialization but also other pluggable serializers
> like e.g. kryo (faster than java serialization). For kryo the manager
> configuration accepts custom serializer class names. The basic kryo
> serializer and the specified custom serializers are loaded during
> Manager.init like this:
>
> ClassLoader cl = manager.getContainer().getLoader().getClassLoader()
> Class.forName( customSerializerClassName, true, cl )
>
> The msm jar is placed in tomcat's lib dir, the kryo serializer jar, required
> kryo jar (and friends) and all application related jars are living in the
> webapps WEB-INF/lib directory.
>
> This works, there's also a sample app on github (
> https://github.com/magro/msm-sample-webapp ) with a runtime directory
> containing a tomcat installation and a sample webapp (linked in webapps,
> available after building the war).
>
> @Reinwald: I assume you're trying to get kryo custom serializers up and
> running, right? Have you placed kryo jars, msm-kryo-serializer jar and your
> custom serializer jar / classes in your WEB-INF/lib directory?
>
> Cheers,
> Martin
@Martin :Actually I was trying to write my own Session Manager since i 
wanted to store the session into mysql. The issue was when deserializing 
Tomcat could not find the classes since the objects stored in the 
sessions are related to my web-app.
Reading the docs I found another solution which worked in my case 
http://wiki.apache.org/tomcat/HowTo#How_do_I_add_JARs_or_classes_to_the_common_classloader_without_adding_them_to_.24CATALINA_HOME.2BAC8-common.2BAC8-lib.3F

@ All : Also wanted to mentioned that the memcached-session-manager 
which Martin has created is an awesome idea if you want to back up 
sessions to memcache.
>
>
> Christopher Schultz-2 wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Mark,
>>
>> On 1/19/2011 2:27 PM, Reinwald Warapen wrote:
>>> On 1/20/2011 12:47 AM, Mark Thomas wrote:
>>>> On 19/01/2011 19:17, Reinwald Warapen wrote:
>>>>> I am writing a serializer/deserializer functionality (used in my custom
>>>>> session manager that extends ManagerBase). When deserializing I get
>>>>> loads of java.lang.ClassNotFoundException: exceptions. All the classes
>>>>> for which the exceptions are thrown can be found in my
>>>>> webapp/WEB-INF/classes. How do I configure it such that the
>>>>> webapp/WEB-INF/classes are visible to the libs placed in Tomcat/lib.?
>>>> http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
>>> I did go through this before posting here. Its mentioned "All unpacked
>>> classes and resources in |$CATALINA_HOME/lib|, as well as classes and
>>> resources in JAR files are made visible through this class loader". But
>>> theres no mention about the visibility of the webapp/WEB-INF/classes to
>>> the classes in |$CATALINA_HOME/lib.So is there no way to configure the
>>> same?
>> Pretty much no.
>>
>> Tomcat can deserialize your webapp's sessions after a redeploy because
>> it uses the webapp's ClassLoader to resolve everything. In your case,
>> you have no way to get to the webapp's ClassLoader so you are pretty
>> much stuck.
>>
>> What kind of serialization/deserialization are you writing? Why is this
>> running at the Tomcat level instead of within your webapp?
>>
>> - -chris
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.10 (MingW32)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>>
>> iEYEARECAAYFAk03a0wACgkQ9CaO5/Lv0PBikgCfYuyPaY/XyqkiPJP7MtqVsSCW
>> PkYAmgP7lRbxvV7ilDeKTV4BJwQKEmui
>> =dkUe
>> -----END PGP SIGNATURE-----
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Why cant the the classes (in the jars) places in Tomcat/lib see the classes from the webapp/WEB-INF/lib.

Posted by Martin Grotzke <ma...@googlemail.com>.
Hi,

I just got pinged by Reinwald (we're already on contact via email) regarding
this issue. I created the memcached-session-manager (
http://code.google.com/p/memcached-session-manager/ ) for which Reinwald is
trying to create a custom serializer/transcoder (memcached-session-manager,
msm, basically additionally uses memcached as additional session backup
store where session can be loaded from in the case of a tomcat/hardware
crash).

I just signed up here on nabble to be able to get into the thread, therefore
quoting is not that good / I'm top posting.

Now let me try to clarify how msm works regarding
serialization/classloading.

It is a Manager which is configured as usual via context.xml/server.xml. It
supports standard java serialization but also other pluggable serializers
like e.g. kryo (faster than java serialization). For kryo the manager
configuration accepts custom serializer class names. The basic kryo
serializer and the specified custom serializers are loaded during
Manager.init like this:

ClassLoader cl = manager.getContainer().getLoader().getClassLoader()
Class.forName( customSerializerClassName, true, cl )

The msm jar is placed in tomcat's lib dir, the kryo serializer jar, required
kryo jar (and friends) and all application related jars are living in the
webapps WEB-INF/lib directory.

This works, there's also a sample app on github (
https://github.com/magro/msm-sample-webapp ) with a runtime directory
containing a tomcat installation and a sample webapp (linked in webapps,
available after building the war).

@Reinwald: I assume you're trying to get kryo custom serializers up and
running, right? Have you placed kryo jars, msm-kryo-serializer jar and your
custom serializer jar / classes in your WEB-INF/lib directory?

Cheers,
Martin



Christopher Schultz-2 wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Mark,
> 
> On 1/19/2011 2:27 PM, Reinwald Warapen wrote:
>> On 1/20/2011 12:47 AM, Mark Thomas wrote:
>>> On 19/01/2011 19:17, Reinwald Warapen wrote:
>>>> I am writing a serializer/deserializer functionality (used in my custom
>>>> session manager that extends ManagerBase). When deserializing I get
>>>> loads of java.lang.ClassNotFoundException: exceptions. All the classes
>>>> for which the exceptions are thrown can be found in my
>>>> webapp/WEB-INF/classes. How do I configure it such that the
>>>> webapp/WEB-INF/classes are visible to the libs placed in Tomcat/lib.?
>>> http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
>> I did go through this before posting here. Its mentioned "All unpacked
>> classes and resources in |$CATALINA_HOME/lib|, as well as classes and
>> resources in JAR files are made visible through this class loader". But
>> theres no mention about the visibility of the webapp/WEB-INF/classes to
>> the classes in |$CATALINA_HOME/lib.So is there no way to configure the
>> same?
> 
> Pretty much no.
> 
> Tomcat can deserialize your webapp's sessions after a redeploy because
> it uses the webapp's ClassLoader to resolve everything. In your case,
> you have no way to get to the webapp's ClassLoader so you are pretty
> much stuck.
> 
> What kind of serialization/deserialization are you writing? Why is this
> running at the Tomcat level instead of within your webapp?
> 
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAk03a0wACgkQ9CaO5/Lv0PBikgCfYuyPaY/XyqkiPJP7MtqVsSCW
> PkYAmgP7lRbxvV7ilDeKTV4BJwQKEmui
> =dkUe
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Why-cant-the-the-classes-%28in-the-jars%29-places-in-Tomcat-lib--see-the-classes-from-the-webapp-WEB-INF-lib.-tp30713002p30717468.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Why cant the the classes (in the jars) places in Tomcat/lib see the classes from the webapp/WEB-INF/lib.

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mark,

On 1/19/2011 2:27 PM, Reinwald Warapen wrote:
> On 1/20/2011 12:47 AM, Mark Thomas wrote:
>> On 19/01/2011 19:17, Reinwald Warapen wrote:
>>> I am writing a serializer/deserializer functionality (used in my custom
>>> session manager that extends ManagerBase). When deserializing I get
>>> loads of java.lang.ClassNotFoundException: exceptions. All the classes
>>> for which the exceptions are thrown can be found in my
>>> webapp/WEB-INF/classes. How do I configure it such that the
>>> webapp/WEB-INF/classes are visible to the libs placed in Tomcat/lib.?
>> http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
> I did go through this before posting here. Its mentioned "All unpacked
> classes and resources in |$CATALINA_HOME/lib|, as well as classes and
> resources in JAR files are made visible through this class loader". But
> theres no mention about the visibility of the webapp/WEB-INF/classes to
> the classes in |$CATALINA_HOME/lib.So is there no way to configure the
> same?

Pretty much no.

Tomcat can deserialize your webapp's sessions after a redeploy because
it uses the webapp's ClassLoader to resolve everything. In your case,
you have no way to get to the webapp's ClassLoader so you are pretty
much stuck.

What kind of serialization/deserialization are you writing? Why is this
running at the Tomcat level instead of within your webapp?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk03a0wACgkQ9CaO5/Lv0PBikgCfYuyPaY/XyqkiPJP7MtqVsSCW
PkYAmgP7lRbxvV7ilDeKTV4BJwQKEmui
=dkUe
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Why cant the the classes (in the jars) places in Tomcat/lib see the classes from the webapp/WEB-INF/lib.

Posted by Mark Thomas <ma...@apache.org>.
On 19/01/2011 19:27, Reinwald Warapen wrote:
> On 1/20/2011 12:47 AM, Mark Thomas wrote:
>> On 19/01/2011 19:17, Reinwald Warapen wrote:
>>> I am writing a serializer/deserializer functionality (used in my custom
>>> session manager that extends ManagerBase). When deserializing I get
>>> loads of java.lang.ClassNotFoundException: exceptions. All the classes
>>> for which the exceptions are thrown can be found in my
>>> webapp/WEB-INF/classes. How do I configure it such that the
>>> webapp/WEB-INF/classes are visible to the libs placed in Tomcat/lib.?
>> http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
> I did go through this before posting here. Its mentioned "All unpacked
> classes and resources in |$CATALINA_HOME/lib|, as well as classes and
> resources in JAR files are made visible through this class loader". But
> theres no mention about the visibility of the webapp/WEB-INF/classes to
> the classes in |$CATALINA_HOME/lib.So is there no way to configure the
> same?

You need to read up on class loader delegation and then re-read those docs.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Why cant the the classes (in the jars) places in Tomcat/lib see the classes from the webapp/WEB-INF/lib.

Posted by Pid <pi...@pidster.com>.
On 1/19/11 7:27 PM, Reinwald Warapen wrote:
> On 1/20/2011 12:47 AM, Mark Thomas wrote:
>> On 19/01/2011 19:17, Reinwald Warapen wrote:
>>> I am writing a serializer/deserializer functionality (used in my custom
>>> session manager that extends ManagerBase). When deserializing I get
>>> loads of java.lang.ClassNotFoundException: exceptions. All the classes
>>> for which the exceptions are thrown can be found in my
>>> webapp/WEB-INF/classes. How do I configure it such that the
>>> webapp/WEB-INF/classes are visible to the libs placed in Tomcat/lib.?
>> http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
> I did go through this before posting here. Its mentioned "All unpacked
> classes and resources in |$CATALINA_HOME/lib|, as well as classes and
> resources in JAR files are made visible through this class loader". But
> theres no mention about the visibility of the webapp/WEB-INF/classes to
> the classes in |$CATALINA_HOME/lib.So is there no way to configure the
> same?

Mark's point is that classes in yourApp/WEB-INF/lib (or classes) will
never be visible to tomcat/lib.  Read the classloader hierarchy as
documented to understand why.


p

>> Mark
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> 
> 


Re: Why cant the the classes (in the jars) places in Tomcat/lib see the classes from the webapp/WEB-INF/lib.

Posted by Reinwald Warapen <re...@directi.com>.
On 1/20/2011 12:47 AM, Mark Thomas wrote:
> On 19/01/2011 19:17, Reinwald Warapen wrote:
>> I am writing a serializer/deserializer functionality (used in my custom
>> session manager that extends ManagerBase). When deserializing I get
>> loads of java.lang.ClassNotFoundException: exceptions. All the classes
>> for which the exceptions are thrown can be found in my
>> webapp/WEB-INF/classes. How do I configure it such that the
>> webapp/WEB-INF/classes are visible to the libs placed in Tomcat/lib.?
> http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
I did go through this before posting here. Its mentioned "All unpacked 
classes and resources in |$CATALINA_HOME/lib|, as well as classes and 
resources in JAR files are made visible through this class loader". But 
theres no mention about the visibility of the webapp/WEB-INF/classes to 
the classes in |$CATALINA_HOME/lib.So is there no way to configure the same?
|
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


Re: Why cant the the classes (in the jars) places in Tomcat/lib see the classes from the webapp/WEB-INF/lib.

Posted by Mark Thomas <ma...@apache.org>.
On 19/01/2011 19:17, Reinwald Warapen wrote:
> I am writing a serializer/deserializer functionality (used in my custom
> session manager that extends ManagerBase). When deserializing I get
> loads of java.lang.ClassNotFoundException: exceptions. All the classes
> for which the exceptions are thrown can be found in my
> webapp/WEB-INF/classes. How do I configure it such that the
> webapp/WEB-INF/classes are visible to the libs placed in Tomcat/lib.?

http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org