You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christoph Kutzinski <ku...@gmx.de> on 2005/06/20 16:30:55 UTC
Register custom CharsetProvider by a webapplication
Hi,
I'm trying to install a custom CharsetProvider (UTF7) with my web
application (i.e. deliver a JAR with a
META-/services/java.nio.charset.spi.CharsetProvider entry in WEB-INF/lib)
However the CharsetProvider isn't recognized when it comes to parsing
(i.e. calling javax.mail.Part.getContent())
If I place the JAR into <JRE>/lib/ext it works.
The API of CharsetProvider
(http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/spi/CharsetProvider.html)
says:
"Charset providers may be installed in an instance of the Java platform
as extensions, that is, jar files placed into any of the usual extension
directories. Providers may also be made available by adding them to the
applet or application class path or by some other platform-specific
means. Charset providers are looked up via the current thread's context
class loader."
I interpret it this way:
If the JAR is in the classpath (specifically: if it is found by the
current context class loader) the Charsetprovider should be
automatically recognized.
I checked that the context classloader immediately before calling
Part.getContent() is the webapp-classloader, so the JARs in WEB-INF/lib
should be visible.
So is there any solution to this other than placing the JAR in an
extension directory?
Could this be a Tomcat bug or is this expected behaviour due to the
speciality of the webapp classloaders? (I tried to understand the
implifications of Tomcats classloading at
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/class-loader-howto.html
but couldn't figure it out by myself)
Thank you,
Christoph
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Load oracle.jdbc.driver.OracleDriver class
Posted by Anto Paul <an...@gmail.com>.
On 6/24/05, Giacomino Raccuia <gi...@icteam.it> wrote:
> With classes12.jar works fine, thanks lot!! But I can tell tomcat to use
> .zip file like previous version?
>
> Bye
> Mino
>
> On 24/06/2005 9:58, Anto Paul wrote:
>
> >On 6/24/05, Giacomino Raccuia <gi...@icteam.it> wrote:
> >
> >
> >>I put the Jar (with tomcat 4.0.3 I use *classes12.zip*, for tomcat 5.5.9
> >>I use the same library or the *classes12.jar*?) in the common/lib, and
> >>my classpath are:
> >>
> >>CLASSPATH=/usr1/jdk1.4.1
> >>
> >>but the error doesn't change...
> >>
> >>
> >
> >Tomcat loads libraries with .jar extension only. Two suggestions I
> >have for your problem.
> >1, Try using the 9i driver if possible.
> >2, Try to load using Thread.getContextClassLoader().loadClass() to
> >test that the class is visible to your application.
> >
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
In my knowledge Tomcat 4 and above works only with jar files. You
might be having classes12.jar or unzipped class files in the 4.x
version.
--
rgds
Anto Paul
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Load oracle.jdbc.driver.OracleDriver class
Posted by Giacomino Raccuia <gi...@icteam.it>.
With classes12.jar works fine, thanks lot!! But I can tell tomcat to use
.zip file like previous version?
Bye
Mino
On 24/06/2005 9:58, Anto Paul wrote:
>On 6/24/05, Giacomino Raccuia <gi...@icteam.it> wrote:
>
>
>>I put the Jar (with tomcat 4.0.3 I use *classes12.zip*, for tomcat 5.5.9
>>I use the same library or the *classes12.jar*?) in the common/lib, and
>>my classpath are:
>>
>>CLASSPATH=/usr1/jdk1.4.1
>>
>>but the error doesn't change...
>>
>>
>
>Tomcat loads libraries with .jar extension only. Two suggestions I
>have for your problem.
>1, Try using the 9i driver if possible.
>2, Try to load using Thread.getContextClassLoader().loadClass() to
>test that the class is visible to your application.
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Load oracle.jdbc.driver.OracleDriver class
Posted by Anto Paul <an...@gmail.com>.
On 6/24/05, Giacomino Raccuia <gi...@icteam.it> wrote:
> I put the Jar (with tomcat 4.0.3 I use *classes12.zip*, for tomcat 5.5.9
> I use the same library or the *classes12.jar*?) in the common/lib, and
> my classpath are:
>
> CLASSPATH=/usr1/jdk1.4.1
>
> but the error doesn't change...
Tomcat loads libraries with .jar extension only. Two suggestions I
have for your problem.
1, Try using the 9i driver if possible.
2, Try to load using Thread.getContextClassLoader().loadClass() to
test that the class is visible to your application.
--
rgds
Anto Paul
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Load oracle.jdbc.driver.OracleDriver class
Posted by Giacomino Raccuia <gi...@icteam.it>.
I put the Jar (with tomcat 4.0.3 I use *classes12.zip*, for tomcat 5.5.9
I use the same library or the *classes12.jar*?) in the common/lib, and
my classpath are:
CLASSPATH=/usr1/jdk1.4.1
but the error doesn't change...
Thanks Mino
On 23/06/2005 20:20, David Smith wrote:
> Put the jar in common/lib and don't mess with the classpath. Tomcat's
> internal classloaders will take care of finding the jar.
>
> --David
>
> Giacomino Raccuia wrote:
>
>> Hi!
>> I just upgraded from tomcat 4.0.3 to 5.5.9, I put all my librarie in
>> shared/lib and set correctly the CLASSPATH, but when I try to load
>> the class
>>
>> oracle.jdbc.driver.OracleDriver
>>
>> tomcat return this error
>>
>> ava.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
>> java.net.URLClassLoader$1.run(URLClassLoader.java:198)
>> java.security.AccessController.doPrivileged(Native Method)
>> java.net.URLClassLoader.findClass(URLClassLoader.java:186)
>> java.lang.ClassLoader.loadClass(ClassLoader.java:299)
>> java.lang.ClassLoader.loadClass(ClassLoader.java:255)
>> java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
>> java.lang.Class.forName0(Native Method)
>> java.lang.Class.forName(Class.java:140)
>> glib.sql.ConnectionPool.<init>(ConnectionPool.java:41)
>> org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:111)
>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>>
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
>>
>>
>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
>> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>> nmda.servlets.MultipartFilter.doFilter(MultipartFilter.java:58)
>>
>> Do you have any suggestion??
>> I try this code
>>
>> try { Class.forName ("oracle.jdbc.OracleDriver"); } catch (Exception
>> ex) {}
>>
>> and works fine.
>>
>> Thanks
>> Mino
>>
>>
>>
>> On 20/06/2005 16:30, Christoph Kutzinski wrote:
>>
>>> Hi,
>>>
>>> I'm trying to install a custom CharsetProvider (UTF7) with my web
>>> application (i.e. deliver a JAR with a
>>> META-/services/java.nio.charset.spi.CharsetProvider entry in
>>> WEB-INF/lib)
>>> However the CharsetProvider isn't recognized when it comes to
>>> parsing (i.e. calling javax.mail.Part.getContent())
>>> If I place the JAR into <JRE>/lib/ext it works.
>>>
>>> The API of CharsetProvider
>>> (http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/spi/CharsetProvider.html)
>>> says:
>>> "Charset providers may be installed in an instance of the Java
>>> platform as extensions, that is, jar files placed into any of the
>>> usual extension directories. Providers may also be made available by
>>> adding them to the applet or application class path or by some other
>>> platform-specific means. Charset providers are looked up via the
>>> current thread's context class loader."
>>>
>>> I interpret it this way:
>>> If the JAR is in the classpath (specifically: if it is found by the
>>> current context class loader) the Charsetprovider should be
>>> automatically recognized.
>>> I checked that the context classloader immediately before calling
>>> Part.getContent() is the webapp-classloader, so the JARs in
>>> WEB-INF/lib should be visible.
>>>
>>> So is there any solution to this other than placing the JAR in an
>>> extension directory?
>>> Could this be a Tomcat bug or is this expected behaviour due to the
>>> speciality of the webapp classloaders? (I tried to understand the
>>> implifications of Tomcats classloading at
>>> http://jakarta.apache.org/tomcat/tomcat-5.5-doc/class-loader-howto.html
>>> but couldn't figure it out by myself)
>>>
>>>
>>> Thank you,
>>> Christoph
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Load oracle.jdbc.driver.OracleDriver class
Posted by David Smith <dn...@cornell.edu>.
Put the jar in common/lib and don't mess with the classpath. Tomcat's
internal classloaders will take care of finding the jar.
--David
Giacomino Raccuia wrote:
> Hi!
> I just upgraded from tomcat 4.0.3 to 5.5.9, I put all my librarie in
> shared/lib and set correctly the CLASSPATH, but when I try to load the
> class
>
> oracle.jdbc.driver.OracleDriver
>
> tomcat return this error
>
> ava.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
> java.net.URLClassLoader$1.run(URLClassLoader.java:198)
> java.security.AccessController.doPrivileged(Native Method)
> java.net.URLClassLoader.findClass(URLClassLoader.java:186)
> java.lang.ClassLoader.loadClass(ClassLoader.java:299)
> java.lang.ClassLoader.loadClass(ClassLoader.java:255)
> java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
> java.lang.Class.forName0(Native Method)
> java.lang.Class.forName(Class.java:140)
> glib.sql.ConnectionPool.<init>(ConnectionPool.java:41)
> org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:111)
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
>
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
>
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> nmda.servlets.MultipartFilter.doFilter(MultipartFilter.java:58)
>
> Do you have any suggestion??
> I try this code
>
> try { Class.forName ("oracle.jdbc.OracleDriver"); } catch (Exception
> ex) {}
>
> and works fine.
>
> Thanks
> Mino
>
>
>
> On 20/06/2005 16:30, Christoph Kutzinski wrote:
>
>> Hi,
>>
>> I'm trying to install a custom CharsetProvider (UTF7) with my web
>> application (i.e. deliver a JAR with a
>> META-/services/java.nio.charset.spi.CharsetProvider entry in
>> WEB-INF/lib)
>> However the CharsetProvider isn't recognized when it comes to parsing
>> (i.e. calling javax.mail.Part.getContent())
>> If I place the JAR into <JRE>/lib/ext it works.
>>
>> The API of CharsetProvider
>> (http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/spi/CharsetProvider.html)
>> says:
>> "Charset providers may be installed in an instance of the Java
>> platform as extensions, that is, jar files placed into any of the
>> usual extension directories. Providers may also be made available by
>> adding them to the applet or application class path or by some other
>> platform-specific means. Charset providers are looked up via the
>> current thread's context class loader."
>>
>> I interpret it this way:
>> If the JAR is in the classpath (specifically: if it is found by the
>> current context class loader) the Charsetprovider should be
>> automatically recognized.
>> I checked that the context classloader immediately before calling
>> Part.getContent() is the webapp-classloader, so the JARs in
>> WEB-INF/lib should be visible.
>>
>> So is there any solution to this other than placing the JAR in an
>> extension directory?
>> Could this be a Tomcat bug or is this expected behaviour due to the
>> speciality of the webapp classloaders? (I tried to understand the
>> implifications of Tomcats classloading at
>> http://jakarta.apache.org/tomcat/tomcat-5.5-doc/class-loader-howto.html
>> but couldn't figure it out by myself)
>>
>>
>> Thank you,
>> Christoph
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Load oracle.jdbc.driver.OracleDriver class
Posted by Giacomino Raccuia <gi...@icteam.it>.
Hi!
I just upgraded from tomcat 4.0.3 to 5.5.9, I put all my librarie in
shared/lib and set correctly the CLASSPATH, but when I try to load the class
oracle.jdbc.driver.OracleDriver
tomcat return this error
ava.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
java.net.URLClassLoader$1.run(URLClassLoader.java:198)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(URLClassLoader.java:186)
java.lang.ClassLoader.loadClass(ClassLoader.java:299)
java.lang.ClassLoader.loadClass(ClassLoader.java:255)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:140)
glib.sql.ConnectionPool.<init>(ConnectionPool.java:41)
org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:111)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
nmda.servlets.MultipartFilter.doFilter(MultipartFilter.java:58)
Do you have any suggestion??
I try this code
try { Class.forName ("oracle.jdbc.OracleDriver"); } catch (Exception ex) {}
and works fine.
Thanks
Mino
On 20/06/2005 16:30, Christoph Kutzinski wrote:
> Hi,
>
> I'm trying to install a custom CharsetProvider (UTF7) with my web
> application (i.e. deliver a JAR with a
> META-/services/java.nio.charset.spi.CharsetProvider entry in WEB-INF/lib)
> However the CharsetProvider isn't recognized when it comes to parsing
> (i.e. calling javax.mail.Part.getContent())
> If I place the JAR into <JRE>/lib/ext it works.
>
> The API of CharsetProvider
> (http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/spi/CharsetProvider.html)
> says:
> "Charset providers may be installed in an instance of the Java
> platform as extensions, that is, jar files placed into any of the
> usual extension directories. Providers may also be made available by
> adding them to the applet or application class path or by some other
> platform-specific means. Charset providers are looked up via the
> current thread's context class loader."
>
> I interpret it this way:
> If the JAR is in the classpath (specifically: if it is found by the
> current context class loader) the Charsetprovider should be
> automatically recognized.
> I checked that the context classloader immediately before calling
> Part.getContent() is the webapp-classloader, so the JARs in
> WEB-INF/lib should be visible.
>
> So is there any solution to this other than placing the JAR in an
> extension directory?
> Could this be a Tomcat bug or is this expected behaviour due to the
> speciality of the webapp classloaders? (I tried to understand the
> implifications of Tomcats classloading at
> http://jakarta.apache.org/tomcat/tomcat-5.5-doc/class-loader-howto.html
> but couldn't figure it out by myself)
>
>
> Thank you,
> Christoph
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org