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:
 
 

Reply via email to