I create an EAR in which there is a WAR and deploy to the wildfly server. The project need sapjco3.jar to run. I put the jar at server and create a XML in EAR to use it.
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<!-- Make sub deployments isolated by default, so they cannot see each others classes without a Class-Path entry -->
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<!-- This corresponds to the top level deployment. For a war this is the war's module, for an ear -->
<!-- This is the top level ear module, which contains all the classes in the EAR's lib folder -->
<deployment>
<exclusions>
<module name="org.apache.log4j" />
</exclusions>
<!-- This allows you to define additional dependencies, it is the same as using the Dependencies: manifest attribute -->
<dependencies>
<module name="deployment.nana-app.ear" export="true" />
<module name="deployment.sapjco3.jar" export="true" />
</dependencies>
<!-- These add additional classes to the module. In this case it is the same as including the jar in the EAR's lib directory -->
<resources>
</resources>
</deployment>
</jboss-deployment-structure>
The deployment succeed but when I use it below error occurred.
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: java.lang.NoClassDefFoundError: Could not initialize class com.sap.conn.jco.JCo
... 206 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.sap.conn.jco.JCo
at com.sap.conn.jco.JCoDestinationManager.getDestination(JCoDestinationManager.java:77)
at com.SAPcall.SAPcallBean.ContractCreate(SAPcallBean.java:586)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
The jar location is correct because I have another WAR use it and that one works.So what's wrong with my project? Do I need to add configuration the war? Thx.