[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [virgo-dev] class loaders in context.xml

Ok.  I just contradicted myself and should have read your stack trace much closer.  Very sorry.

I missed that new exception you are seeing is coming from catalina bundle vs. gemini tomcat bundle.

Lets try this again, but instead of modifying the fragment for tomcat bundle, we will create a fragment for catalina bundle to import SpringSource tomcat instrumentation packages.

Bundle-ManifestVersion: 2

Bundle-Name: Catalina extra imports

Bundle-SymbolicNamecom.springsource.org.apache.catalina.springsource.instrumentation.fragment

Bundle-Version: 1

Fragment-Hostcom.springsource.org.apache.catalina.springsource

Import-Package: org.springframework.instrument.classloading.tomcat


Drop that new fragment bundle into repository/usr and restart with -clean.

I think that will help.  I don't have code handy so I can't look at that else TomcatInstrumentableClassLoader  uses.  Might need to examine its usages in case some other package is needed.

Regards,
Dmitry

On Thu, Nov 18, 2010 at 7:55 PM, Dmitry Sklyut <dmitry@xxxxxxxxxxx> wrote:
org.apache.catalina.loader is in com.springsource.org.apache.catalina.springsource-6.0.29.S2-r1559 (repository/ext) 

org.eclipse.gemini.web.tomcat bundle is a bridge bundle that starts up embedded tomcat.
this bundle is also responsible for starting up web applications, including processing context.xml (Violeta/Glyn - please correct me if I am wrong here).
Because of that it needs visibility into classes that are used within context.xml.

It has a limited set of imports.  If you need to expand that list - I think the easiest way is to attach a fragment bundle that adds a bunch more imports to org.eclipse.gemini.web.tomcat bundle  (as outlined in prior post).

To make TomcatInstrumentableClassLoader visible to org.eclipse.gemini.web.tomcat bundle you might want to adjust the fragment manifest like this:

Bundle-ManifestVersion: 2

Bundle-Name: Gemini Web Tomcat extra imports

Bundle-SymbolicName: org.eclipse.gemini.web.tomcat.loader.fragment

Bundle-Version: 1

Fragment-Host: org.eclipse.gemini.web.tomcat

Import-Package: org.apache.catalina.loader;version="6.0.29.S2-r1559", org.springframework.instrument.classloading.tomcat, "add other imports that are needed"


Drop this bundle version of tomcat-instrument bundle (http://ebr.springsource.com/repository/app/bundle/version/download?name=org.springframework.instrument.tomcat&version=3.0.0.RELEASE&type=binary) into repository/ext.  And drop the fragment bundle created with the above manifest into repository/ext or in repository/usr.

Actually it meters not in which repository ext or usr you drop bundles but I like to keep ext pristine (i.e. just the way it came with download) and drop everything into usr or in additional repositories that I configure.

Let us know if that helped.  

Regards,

Dmitry

p.s.  It might still fail because TomcatInstrumentableClassLoader  itself might have dependencies that need to be imported.  But lets take it one step at the time and get it solved.

On Thu, Nov 18, 2010 at 7:20 PM, Saadat Dowlati <sdowlati@xxxxxxxxxxxxxx> wrote:

Hi Dmitry,
    I would like to give your suggested workaround a try, if you still think it may work in light of my communication with Violeta.

If so, where's this  "org.apache.catalina.loader" package that you mentioned for Import-Package?
--
Regards,
sd

On Thu, Nov 18, 2010 at 10:30 AM, Dmitry Sklyut <dmitry@xxxxxxxxxxx> wrote:
I think a better approach would be to create a fragment bundle with this manifest:

Bundle-ManifestVersion: 2

Bundle-Name: Gemini Web Tomcat extra imports

Bundle-SymbolicName: org.eclipse.gemini.web.tomcat.loader.fragment

Bundle-Version: 1

Fragment-Host: org.eclipse.gemini.web.tomcat

Import-Package: org.apache.catalina.loader;version="6.0.29.S2-r1559"


You might also need to import:

 org.apache.catalina.util;version="6.0.29.S2-r1559",

 org.apache.catalina.core;version="6.0.29.S2-r1559",

 org.apache.catalina;version="6.0.29.S2-r1559"


Try with the minimal set of org.apache.catalina.loader to see if that will be enough.


This is going to be a manifest only bundle.  You can easily create it in Eclipse.  Add this bundle to either repository/ext or repository/usr.  Restart with -clean.


Give that a try.  At least you wouldn't need to crack open a jar and deal with the manifest format (counting chars and wrapping properly).


You might still run into an issue with classes used internally by WebappLoader.  It uses some classes that are not exported by catalina bundle (org.apache.naming.resources package).


Regards,

Dmitry


On Thu, Nov 18, 2010 at 9:12 AM, Miles G <milesg78@xxxxxxxxx> wrote:
Hi,
 
Can you try the following:
 
go to <VWS-home-dir>/repository/ext
 
open org.eclipse.gemini.web.tomcat...jar

in the META-INF/MANIFEST.MF add import package org.apache.catalina.loader and try again the application with custom classloader.
 
Then share with us the result.
 
Regards,
Violeta
2010/11/18 Saadat Dowlati <sdowlati@xxxxxxxxxxxxxx>

Hi  Violeta,
   Here's the log -- see the last line -- the mentioned line#22 is the  <Loader ... /> line in the context.xml.
 
Nov 16, 2010 10:16:38 PM org.apache.tomcat.util.digester.Digester startElement
SEVERE: Begin event threw exception
org.eclipse.virgo.kernel.osgi.framework.ExtendedClassNotFoundException: org.apache.catalina.loader.WebappLoader in KernelBundleClassLoader: [bundle=org.eclipse.gemini.web.tomcat_1.1.0.RELEASE]
 at org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:139)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
 at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:205)
 at org.apache.tomcat.util.digester.Rule.begin(Rule.java:153)
 at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1356)
 at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
 at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:179)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1343)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
 at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
 at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
 at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
 at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
 at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
 at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1642)
 at org.apache.catalina.startup.ContextConfig.processContextConfig(ContextConfig.java:799)
 at org.apache.catalina.startup.ContextConfig.contextConfig(ContextConfig.java:742)
 at org.apache.catalina.startup.ContextConfig.init(ContextConfig.java:1019)
 at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:273)
 at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
 at org.apache.catalina.core.StandardContext.init(StandardContext.java:5654)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4425)
 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
 at org.eclipse.gemini.web.tomcat.internal.TomcatServletContainer.startWebApplication(TomcatServletContainer.java:120)
 at org.eclipse.gemini.web.internal.StandardWebApplication.start(StandardWebApplication.java:90)
 at org.eclipse.virgo.web.core.internal.WebBundleLifecycleListener.onStarted(WebBundleLifecycleListener.java:120)
 at org.eclipse.virgo.kernel.install.artifact.internal.ArtifactStateMonitor.onStarted(ArtifactStateMonitor.java:205)
 at org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact.asyncStartSucceeded(AbstractInstallArtifact.java:273)
 at org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact.access$0(AbstractInstallArtifact.java:270)
 at org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact$StateMonitorSignal.signalSuccessfulCompletion(AbstractInstallArtifact.java:223)
 at org.eclipse.virgo.kernel.core.internal.BundleStartTracker$1.run(BundleStartTracker.java:140)
 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
 at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: org.apache.catalina.loader.WebappLoader
 at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
 at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
 at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
 at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
 at org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:135)
 ... 37 more
Nov 16, 2010 10:16:38 PM org.apache.catalina.startup.ContextConfig processContextConfig
SEVERE: Parse error in context.xml for /EMA-Server
org.eclipse.virgo.kernel.osgi.framework.ExtendedClassNotFoundException: org.apache.catalina.loader.WebappLoader in KernelBundleClassLoader: [bundle=org.eclipse.gemini.web.tomcat_1.1.0.RELEASE]
 at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2806)
 at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2832)
 at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1359)
 at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
 at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:179)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1343)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
 at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
 at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
 at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
 at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
 at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
 at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1642)
 at org.apache.catalina.startup.ContextConfig.processContextConfig(ContextConfig.java:799)
 at org.apache.catalina.startup.ContextConfig.contextConfig(ContextConfig.java:742)
 at org.apache.catalina.startup.ContextConfig.init(ContextConfig.java:1019)
 at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:273)
 at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
 at org.apache.catalina.core.StandardContext.init(StandardContext.java:5654)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4425)
 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
 at org.eclipse.gemini.web.tomcat.internal.TomcatServletContainer.startWebApplication(TomcatServletContainer.java:120)
 at org.eclipse.gemini.web.internal.StandardWebApplication.start(StandardWebApplication.java:90)
 at org.eclipse.virgo.web.core.internal.WebBundleLifecycleListener.onStarted(WebBundleLifecycleListener.java:120)
 at org.eclipse.virgo.kernel.install.artifact.internal.ArtifactStateMonitor.onStarted(ArtifactStateMonitor.java:205)
 at org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact.asyncStartSucceeded(AbstractInstallArtifact.java:273)
 at org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact.access$0(AbstractInstallArtifact.java:270)
 at org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact$StateMonitorSignal.signalSuccessfulCompletion(AbstractInstallArtifact.java:223)
 at org.eclipse.virgo.kernel.core.internal.BundleStartTracker$1.run(BundleStartTracker.java:140)
 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
 at java.lang.Thread.run(Thread.java:619)
Caused by: org.eclipse.virgo.kernel.osgi.framework.ExtendedClassNotFoundException: org.apache.catalina.loader.WebappLoader in KernelBundleClassLoader: [bundle=org.eclipse.gemini.web.tomcat_1.1.0.RELEASE]
 at org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:139)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
 at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:205)
 at org.apache.tomcat.util.digester.Rule.begin(Rule.java:153)
 at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1356)
 ... 33 more
Caused by: java.lang.ClassNotFoundException: org.apache.catalina.loader.WebappLoader
 at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
 at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
 at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
 at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
 at org.eclipse.virgo.kernel.userregion.internal.equinox.KernelBundleClassLoader.loadClass(KernelBundleClassLoader.java:135)
 ... 37 more
Nov 16, 2010 10:16:38 PM org.apache.catalina.startup.ContextConfig processContextConfig
SEVERE: Occurred at line 22 column 58
--
sd
 
 
On Wed, Nov 17, 2010 at 7:41 AM, Miles G <milesg78@xxxxxxxxx> wrote:
 
Hi,
 
I'm interested in what exactly the exception was because I can see from your original post only:
 
Caused by: org.eclipse.gemini.web.core.spi.ServletContainerException: Web application at '/EMA-Server' failed to start. Check the logs for more details.
 
So what was the real cause for the problem?
 
Regards,
Violeta
 
 
2010/11/16 Christopher Frost <frostc@xxxxxxxxxx>
 
Hi,
 
I'm afraid I'm out of educated guesses now. Will have to see if anyone else in the community has any ideas.
 
Chris.
 
On 16/11/2010 06:15, Saadat Dowlati wrote:
Hi Chris,
    Yes, the log shows that virgo is havinng problem with the loaderClass in the context.xml file. I also tried delegate="true", but didn't help. What do you mean by "depending on how the custom classloader is initialised"?
 
Is there any workaround? I would appreciate any other pointers.
--
Thanks,
sd
 
 
On Mon, Nov 15, 2010 at 11:19 AM, Christopher Frost <frostc@xxxxxxxxxx> wrote:
 
Hi,
 
Thanks for trying Virgo out.
 
I believe that the classloader you are trying to use there would constitute a custom classloader. Before trying to 'fix' this it would be best to confirm this is the problem. I would look in the config/serviceability.xml file and up the level of logging, maybe to 'DEBUG'. Then restart with the '-clean' option and deploy your app again. Now go and look in the log.log file and see what the first error to occur is. Now you will see the real cause.
 
If it is indeed classloading related from the application 'war' bundle then you could trying setting delegate="true". This might work, by falling back to the original classloader that is OSGi friendly, depending on how the custom classloader is initialised. 
 
Thanks,
Chris.
 
On 14/11/2010 21:31, Saadat Dowlati wrote:
Hello,
       We have become very interested in VWS and are trying to migrate our application from Tomcat. As the first step, following the documentation, I dropped our application WAR (which works on Tomcat 6) in the pickup directory. According to the log, VWS installs the WAR, but fails to start it.
The error messages don't provide any hint as to the root cause: 
[2010-11-14 16:12:05.472] fs-watcher                   <HD0001I> Hot deployer processing 'CREATED' event for file 'EMA-Server.war'.
[2010-11-14 16:12:06.122] fs-watcher                   <DE0000I> Installing bundle 'EMA-Server' version '0.0.0'.
[2010-11-14 16:12:09.285] fs-watcher                   <DE0001I> Installed bundle 'EMA-Server' version '0.0.0'.
[2010-11-14 16:12:09.311] fs-watcher                   <DE0004I> Starting bundle 'EMA-Server' version '0.0.0'.
[2010-11-14 16:12:09.316] Thread-3                     <WE0000I> Starting web bundle 'EMA-Server' version '0.0.0' with context path '/EMA-Server'.
[2010-11-14 16:12:14.696] Thread-3                     <WE0005E> Failed to start web bundle 'EMA-Server' version '0.0.0': consult the serviceability log for further details.
[2010-11-14 16:12:14.701] start-signalling-4           <DE0006E> Start failed for bundle 'EMA-Server' version '0.0.0'. org.eclipse.virgo.kernel.deployer.core.DeploymentException: W
eb application failed to start
        at org.eclipse.virgo.web.core.internal.WebBundleLifecycleListener.onStarted(WebBundleLifecycleListener.java:129)
        at org.eclipse.virgo.kernel.install.artifact.internal.ArtifactStateMonitor.onStarted(ArtifactStateMonitor.java:205)
        at org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact.asyncStartSucceeded(AbstractInstallArtifact.java:273)
        at org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact.access$0(AbstractInstallArtifact.java:270)
        at org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact$StateMonitorSignal.signalSuccessfulCompletion(AbstractInstallArtifact.java:223)
        at org.eclipse.virgo.kernel.core.internal.BundleStartTracker$1.run(BundleStartTracker.java:140)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)
Caused by: org.eclipse.gemini.web.core.WebApplicationStartFailedException: org.eclipse.gemini.web.core.spi.ServletContainerException: Web application at '/EMA-Server' failed to sta
rt. Check the logs for more details.
        at org.eclipse.gemini.web.internal.StandardWebApplication.start(StandardWebApplication.java:107)
        at org.eclipse.virgo.web.core.internal.WebBundleLifecycleListener.onStarted(WebBundleLifecycleListener.java:120)
        ... 8 common frames omitted
Caused by: org.eclipse.gemini.web.core.spi.ServletContainerException: Web application at '/EMA-Server' failed to start. Check the logs for more details.
        at org.eclipse.gemini.web.tomcat.internal.TomcatServletContainer.startWebApplication(TomcatServletContainer.java:123)
        at org.eclipse.gemini.web.internal.StandardWebApplication.start(StandardWebApplication.java:90)
        ... 9 common frames omitted 
 
While searching in the documentation, I came across the following note. It got my attention, as we use the TomcatInstrumentableClassLoader in the Tomcat's context.xml packaged in our WAR file.
Note that the following context configuration features are not supported in Virgo Web Server:
  • Custom class loaders

 Is TomcatInstrumentableClassLoader  considered a "Custom class loader" in VWS? If yes, is there any workaround for it? Here's the line from our context.xml file:
 
 <Loader
  loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader"
  useSystemClassLoaderAsParent="false" />
Thanks in advance,
--
sd
 
 
--
Chris Frost
SpringSource, a division of VMware

Virgo Website, Wiki and Forum

_______________________________________________
virgo-dev mailing list
 
 
 
 
--
Chris Frost
SpringSource, a division of VMware

Virgo Website, Wiki and Forum

_______________________________________________
virgo-dev mailing list
 
 
 
_______________________________________________
virgo-dev mailing list
 
 
 

_______________________________________________
virgo-dev mailing list
virgo-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/virgo-dev



_______________________________________________
virgo-dev mailing list
virgo-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/virgo-dev



_______________________________________________
virgo-dev mailing list
virgo-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/virgo-dev



_______________________________________________
virgo-dev mailing list
virgo-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/virgo-dev