Tomcat 9.0.1 - StandardJarScanner only scanning for HandlesTypes due to classloader issues
In my embedded tomcat app, StandardJarScanner is doing a minimal Servlet 3.0 annotation scanning, specifically only HandlesTypes. After digging in, it appears that because the classloader that loaded StandardJarScanner is the same that loaded StandardContext and ContextConfig StandardJarScanner.isWebappClassLoader always returns false. Then StandardJarScanner.scan will set htOnly to true since fragment.getWebappJar is false. // Only need to scan for @HandlesTypes matches if any of the // following are true: // - it has already been determined only @HandlesTypes is required // (e.g. main web.xml has metadata-complete="true" // - this fragment is for a container JAR (Servlet 3.1 section 8.1) // - this fragment has metadata-complete="true" boolean htOnly = handlesTypesOnly || !fragment.getWebappJar() || fragment.isMetadataComplete(); My embedded app looks as follows: Tomcat tomcat = new Tomcat(); File docBase = new File(System.getProperty("java.io.tmpdir")); tomcat.setBaseDir(docBase.getAbsolutePath()); tomcat.setSilent(false); tomcat.setPort(8080); // init http connector tomcat.getConnector(); logger.info("Class loader = " + Thread.currentThread().getContextClassLoader()); Context ctx = tomcat.addContext("", docBase.getAbsolutePath()); ((StandardJarScanner) ctx.getJarScanner()).setScanClassPath(true); ((StandardJarScanner) ctx.getJarScanner()).setScanAllDirectories(true); ((StandardJarScanner) ctx.getJarScanner()).setScanAllFiles(true); ContextConfig contextConfig = new ContextConfig(); ctx.addLifecycleListener(contextConfig); contextConfig.setDefaultWebXml(Constants.NoDefaultWebXml); tomcat.start(); tomcat.getServer().await(); } catch (LifecycleException e) { throw new RuntimeException("Unable to launch tomcat ", e); } What do I need to do, in order to have StandardJarScanner loaded by a seperate loader than the classes that are loaded when tomcat.start() so that StandardJarScanner will honor searching for the remaining Servlet 3.0 annotations?
Re: tomcat8.0.33 classpath/classloader issues
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Venkata, On 5/30/16 8:13 AM, Venkata Reddy P wrote: > Looks like I have no options as I have already tried with > (catalina.properties), by setting the classpath variable in > (setclasspath.bat). I am really wonder why default > libraries(catalina_home\lib) also not loading when I change the > protocol=com.poc.PocHttp11Protocol in server.xml. If your JAR file is in CATALINA_HOME/lib, then the classes in it should be available. Something definitely sounds broken in your installation. Do you have any JAR files that appear in multiple places within the ClassLoader hierarchy? It sounds like you've been changing every setting you can find, so perhaps you have broken everything. > Is there anyway I can force tomcat bootstrap class loader to load > external libraries? Tomcat's bootstrap library should not need any external libraries. It only needs bootstrap.jar and tomcat-juli.jar to get started. After that, the server ClassLoader is created and should have access to all classes in JAR files in CATALINA_BASE/lib and CATALINA_HOME/lib > Can you please suggest me how to override bootstrap class loader > to load external libraries? Put your JAR file in CATALINA_BASE/lib and nothing else. This works on an otherwise unmodified installation of Tomcat, with all versions of Tomcat since 6.0. - -chris > -Original Message- From: Christopher Schultz > [mailto:ch...@christopherschultz.net] Sent: Friday, May 27, 2016 > 11:14 PM To: Tomcat Users List Subject: Re: tomcat8.0.33 > classpath/classloader issues > > Sanka, > > On 5/27/16 1:07 PM, Sanka, Ambica wrote: >> Do you need to add for your case? >> Please check >> http://tomcat.apache.org/tomcat-8.0-doc/class-loader-howto.html > > This is almost never the right solution to a problem. > > -chris > >> -Original Message- From: Venkata Reddy P >> [mailto:venkata.re...@trianz.com] Sent: Friday, May 27, 2016 1:02 >> PM To: Tomcat Users List Subject: RE: >> tomcat8.0.33 classpath/classloader issues > >> Many thanks Ambica for the detailed information. Its not working >> some reason for me, when I was debugging the Bootstrap.java class >> I could clearly see that creating common, shared,and catlina >> loaders as I expected. > >> While loading the server.xml protocol classes are trying to load >> then it gets failed.I have customized by extending the >> Http11Protocol but unfortunately unable to load the tomcat/lib >> class(Http11Protocol). > > >> -Original Message- From: Sanka, Ambica >> [mailto:asa...@atpco.net] Sent: 27 May 2016 21:04 To: Tomcat >> Users List Subject: RE: tomcat8.0.33 classpath/classloader >> issues > >> We use Tomcat 8.0.9 for our applications. Tomcat server package, >> we created required directories at the same level as conf. We >> create db2 folder and put db2 client jars. Created mq folder and >> put mq client jars. We also use some property files(name-value >> pair) and place those files under properties folder. Refer that >> in catalina.properties as below > >> Then updated catalina.properties as below >> common.loader="${catalina.base}/lib","${catalina.base}/lib/*.jar","${ c > >> atalina.home}/lib","${catalina.home}/lib/*.jar","${catalina.home}/db2/*. > jar","${catalina.home}/mq/*.jar","${catalina.home}/wasejb/*.jar","${ca ta > > lina.home}/conf","${catalina.home}/properties" > >> Our applications work fine. Not sure if this got changed in next >> versions. > >> Ambica. > >> -Original Message- From: Venkata Reddy P >> [mailto:venkata.re...@trianz.com] Sent: Friday, May 27, 2016 8:06 >> AM To: Tomcat Users List Subject: RE: >> tomcat8.0.33 classpath/classloader issues > >> Hi, > > > >> As Ambica suggested, I have tried by setting different properties >> "common.loader, shared.loader, server.loader" in >> catalina.properties but no luck. I have tried generating the logs >> using -Djava.security.debug=all. > >> Will this security (scl: getPermissions ProtectionDomain >> (file:/C:/tomcat8.0.33/lib/tomcat-coyote.jar > certificates>) cause any problem for class loading while >> loading the jars? > > > >> log4j:WARN No appenders could be found for logger >> (org.apache.tomcat.util.digester.Digester). > >> log4j:WARN Please initialize the log4j system properly. > >> log4j:WARN See >> http://logging.apache.org/log4j/1.2/faq.html#noconfig for more >> info. > >> java.lang.NoCla
RE: tomcat8.0.33 classpath/classloader issues
Looks like I have no options as I have already tried with (catalina.properties), by setting the classpath variable in (setclasspath.bat). I am really wonder why default libraries(catalina_home\lib) also not loading when I change the protocol=com.poc.PocHttp11Protocol in server.xml. Is there anyway I can force tomcat bootstrap class loader to load external libraries? Can you please suggest me how to override bootstrap class loader to load external libraries? Many thanks in advance. -Original Message- From: Christopher Schultz [mailto:ch...@christopherschultz.net] Sent: Friday, May 27, 2016 11:14 PM To: Tomcat Users List Subject: Re: tomcat8.0.33 classpath/classloader issues -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Sanka, On 5/27/16 1:07 PM, Sanka, Ambica wrote: > Do you need to add for your case? Please > check http://tomcat.apache.org/tomcat-8.0-doc/class-loader-howto.html This is almost never the right solution to a problem. - -chris > -Original Message- From: Venkata Reddy P > [mailto:venkata.re...@trianz.com] Sent: Friday, May 27, 2016 1:02 PM > To: Tomcat Users List Subject: RE: > tomcat8.0.33 classpath/classloader issues > > Many thanks Ambica for the detailed information. Its not working some > reason for me, when I was debugging the Bootstrap.java class I could > clearly see that creating common, shared,and catlina loaders as I > expected. > > While loading the server.xml protocol classes are trying to load then > it gets failed.I have customized by extending the Http11Protocol but > unfortunately unable to load the tomcat/lib class(Http11Protocol). > > > -Original Message- From: Sanka, Ambica > [mailto:asa...@atpco.net] Sent: 27 May 2016 21:04 To: Tomcat Users > List Subject: RE: tomcat8.0.33 classpath/classloader issues > > We use Tomcat 8.0.9 for our applications. Tomcat server package, we > created required directories at the same level as conf. We create > db2 folder and put db2 client jars. Created mq folder and put mq > client jars. We also use some property files(name-value pair) and > place those files under properties folder. Refer that in > catalina.properties as below > > Then updated catalina.properties as below > common.loader="${catalina.base}/lib","${catalina.base}/lib/*.jar","${c atalina.home}/lib","${catalina.home}/lib/*.jar","${catalina.home}/db2/*. jar","${catalina.home}/mq/*.jar","${catalina.home}/wasejb/*.jar","${cata lina.home}/conf","${catalina.home}/properties" > > Our applications work fine. Not sure if this got changed in next > versions. > > Ambica. > > -----Original Message- From: Venkata Reddy P > [mailto:venkata.re...@trianz.com] Sent: Friday, May 27, 2016 8:06 AM > To: Tomcat Users List Subject: RE: > tomcat8.0.33 classpath/classloader issues > > Hi, > > > > As Ambica suggested, I have tried by setting different properties > "common.loader, shared.loader, server.loader" in catalina.properties > but no luck. I have tried generating the logs using > -Djava.security.debug=all. > > Will this security (scl: getPermissions ProtectionDomain > (file:/C:/tomcat8.0.33/lib/tomcat-coyote.jar certificates>) cause any problem for class loading while loading > the jars? > > > > log4j:WARN No appenders could be found for logger > (org.apache.tomcat.util.digester.Digester). > > log4j:WARN Please initialize the log4j system properly. > > log4j:WARN See > http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. > > java.lang.NoClassDefFoundError: > org/apache/coyote/http11/AbstractHttp11JsseProtocol > > at java.lang.ClassLoader.defineClass1(Native Method) > > at java.lang.ClassLoader.defineClass(ClassLoader.java:763) > > at > java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142 ) > > at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) > > at java.net.URLClassLoader.access$100(URLClassLoader.java:73) > > at java.net.URLClassLoader$1.run(URLClassLoader.java:368) > > at java.net.URLClassLoader$1.run(URLClassLoader.java:362) > > at java.security.AccessController.doPrivileged(Native Method) > > at java.net.URLClassLoader.findClass(URLClassLoader.java:361) > > at java.lang.ClassLoader.loadClass(ClassLoader.java:424) > > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) > > at java.lang.ClassLoader.loadClass(ClassLoader.java:411) > > at java.lang.ClassLoader.loadClass(ClassLoader.java:357) > > at java.lang.Class.forName0(Native Method) > > at java.lang.Class.forName(Class.java:264) > > at > org.apache.catalina.co
Re: tomcat8.0.33 classpath/classloader issues
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Sanka, On 5/27/16 1:07 PM, Sanka, Ambica wrote: > Do you need to add for your case? Please > check > http://tomcat.apache.org/tomcat-8.0-doc/class-loader-howto.html This is almost never the right solution to a problem. - -chris > -Original Message- From: Venkata Reddy P > [mailto:venkata.re...@trianz.com] Sent: Friday, May 27, 2016 1:02 > PM To: Tomcat Users List Subject: RE: > tomcat8.0.33 classpath/classloader issues > > Many thanks Ambica for the detailed information. Its not working > some reason for me, when I was debugging the Bootstrap.java class I > could clearly see that creating common, shared,and catlina loaders > as I expected. > > While loading the server.xml protocol classes are trying to load > then it gets failed.I have customized by extending the > Http11Protocol but unfortunately unable to load the tomcat/lib > class(Http11Protocol). > > > -Original Message- From: Sanka, Ambica > [mailto:asa...@atpco.net] Sent: 27 May 2016 21:04 To: Tomcat Users > List Subject: RE: tomcat8.0.33 classpath/classloader issues > > We use Tomcat 8.0.9 for our applications. Tomcat server package, we > created required directories at the same level as conf. We create > db2 folder and put db2 client jars. Created mq folder and put mq > client jars. We also use some property files(name-value pair) and > place those files under properties folder. Refer that in > catalina.properties as below > > Then updated catalina.properties as below > common.loader="${catalina.base}/lib","${catalina.base}/lib/*.jar","${c atalina.home}/lib","${catalina.home}/lib/*.jar","${catalina.home}/db2/*. jar","${catalina.home}/mq/*.jar","${catalina.home}/wasejb/*.jar","${cata lina.home}/conf","${catalina.home}/properties" > > Our applications work fine. Not sure if this got changed in next > versions. > > Ambica. > > -Original Message- From: Venkata Reddy P > [mailto:venkata.re...@trianz.com] Sent: Friday, May 27, 2016 8:06 > AM To: Tomcat Users List Subject: RE: > tomcat8.0.33 classpath/classloader issues > > Hi, > > > > As Ambica suggested, I have tried by setting different properties > "common.loader, shared.loader, server.loader" in > catalina.properties but no luck. I have tried generating the logs > using -Djava.security.debug=all. > > Will this security (scl: getPermissions ProtectionDomain > (file:/C:/tomcat8.0.33/lib/tomcat-coyote.jar certificates>) cause any problem for class loading while loading > the jars? > > > > log4j:WARN No appenders could be found for logger > (org.apache.tomcat.util.digester.Digester). > > log4j:WARN Please initialize the log4j system properly. > > log4j:WARN See > http://logging.apache.org/log4j/1.2/faq.html#noconfig for more > info. > > java.lang.NoClassDefFoundError: > org/apache/coyote/http11/AbstractHttp11JsseProtocol > > at java.lang.ClassLoader.defineClass1(Native Method) > > at java.lang.ClassLoader.defineClass(ClassLoader.java:763) > > at > java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142 ) > > at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) > > at java.net.URLClassLoader.access$100(URLClassLoader.java:73) > > at java.net.URLClassLoader$1.run(URLClassLoader.java:368) > > at java.net.URLClassLoader$1.run(URLClassLoader.java:362) > > at java.security.AccessController.doPrivileged(Native Method) > > at java.net.URLClassLoader.findClass(URLClassLoader.java:361) > > at java.lang.ClassLoader.loadClass(ClassLoader.java:424) > > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) > > at java.lang.ClassLoader.loadClass(ClassLoader.java:411) > > at java.lang.ClassLoader.loadClass(ClassLoader.java:357) > > at java.lang.Class.forName0(Native Method) > > at java.lang.Class.forName(Class.java:264) > > at > org.apache.catalina.connector.Connector.(Connector.java:70) > > at > org.apache.catalina.startup.ConnectorCreateRule.begin(ConnectorCreateR ule.java:62) > > at > org.apache.tomcat.util.digester.Digester.startElement(Digester.java:11 78) > > at > org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown > Source) > > at > org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unkno wn > Source) > > at > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement (Unknown > Source) > > at > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentD ispatcher.dispatch(Unknown > Source) >
RE: tomcat8.0.33 classpath/classloader issues
Do you need to add for your case? Please check http://tomcat.apache.org/tomcat-8.0-doc/class-loader-howto.html -Original Message- From: Venkata Reddy P [mailto:venkata.re...@trianz.com] Sent: Friday, May 27, 2016 1:02 PM To: Tomcat Users List Subject: RE: tomcat8.0.33 classpath/classloader issues Many thanks Ambica for the detailed information. Its not working some reason for me, when I was debugging the Bootstrap.java class I could clearly see that creating common, shared,and catlina loaders as I expected. While loading the server.xml protocol classes are trying to load then it gets failed.I have customized by extending the Http11Protocol but unfortunately unable to load the tomcat/lib class(Http11Protocol). -Original Message- From: Sanka, Ambica [mailto:asa...@atpco.net] Sent: 27 May 2016 21:04 To: Tomcat Users List Subject: RE: tomcat8.0.33 classpath/classloader issues We use Tomcat 8.0.9 for our applications. Tomcat server package, we created required directories at the same level as conf. We create db2 folder and put db2 client jars. Created mq folder and put mq client jars. We also use some property files(name-value pair) and place those files under properties folder. Refer that in catalina.properties as below Then updated catalina.properties as below common.loader="${catalina.base}/lib","${catalina.base}/lib/*.jar","${catalina.home}/lib","${catalina.home}/lib/*.jar","${catalina.home}/db2/*.jar","${catalina.home}/mq/*.jar","${catalina.home}/wasejb/*.jar","${catalina.home}/conf","${catalina.home}/properties" Our applications work fine. Not sure if this got changed in next versions. Ambica. -Original Message- From: Venkata Reddy P [mailto:venkata.re...@trianz.com] Sent: Friday, May 27, 2016 8:06 AM To: Tomcat Users List Subject: RE: tomcat8.0.33 classpath/classloader issues Hi, As Ambica suggested, I have tried by setting different properties "common.loader, shared.loader, server.loader" in catalina.properties but no luck. I have tried generating the logs using -Djava.security.debug=all. Will this security (scl: getPermissions ProtectionDomain (file:/C:/tomcat8.0.33/lib/tomcat-coyote.jar ) cause any problem for class loading while loading the jars? log4j:WARN No appenders could be found for logger (org.apache.tomcat.util.digester.Digester). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. java.lang.NoClassDefFoundError: org/apache/coyote/http11/AbstractHttp11JsseProtocol at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:411) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at org.apache.catalina.connector.Connector.(Connector.java:70) at org.apache.catalina.startup.ConnectorCreateRule.begin(ConnectorCreateRule.java:62) at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1178) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1451) at org.apache.catalina.startup.Catalina.load(Cat
RE: tomcat8.0.33 classpath/classloader issues
Many thanks Ambica for the detailed information. Its not working some reason for me, when I was debugging the Bootstrap.java class I could clearly see that creating common, shared,and catlina loaders as I expected. While loading the server.xml protocol classes are trying to load then it gets failed.I have customized by extending the Http11Protocol but unfortunately unable to load the tomcat/lib class(Http11Protocol). -Original Message- From: Sanka, Ambica [mailto:asa...@atpco.net] Sent: 27 May 2016 21:04 To: Tomcat Users List Subject: RE: tomcat8.0.33 classpath/classloader issues We use Tomcat 8.0.9 for our applications. Tomcat server package, we created required directories at the same level as conf. We create db2 folder and put db2 client jars. Created mq folder and put mq client jars. We also use some property files(name-value pair) and place those files under properties folder. Refer that in catalina.properties as below Then updated catalina.properties as below common.loader="${catalina.base}/lib","${catalina.base}/lib/*.jar","${catalina.home}/lib","${catalina.home}/lib/*.jar","${catalina.home}/db2/*.jar","${catalina.home}/mq/*.jar","${catalina.home}/wasejb/*.jar","${catalina.home}/conf","${catalina.home}/properties" Our applications work fine. Not sure if this got changed in next versions. Ambica. -Original Message- From: Venkata Reddy P [mailto:venkata.re...@trianz.com] Sent: Friday, May 27, 2016 8:06 AM To: Tomcat Users List Subject: RE: tomcat8.0.33 classpath/classloader issues Hi, As Ambica suggested, I have tried by setting different properties "common.loader, shared.loader, server.loader" in catalina.properties but no luck. I have tried generating the logs using -Djava.security.debug=all. Will this security (scl: getPermissions ProtectionDomain (file:/C:/tomcat8.0.33/lib/tomcat-coyote.jar ) cause any problem for class loading while loading the jars? log4j:WARN No appenders could be found for logger (org.apache.tomcat.util.digester.Digester). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. java.lang.NoClassDefFoundError: org/apache/coyote/http11/AbstractHttp11JsseProtocol at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:411) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at org.apache.catalina.connector.Connector.(Connector.java:70) at org.apache.catalina.startup.ConnectorCreateRule.begin(ConnectorCreateRule.java:62) at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1178) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1451) at org.apache.catalina.startup.Catalina.load(Catalina.java:552) at org.apache.catalina.startup.Catalina.load(Catalina.java:603) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Delegating
RE: tomcat8.0.33 classpath/classloader issues
We use Tomcat 8.0.9 for our applications. Tomcat server package, we created required directories at the same level as conf. We create db2 folder and put db2 client jars. Created mq folder and put mq client jars. We also use some property files(name-value pair) and place those files under properties folder. Refer that in catalina.properties as below Then updated catalina.properties as below common.loader="${catalina.base}/lib","${catalina.base}/lib/*.jar","${catalina.home}/lib","${catalina.home}/lib/*.jar","${catalina.home}/db2/*.jar","${catalina.home}/mq/*.jar","${catalina.home}/wasejb/*.jar","${catalina.home}/conf","${catalina.home}/properties" Our applications work fine. Not sure if this got changed in next versions. Ambica. -Original Message- From: Venkata Reddy P [mailto:venkata.re...@trianz.com] Sent: Friday, May 27, 2016 8:06 AM To: Tomcat Users List Subject: RE: tomcat8.0.33 classpath/classloader issues Hi, As Ambica suggested, I have tried by setting different properties "common.loader, shared.loader, server.loader" in catalina.properties but no luck. I have tried generating the logs using -Djava.security.debug=all. Will this security (scl: getPermissions ProtectionDomain (file:/C:/tomcat8.0.33/lib/tomcat-coyote.jar ) cause any problem for class loading while loading the jars? log4j:WARN No appenders could be found for logger (org.apache.tomcat.util.digester.Digester). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. java.lang.NoClassDefFoundError: org/apache/coyote/http11/AbstractHttp11JsseProtocol at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:411) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at org.apache.catalina.connector.Connector.(Connector.java:70) at org.apache.catalina.startup.ConnectorCreateRule.begin(ConnectorCreateRule.java:62) at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1178) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1451) at org.apache.catalina.startup.Catalina.load(Catalina.java:552) at org.apache.catalina.startup.Catalina.load(Catalina.java:603) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:310) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:484) Caused by: java.lang.ClassNotFoundException: org.apache.coyote.http11.AbstractHttp11JsseProtocol at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
RE: tomcat8.0.33 classpath/classloader issues
a.security.Permissions@1fbc7afb ( ("java.io.FilePermission" "\C:\jre8\lib\ext\tomcat-juli-adapters.jar" "read") ) scl: jar: beginEntry META-INF/MANIFEST.MF jar: done with meta! jar: nothing to verify! scl: getPermissions ProtectionDomain (file:/C:/jre8/lib/ext/log4j-1.2.16.jar ) sun.misc.Launcher$ExtClassLoader@3ecf72fd java.security.Permissions@75bd9247 ( ("java.io.FilePermission" "\C:\jre8\lib\ext\log4j-1.2.16.jar" "read") ) scl: log4j:ERROR Could not find value for key log4j.appender.DEBUG log4j:ERROR Could not instantiate appender named "DEBUG". jar: beginEntry META-INF/MANIFEST.MF jar: done with meta! jar: nothing to verify! scl: getPermissions ProtectionDomain (file:/C:/tomcat8.0.33/lib/catalina.jar ) java.net.URLClassLoader@520a3426 java.security.Permissions@18eed359 ( ("java.io.FilePermission" "\C:\tomcat8.0.33\lib\catalina.jar" "read") ) scl: jar: beginEntry META-INF/MANIFEST.MF jar: done with meta! jar: nothing to verify! scl: getPermissions ProtectionDomain (file:/C:/tomcat8.0.33/lib/tomcat-util-scan.jar ) java.net.URLClassLoader@520a3426 java.security.Permissions@50b494a6 ( ("java.io.FilePermission" "\C:\tomcat8.0.33\lib\tomcat-util-scan.jar" "read") ) scl: jar: beginEntry META-INF/MANIFEST.MF jar: done with meta! jar: nothing to verify! scl: getPermissions ProtectionDomain (file:/C:/tomcat8.0.33/lib/tomcat-coyote.jar ) java.net.URLClassLoader@520a3426 java.security.Permissions@6737fd8f ( ("java.io.FilePermission" "\C:\tomcat8.0.33\lib\tomcat-coyote.jar" "read") ) scl: jar: beginEntry META-INF/MANIFEST.MF jar: done with meta! jar: nothing to verify! scl: getPermissions ProtectionDomain (file:/C:/tomcat8.0.33/lib/tomcat-util.jar ) java.net.URLClassLoader@520a3426 java.security.Permissions@5e853265 ( ("java.io.FilePermission" "\C:\tomcat8.0.33\lib\tomcat-util.jar" "read") ) scl: jar: beginEntry META-INF/MANIFEST.MF jar: done with meta! jar: nothing to verify! scl: getPermissions ProtectionDomain (file:/C:/tomcat8.0.33/lib/catalina-ha.jar ) java.net.URLClassLoader@520a3426 java.security.Permissions@4d3167f4 ( ("java.io.FilePermission" "\C:\tomcat8.0.33\lib\catalina-ha.jar" "read") ) scl: jar: beginEntry META-INF/MANIFEST.MF jar: done with meta! jar: nothing to verify! scl: getPermissions ProtectionDomain (file:/C:/jre8/lib/ext/apache-xercesImpl.jar ) sun.misc.Launcher$ExtClassLoader@3ecf72fd java.security.Permissions@7a30d1e6 ( ("java.io.FilePermission" "\C:\jre8\lib\ext\apache-xercesImpl.jar" "read") ) scl: jar: beginEntry META-INF/MANIFEST.MF jar: done with meta! jar: nothing to verify! scl: getPermissions ProtectionDomain (file:/C:/tomcat8.0.33/lib/tomcat-api.jar ) java.net.URLClassLoader@520a3426 java.security.Permissions@7f1302d6 ( ("java.io.FilePermission" "\C:\tomcat8.0.33\lib\tomcat-api.jar" "read") ) scl: jar: beginEntry META-INF/MANIFEST.MF jar: done with meta! jar: nothing to verify! scl: getPermissions ProtectionDomain (file:/C:/tomcat8.0.33/lib/tomcat-jni.jar ) java.net.URLClassLoader@520a3426 java.security.Permissions@6973bf95 ( ("java.io.FilePermission" "\C:\tomcat8.0.33\lib\tomcat-jni.jar" "read") ) scl: jar: beginEntry META-INF/MANIFEST.MF jar: done with meta! jar: nothing to verify! scl: getPermissions ProtectionDomain (file:/C:/poc/lib/connect.jar ) sun.misc.Launcher$AppClassLoader@18b4aac2 java.security.Permissions@4445629 ( ("java.lang.RuntimePermission" "exitVM") ("java.io.FilePermission" "\C:\poc\lib\connect.jar" "read") ) Many thanks in advance. -Original Message- From: Sanka, Ambica [mailto:asa...@atpco.net] Sent: 25 May 2016 17:52 To: Tomcat Users List Subject: RE: tomcat8.0.33 classpath/classloader issues You can put in catalina.properties. There is entry with common.loader in catalina.properties under conf folder. Please see below # Note: Values are enclosed in double quotes ("...") in case either the # ${catalina.base} path or the ${catalina.home} path contains a comma. common.loader="${catalina.base}/lib","${catalina.base}/lib/*.jar","${catalina.home}/lib","${catalina.home}/lib/*.jar","${catalina.home}/db2/*.jar","${catalina.home}/mq/*.jar","${catalina.home}/wasejb/*.jar","${catalina.home}/conf","${catalina.home}/properties" Hope this helps. Ambica. -Original Message- From: Venkata Reddy P [mailto:venkata.re...@trianz.com] Sent: Wednesday, May 25, 2016 5:43 AM To: Tomcat Users List mailto:users@tomcat.apache.org>> Subject: RE
RE: tomcat8.0.33 classpath/classloader issues
You can put in catalina.properties. There is entry with common.loader in catalina.properties under conf folder. Please see below # Note: Values are enclosed in double quotes ("...") in case either the # ${catalina.base} path or the ${catalina.home} path contains a comma. common.loader="${catalina.base}/lib","${catalina.base}/lib/*.jar","${catalina.home}/lib","${catalina.home}/lib/*.jar","${catalina.home}/db2/*.jar","${catalina.home}/mq/*.jar","${catalina.home}/wasejb/*.jar","${catalina.home}/conf","${catalina.home}/properties" Hope this helps. Ambica. -Original Message- From: Venkata Reddy P [mailto:venkata.re...@trianz.com] Sent: Wednesday, May 25, 2016 5:43 AM To: Tomcat Users List Subject: RE: tomcat8.0.33 classpath/classloader issues Many thanks Mark. I will give a retry it. Is there a way to set all jars in folder (c:\poc\lib) to classpath on startup? -Original Message- From: Mark Thomas [mailto:ma...@apache.org] Sent: Wednesday, May 25, 2016 2:25 PM To: Tomcat Users List Subject: Re: tomcat8.0.33 classpath/classloader issues On 25/05/2016 06:14, Venkata Reddy P wrote: > Can anyone please help me on this? Don't mess with the classpath. You should (almost) never need to do that. Put shared JARs in Tomcat's lib directory. Mark > > From: Venkata Reddy P > Sent: 24 May 2016 14:44 > To: Tomcat Users List > Subject: tomcat8.0.33 classpath/classloader issues > > Hi, > > Currently I am migrating my existing tomcat6.0.x to tomcat8.0.33 version. > > > 1) I have deployed four web applications inside webapps folder, all > these 4 web applications use the few common jars which I was (in tomcat6.0.x) > setting as classpath variable in setclasspath.bat as below > rem Adding classpath to existing path. > set CLASSPATH=%CLASSPATH%;%PROJECT_CP% > > %PROJECT_CP% is set by the list of project jars. This way of > setting classpath is not working in tomcat8.0.33. Is it still valid way of > setting the classpath in tomcat8.0.x? > > > 2) Some unknown reason when I start tomcat8.0.x server by running > \bin\startup.bat, > > Its unable to load the default tomcat jars from \lib\ folder > > Do we have any limitation in tomcat8.0.33 version? > > > > In both 1) and 2) cases if I have copy all the required jars to primary roo > class loader \ext\lib folder, then it is loading all the jars as > expected. The way of loading through the jre folder is not good practice in > my project to separate the jars. > > > > Could you please help why default tomcat jars not loading and classpath is > not working in tomcat8.0.33 version? > > Many Thanks in advance. > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: tomcat8.0.33 classpath/classloader issues
Many thanks Mark. I will give a retry it. Is there a way to set all jars in folder (c:\poc\lib) to classpath on startup? -Original Message- From: Mark Thomas [mailto:ma...@apache.org] Sent: Wednesday, May 25, 2016 2:25 PM To: Tomcat Users List Subject: Re: tomcat8.0.33 classpath/classloader issues On 25/05/2016 06:14, Venkata Reddy P wrote: > Can anyone please help me on this? Don't mess with the classpath. You should (almost) never need to do that. Put shared JARs in Tomcat's lib directory. Mark > > From: Venkata Reddy P > Sent: 24 May 2016 14:44 > To: Tomcat Users List > Subject: tomcat8.0.33 classpath/classloader issues > > Hi, > > Currently I am migrating my existing tomcat6.0.x to tomcat8.0.33 version. > > > 1) I have deployed four web applications inside webapps folder, all > these 4 web applications use the few common jars which I was (in tomcat6.0.x) > setting as classpath variable in setclasspath.bat as below > rem Adding classpath to existing path. > set CLASSPATH=%CLASSPATH%;%PROJECT_CP% > > %PROJECT_CP% is set by the list of project jars. This way of > setting classpath is not working in tomcat8.0.33. Is it still valid way of > setting the classpath in tomcat8.0.x? > > > 2) Some unknown reason when I start tomcat8.0.x server by running > \bin\startup.bat, > > Its unable to load the default tomcat jars from \lib\ folder > > Do we have any limitation in tomcat8.0.33 version? > > > > In both 1) and 2) cases if I have copy all the required jars to primary roo > class loader \ext\lib folder, then it is loading all the jars as > expected. The way of loading through the jre folder is not good practice in > my project to separate the jars. > > > > Could you please help why default tomcat jars not loading and classpath is > not working in tomcat8.0.33 version? > > Many Thanks in advance. > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: tomcat8.0.33 classpath/classloader issues
On 25/05/2016 06:14, Venkata Reddy P wrote: > Can anyone please help me on this? Don't mess with the classpath. You should (almost) never need to do that. Put shared JARs in Tomcat's lib directory. Mark > > From: Venkata Reddy P > Sent: 24 May 2016 14:44 > To: Tomcat Users List > Subject: tomcat8.0.33 classpath/classloader issues > > Hi, > > Currently I am migrating my existing tomcat6.0.x to tomcat8.0.33 version. > > > 1) I have deployed four web applications inside webapps folder, all > these 4 web applications use the few common jars which I was (in tomcat6.0.x) > setting as classpath variable in setclasspath.bat as below > rem Adding classpath to existing path. > set CLASSPATH=%CLASSPATH%;%PROJECT_CP% > > %PROJECT_CP% is set by the list of project jars. This way of > setting classpath is not working in tomcat8.0.33. Is it still valid way of > setting the classpath in tomcat8.0.x? > > > 2) Some unknown reason when I start tomcat8.0.x server by running > \bin\startup.bat, > > Its unable to load the default tomcat jars from \lib\ folder > > Do we have any limitation in tomcat8.0.33 version? > > > > In both 1) and 2) cases if I have copy all the required jars to primary roo > class loader \ext\lib folder, then it is loading all the jars as > expected. The way of loading through the jre folder is not good practice in > my project to separate the jars. > > > > Could you please help why default tomcat jars not loading and classpath is > not working in tomcat8.0.33 version? > > Many Thanks in advance. > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: tomcat8.0.33 classpath/classloader issues
Can anyone please help me on this? From: Venkata Reddy P Sent: 24 May 2016 14:44 To: Tomcat Users List Subject: tomcat8.0.33 classpath/classloader issues Hi, Currently I am migrating my existing tomcat6.0.x to tomcat8.0.33 version. 1) I have deployed four web applications inside webapps folder, all these 4 web applications use the few common jars which I was (in tomcat6.0.x) setting as classpath variable in setclasspath.bat as below rem Adding classpath to existing path. set CLASSPATH=%CLASSPATH%;%PROJECT_CP% %PROJECT_CP% is set by the list of project jars. This way of setting classpath is not working in tomcat8.0.33. Is it still valid way of setting the classpath in tomcat8.0.x? 2) Some unknown reason when I start tomcat8.0.x server by running \bin\startup.bat, Its unable to load the default tomcat jars from \lib\ folder Do we have any limitation in tomcat8.0.33 version? In both 1) and 2) cases if I have copy all the required jars to primary roo class loader \ext\lib folder, then it is loading all the jars as expected. The way of loading through the jre folder is not good practice in my project to separate the jars. Could you please help why default tomcat jars not loading and classpath is not working in tomcat8.0.33 version? Many Thanks in advance.
tomcat8.0.33 classpath/classloader issues
Hi, Currently I am migrating my existing tomcat6.0.x to tomcat8.0.33 version. 1) I have deployed four web applications inside webapps folder, all these 4 web applications use the few common jars which I was (in tomcat6.0.x) setting as classpath variable in setclasspath.bat as below rem Adding classpath to existing path. set CLASSPATH=%CLASSPATH%;%PROJECT_CP% %PROJECT_CP% is set by the list of project jars. This way of setting classpath is not working in tomcat8.0.33. Is it still valid way of setting the classpath in tomcat8.0.x? 2) Some unknown reason when I start tomcat8.0.x server by running \bin\startup.bat, Its unable to load the default tomcat jars from \lib\ folder Do we have any limitation in tomcat8.0.33 version? In both 1) and 2) cases if I have copy all the required jars to primary roo class loader \ext\lib folder, then it is loading all the jars as expected. The way of loading through the jre folder is not good practice in my project to separate the jars. Could you please help why default tomcat jars not loading and classpath is not working in tomcat8.0.33 version? Many Thanks in advance.
RE: Classloader Issues (SOLVED)
Apparently there was some kind of silent failure going on behind the scenes. It seems that the dynamically loaded JAR needed filesystem read access to the JAR in WEB-INF/lib, and that both the webapp and the other JAR needed to have java.net.SocketPermission for connect and resolve against the database server. Not sure why this manifested itself as a ClassNotFoundException instead of a SecurityException telling me that I can't read the PostgreSQL Driver JAR... Thanks for your help, everyone! > -Original Message- > From: Jon Pearson > Sent: Thursday, June 11, 2009 1:14 PM > To: Tomcat Users List > Subject: Classloader Issues > > I am encountering an odd problem with Tomcat (6.0.18). When the Java > security manager is enabled, I get a ClassNotFoundException when I try > to load the Postgres database driver using Class.forName() and a URL > classloader pointed at a jar; its parent classloader is the Webapp > classloader. > > But, when the Java security manager is disabled, everything works > smoothly and no ClassNotFoundException is thrown. > > I've stepped through the code (using Eclipse's debugger) and not found > anything that stands out, and I've set a general breakpoint on all > SecurityExceptions, caught or uncaught. None are thrown. > > Has anyone else encountered a problem like this? Is there a > way for the > Java security manager to block a class from loading without a > SecurityException being thrown? > > Jonathan P. Pearson - Software Engineer > -- > SIXNET - Solutions for Your Industrial Networking Challenges > 331 Ushers Road, Ballston Lake, NY 12019 > Tel: 1.518.877.5173, Fax: 1.518.877.8346 > www.sixnet.com > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Classloader Issues
My last message included the stack trace. The Postgresql jar is in the WEB-INF/lib directory of my webapp (/var/lib/tomcat6/webapps/BVWeb/WEB-INF/lib/postgresql-8.3-604.jdbc4.jar on Linux, C:\Projects\Java\Eclipse\.metadata\.plugins\org.eclipse.wst.server.core\ tmp1\webapps\BVWeb\WEB-INF\lib\postgresql-8.3-604.jdbc4.jar on Windows). Also, here is the relevant section of my catalina.policy file for Windows: grant codeBase "file:${catalina.base}/webapps/BVWeb/-" { permission java.util.PropertyPermission "*", "read"; permission java.io.FilePermission "${user.home}/Application Data/BlueVueBatch/-", "read"; permission java.io.FilePermission "C:/Documents and Settings/All Users/Application Data/BlueVueBatch/-", "read"; permission java.io.FilePermission "${bvb.databases}/-", "read"; permission java.io.FilePermission "${catalina.base}/work/Catalina/localhost/BVWeb/-", "write"; permission java.io.FilePermission "template/-", "read"; permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; permission java.lang.RuntimePermission "getenv.APPDATA"; permission java.lang.RuntimePermission "getenv.ALLUSERSPROFILE"; permission java.lang.RuntimePermission "getenv.USERNAME"; permission java.lang.RuntimePermission "getClassLoader"; permission java.net.SocketPermission "*", "connect,resolve"; permission java.lang.RuntimePermission "accessDeclaredMembers"; permission ognl.OgnlInvokePermission "*"; }; And for Linux: // These permissions are granted to the BlueVueBatch Web UI application grant codeBase "file:${catalina.base}/webapps/BVWeb/-" { permission java.io.FilePermission "${user.home}/.bvb/-", "read"; permission java.io.FilePermission "/etc/BlueVueBatch/-", "read"; permission java.io.FilePermission "${catalina.base}/work/Catalina/localhost/BlueVueWeb/-", "write"; permission java.io.FilePermission "template/-", "read"; permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; permission java.lang.RuntimePermission "getClassLoader"; permission java.lang.RuntimePermission "accessDeclaredMembers"; permission java.net.SocketPermission "*", "connect,resolve"; permission java.util.PropertyPermission "*", "read"; permission ognl.OgnlInvokePermission "*"; // For logging permission java.io.FilePermission "/var/log/tomcat6/*", "read,write,delete"; }; // Allow the Database plugins to load properly grant codeBase "file:/etc/BlueVueBatch/BVBDatabases/-" { permission java.lang.RuntimePermission "getClassLoader"; }; > -Original Message- > From: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com] > Sent: Thursday, June 11, 2009 3:20 PM > To: Tomcat Users List > Subject: RE: Classloader Issues > > > From: Jon Pearson [mailto:jon.pear...@sixnet.com] > > Subject: RE: Classloader Issues > > > > That blurb was already in the catalina.policy file. > > I think Martin was just using that as an example; you likely > need to grant some permission(s) to your own classloader code. > > Again, posting the stack trace and the location of the MySQL > jar would help to diagnose your problem. > > - 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. > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Classloader Issues
> From: Jon Pearson [mailto:jon.pear...@sixnet.com] > Subject: RE: Classloader Issues > > That blurb was already in the catalina.policy file. I think Martin was just using that as an example; you likely need to grant some permission(s) to your own classloader code. Again, posting the stack trace and the location of the MySQL jar would help to diagnose your problem. - 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. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Classloader Issues
) org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(Servle tConfigInterceptor.java:164) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvo cation.java:236) com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInte rceptor.java:128) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvo cation.java:236) com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercep t(ExceptionMappingInterceptor.java:176) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvo cation.java:236) org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java :52) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:4 68) org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher .java:395) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244) java.security.AccessController.doPrivileged(Native Method) javax.security.auth.Subject.doAsPrivileged(Unknown Source) org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276) org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.jav a:218) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:230) org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFi lterChain.java:56) org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterC hain.java:189) java.security.AccessController.doPrivileged(Native Method) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:185) org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv e.java:233) org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv e.java:191) org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java :128) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java :102) org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. java:109) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:2 86) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:84 5) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process( Http11Protocol.java:583) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) java.lang.Thread.run(Unknown Source) The jar containing the class that then loads the PostgreSQL driver is in /etc/BlueVueBatch/BVBDatabases/PostgreSQLDatabase.jar on Linux (Ubuntu 9.04), and it is in C:\Projects\Java\Eclipse\dist\BVBDatabases\PostgreSQLDatabase.jar on Windows XP. I see the same problem on both operating systems. > -Original Message- > From: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com] > Sent: Thursday, June 11, 2009 2:21 PM > To: Tomcat Users List > Subject: RE: Classloader Issues > > > From: Jon Pearson [mailto:jon.pear...@sixnet.com] > > Subject: Classloader Issues > > > > When the Java security manager is enabled, I get a > > ClassNotFoundException when I try to load the Postgres > > database driver using Class.forName() and a URL > > classloader pointed at a jar; its parent classloader > > is the Webapp classloader. > > Stack trace? (Please post.) > > Location of the jar of interest? (Please specify.) > > - 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. > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Classloader Issues
That blurb was already in the catalina.policy file. > -Original Message- > From: Martin Gainty [mailto:mgai...@hotmail.com] > Sent: Thursday, June 11, 2009 2:39 PM > To: Tomcat Users List > Subject: RE: Classloader Issues > > > inside TC you have to grant the container access to Jar > assuming your class is located in commons-daemon.jar in > $CATALINA_HOME/conf/catalina.policy > > // These permissions apply to the daemon code > grant codeBase "file:${catalina.home}/bin/commons-daemon.jar" { > permission java.security.AllPermission; > }; > > HTH! > Martin Gainty > __ > Verzicht und Vertraulichkeitanmerkung/Note de déni et de > confidentialité > > Diese Nachricht ist vertraulich. Sollten Sie nicht der > vorgesehene Empfaenger sein, so bitten wir hoeflich um eine > Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer > Kopie ist unzulaessig. Diese Nachricht dient lediglich dem > Austausch von Informationen und entfaltet keine rechtliche > Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. > Ce message est confidentiel et peut être privilégié. Si vous > n'êtes pas le destinataire prévu, nous te demandons avec > bonté que pour satisfaire informez l'expéditeur. N'importe > quelle diffusion non autorisée ou la copie de ceci est > interdite. Ce message sert à l'information seulement et > n'aura pas n'importe quel effet légalement obligatoire. Étant > donné que les email peuvent facilement être sujets à la > manipulation, nous ne pouvons accepter aucune responsabilité > pour le contenu fourni. > > > > > > Subject: Classloader Issues > > Date: Thu, 11 Jun 2009 13:13:32 -0400 > > From: jon.pear...@sixnet.com > > To: users@tomcat.apache.org > > > > I am encountering an odd problem with Tomcat (6.0.18). When the Java > > security manager is enabled, I get a ClassNotFoundException > when I try > > to load the Postgres database driver using Class.forName() and a URL > > classloader pointed at a jar; its parent classloader is the Webapp > > classloader. > > > > But, when the Java security manager is disabled, everything works > > smoothly and no ClassNotFoundException is thrown. > > > > I've stepped through the code (using Eclipse's debugger) > and not found > > anything that stands out, and I've set a general breakpoint on all > > SecurityExceptions, caught or uncaught. None are thrown. > > > > Has anyone else encountered a problem like this? Is there a > way for the > > Java security manager to block a class from loading without a > > SecurityException being thrown? > > > > Jonathan P. Pearson - Software Engineer > > -- > > SIXNET - Solutions for Your Industrial Networking Challenges > > 331 Ushers Road, Ballston Lake, NY 12019 > > Tel: 1.518.877.5173, Fax: 1.518.877.8346 > > www.sixnet.com > > > > > - > > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > > For additional commands, e-mail: users-h...@tomcat.apache.org > > > > _ > Insert movie times and more without leaving Hotmail®. > http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGL > M_WL_HM_Tutorial_QuickAdd_062009 > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Classloader Issues
inside TC you have to grant the container access to Jar assuming your class is located in commons-daemon.jar in $CATALINA_HOME/conf/catalina.policy // These permissions apply to the daemon code grant codeBase "file:${catalina.home}/bin/commons-daemon.jar" { permission java.security.AllPermission; }; HTH! Martin Gainty __ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > Subject: Classloader Issues > Date: Thu, 11 Jun 2009 13:13:32 -0400 > From: jon.pear...@sixnet.com > To: users@tomcat.apache.org > > I am encountering an odd problem with Tomcat (6.0.18). When the Java > security manager is enabled, I get a ClassNotFoundException when I try > to load the Postgres database driver using Class.forName() and a URL > classloader pointed at a jar; its parent classloader is the Webapp > classloader. > > But, when the Java security manager is disabled, everything works > smoothly and no ClassNotFoundException is thrown. > > I've stepped through the code (using Eclipse's debugger) and not found > anything that stands out, and I've set a general breakpoint on all > SecurityExceptions, caught or uncaught. None are thrown. > > Has anyone else encountered a problem like this? Is there a way for the > Java security manager to block a class from loading without a > SecurityException being thrown? > > Jonathan P. Pearson - Software Engineer > -- > SIXNET - Solutions for Your Industrial Networking Challenges > 331 Ushers Road, Ballston Lake, NY 12019 > Tel: 1.518.877.5173, Fax: 1.518.877.8346 > www.sixnet.com > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > _ Insert movie times and more without leaving Hotmail®. http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd_062009
RE: Classloader Issues
> From: Jon Pearson [mailto:jon.pear...@sixnet.com] > Subject: Classloader Issues > > When the Java security manager is enabled, I get a > ClassNotFoundException when I try to load the Postgres > database driver using Class.forName() and a URL > classloader pointed at a jar; its parent classloader > is the Webapp classloader. Stack trace? (Please post.) Location of the jar of interest? (Please specify.) - 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. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Classloader Issues
I am encountering an odd problem with Tomcat (6.0.18). When the Java security manager is enabled, I get a ClassNotFoundException when I try to load the Postgres database driver using Class.forName() and a URL classloader pointed at a jar; its parent classloader is the Webapp classloader. But, when the Java security manager is disabled, everything works smoothly and no ClassNotFoundException is thrown. I've stepped through the code (using Eclipse's debugger) and not found anything that stands out, and I've set a general breakpoint on all SecurityExceptions, caught or uncaught. None are thrown. Has anyone else encountered a problem like this? Is there a way for the Java security manager to block a class from loading without a SecurityException being thrown? Jonathan P. Pearson - Software Engineer -- SIXNET - Solutions for Your Industrial Networking Challenges 331 Ushers Road, Ballston Lake, NY 12019 Tel: 1.518.877.5173, Fax: 1.518.877.8346 www.sixnet.com - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: ClassLoader issues in multithreaded webapp ? TC5.0
> From: katepl [mailto:klin...@poczta.fm] > Subject: ClassLoader issues in multithreaded webapp ? TC5.0 > > I'm using 5.0.28 (with java5 patch) What's the "java5 patch"? Note that Tomcat 5.0 is deprecated. Can you reproduce the problem on a supported level? I don't recall having seen these symptoms on any level, so it may be related to the JVM you're using. - 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. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
ClassLoader issues in multithreaded webapp ? TC5.0
Hi I'm using 5.0.28 (with java5 patch) running on java5 (SR9 AIX). My webapp is running on axis 1.2. When I start some threads to do the work in my web service, I'm getting errors like: Exception in thread "Thread-33" java.lang.NoClassDefFoundError: my.whatever.package.whatever.class Caused by: java.lang.ClassNotFoundException: my.whatever.package.whatever.class at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1340) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189) Needless to say all the classes are in place and it works fine with single thread webapp (heavily tested). Using multiple threads, only one or two thread report this error while others seem to work fine. I would say I have a race condition with WebappClassLoader but why does it complain only about my classes ( never throws CNFE for java.* classes ). Any thoughts ? Thanks in advance, Kate. -- View this message in context: http://www.nabble.com/ClassLoader-issues-in-multithreaded-webapp---TC5.0-tp23515950p23515950.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org