ClassCastException - Fails to cast to the same class

1
0
-1

This is the most annoying error I got so far with Bonita.

I have Bonita 6.3.4 running on Ubuntu 14.04 32bits with Java "1.6.0_45"

I created a connector to download reports from the jasperserver. Using jasperserver-simple-java-rest-client 1.0. I have experienced this same error with other connectors.

This is exception is thrown when the connector is executed for the second time: org.dom4j.DocumentException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory Nested exception: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory at org.dom4j.io.SAXReader.read(SAXReader.java:484) at org.dom4j.DocumentHelper.parseText(DocumentHelper.java:278) at com.gkudos.jasperserver.client.JasperserverRestClient.parseResource(JasperserverRestClient.java:156) at com.gkudos.jasperserver.client.JasperserverRestClient.getReportAsFile(JasperserverRestClient.java:115) at br.edu.uniformg.connector.JasperServerConnector.getReportAsDocument(JasperServerConnector.java:126) at br.edu.uniformg.connectors.JasperserverConnectorImpl.executeBusinessLogic(JasperserverConnectorImpl.java:66) at org.bonitasoft.engine.connector.AbstractConnector.execute(AbstractConnector.java:74) at org.bonitasoft.engine.core.connector.impl.SConnectorAdapter.execute(SConnectorAdapter.java:70) at org.bonitasoft.engine.connector.impl.ConnectorExecutorImpl$ExecuteConnectorCallable.call(ConnectorExecutorImpl.java:189) at org.bonitasoft.engine.connector.impl.ConnectorExecutorImpl$ExecuteConnectorCallable.call(ConnectorExecutorImpl.java:171) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Nested exception: java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory at org.dom4j.DocumentFactory.getInstance(DocumentFactory.java:97) at org.dom4j.io.SAXReader.getDocumentFactory(SAXReader.java:645) at org.dom4j.io.SAXReader.createContentHandler(SAXReader.java:969) at org.dom4j.io.SAXReader.read(SAXReader.java:449) at org.dom4j.DocumentHelper.parseText(DocumentHelper.java:278) at com.gkudos.jasperserver.client.JasperserverRestClient.parseResource(JasperserverRestClient.java:156) at com.gkudos.jasperserver.client.JasperserverRestClient.getReportAsFile(JasperserverRestClient.java:115) at br.edu.uniformg.connector.JasperServerConnector.getReportAsDocument(JasperServerConnector.java:126) at br.edu.uniformg.connectors.JasperserverConnectorImpl.executeBusinessLogic(JasperserverConnectorImpl.java:66) at org.bonitasoft.engine.connector.AbstractConnector.execute(AbstractConnector.java:74) at org.bonitasoft.engine.core.connector.impl.SConnectorAdapter.execute(SConnectorAdapter.java:70) at org.bonitasoft.engine.connector.impl.ConnectorExecutorImpl$ExecuteConnectorCallable.call(ConnectorExecutorImpl.java:189) at org.bonitasoft.engine.connector.impl.ConnectorExecutorImpl$ExecuteConnectorCallable.call(ConnectorExecutorImpl.java:171) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)

Reading some related problems I tried to follow instructions to move the libs to the tomcat lib folder to avoid double loading the same class by different class loaders. Now that I removed and the libs from the connector implementation reference on "dependencies" and put them on tomcat lib folder it throws the same exception on the FIRST time it runs.

I am using jasperserver because I got same errors with normal jasper connectors. I tried to rewrite them but it didn't work.

Looks like there are more than one class loader loading the same class at different times and then it conflict with them self. Unhappily with go getting this kind of error will need to quit using Bonita. I already opened a ticket but no response.

Is this possibly a bug or fail in my code?

1 answer

1
0
-1

Hi,

this is an integration issue. Some classes require to be loaded a single time in a JVM.

I can propose two things to try as Bonita war contains a version of dom4j. - remove dependency on the connector withotu putting the jar in tomcat/libs - remove it from the war and remove dependency on the connector and let the dom4j jar in tomcat/libs.

Please ensure that there are no other wars/applications/connectors providing the dom4j library.

Regards,

Comments

Submitted by yamandu.costa on Wed, 09/17/2014 - 13:57

Hi, thanks for answering.

I removed it from connector dependencies and tomcat/lib. Now I got the following exception but I don't understand it. Having dom4j in connector dependencies or not causes the same exception.

java.lang.reflect.InvocationTargetException org.bonitasoft.engine.bpm.connector.ConnectorExecutionException: USERNAME=install | org.bonitasoft.engine.core.connector.exception.SConnectorException: org.bonitasoft.engine.connector.exception.SConnectorException: java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: org/dom4j/DocumentException

Notifications