(this is the full post. my last post prematurely got sent)
----------------------
 
I'm trying to embed FOP into a J2EE application that runs on JBoss(3).  The front end of the application is Cocoon, and is contained within two WARs within the application EAR.  The EJB classes are deployed into an ejb.jar also within the main EAR.  The EJB jar does not contain any classes regarding Cocoon or the Avalon framework.
 
We have Cocoon configured to render to PDF when requested through the webapp using the included Cocoon serializers.  The part of our application that needs to render an XML document to PDF exists outside the context of the Cocoon application, and needs to be able to run independently.
 
In my EJB.jar, I put the fop.jar I downloaded from the binary distribution. Note that my ejb.jar does not have the avalon framework installed.  When I try and render a PDF through the Cocoon interface, I get this error:
 
java.lang.NoClassDefFoundError: org/apache/avalon/framework/CascadingRuntimeException
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:140)
        at org.apache.cocoon.components.renderer.ExtendableRendererFactory.class$(ExtendableRendererFactory.java:77)
        at org.apache.cocoon.components.renderer.ExtendableRendererFactory.<init>(ExtendableRendererFactory.java:77)
        at org.apache.cocoon.components.renderer.ExtendableRendererFactory.<clinit>(ExtendableRendererFactory.java:73)
        at org.apache.cocoon.serialization.FOPSerializer.<clinit>(FOPSerializer.java:92)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
        at java.lang.Class.newInstance0(Class.java:306)
        at java.lang.Class.newInstance(Class.java:259)
        at org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(DefaultComponentFactory.java:163)
        at org.apache.avalon.excalibur.pool.ResourceLimitingPool.newPoolable(ResourceLimitingPool.java:629)
        at org.apache.avalon.excalibur.pool.ResourceLimitingPool.get(ResourceLimitingPool.java:359)
        at org.apache.avalon.excalibur.component.PoolableComponentHandler.doGet(PoolableComponentHandler.java:188)
        at org.apache.avalon.excalibur.component.ComponentHandler.get(ComponentHandler.java:234)
        at org.apache.avalon.excalibur.component.ExcaliburComponentSelector.select(ExcaliburComponentSelector.java:205)
        at org.apache.cocoon.sitemap.DefaultSitemapComponentSelector.select(DefaultSitemapComponentSelector.java:101)
        at org.apache.cocoon.components.pipeline.AbstractStreamPipeline.setSerializer(AbstractStreamPipeline.java:158)
        at org.apache.cocoon.components.pipeline.CachingStreamPipeline.setSerializer(CachingStreamPipeline.java:115)
        ...
 
And with the same configuration, when I try and generate the FOP outside of Cocoon, I get this error:
 
17:18:45,156 ERROR [LogInterceptor] Unexpected Error:
java.lang.NoClassDefFoundError: org/apache/avalon/framework/logger/Logger
        at com.hannonhill.publish.ejb.PublishManagementBean.serializeJDOMToPDF(PublishManagementBean.java:529)
        at com.hannonhill.publish.ejb.PublishManagementBean.publishEntity(PublishManagementBean.java:298)
        at com.hannonhill.publish.ejb.PublishManagementBean.publishEntity(PublishManagementBean.java:198)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:629)
        at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
        at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
        at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
        at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243)
        ...
 
I can understand the second one, because I did not have the avalon framework included with my EJB.jar.  However, why when trying to render a PDF through Cocoon would it now say it could not find this class? 
 
Digging deeper, I then placed the avalon framework JAR into my EJB.jar and deployed. When I restart JBoss, it throws an error trying to start one of the webapps:
 
java.lang.NoClassDefFoundError: org/apache/log/Logger
        at org.apache.avalon.framework.logger.LogKitLogger.isDebugEnabled(LogKitLogger.java:107)
        at org.apache.avalon.excalibur.logger.DefaultLogTargetFactoryManager.configure(DefaultLogTargetFactoryManager.java:203)
        at org.apache.avalon.framework.container.ContainerUtil.configure(ContainerUtil.java:239)
        at org.apache.avalon.excalibur.logger.DefaultLogKitManager.setupTargetFactoryManager(DefaultLogKitManager.java:229)
        at org.apache.avalon.excalibur.logger.DefaultLogKitManager.configure(DefaultLogKitManager.java:199)
        at org.apache.cocoon.servlet.CocoonServlet.initLogger(CocoonServlet.java:813)
        at org.apache.cocoon.servlet.CocoonServlet.init(CocoonServlet.java:269)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:934)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:821)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3420)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:3608)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:821)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)
        at org.jboss.web.catalina.EmbeddedCatalinaService41.createWebContext(EmbeddedCatalinaService41.java:417)
        at org.jboss.web.catalina.EmbeddedCatalinaService41.performDeploy(EmbeddedCatalinaService41.java:266)
        at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:357)
        at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
        at org.jboss.deployment.MainDeployer.start(MainDeployer.java:824)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:640)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:613)
        at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
        at $Proxy7.deploy(Unknown Source)
        at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:404)
        at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:545)
        ...
 
which causes java.lang.LinkageError problems later in the deployment, and renders Cocoon useless. Because I cannot access Cocoon, I cannot send a message through my web interface to the J2EE backend to see if rendering to PDF works without working with the Cocoon serializer.
 
 
Summary:  I'd like to be able to run the FOP serializer outside of Cocoon in my EJBs, but cannot seem to do this.  Has anyone here successfully gotten this to work?  I've been stuck on this for a while, and would really appreciate some direction.  Thanks!
 
Collin
 
 
 
 
 

Reply via email to