I'm currently trying to adapt an existing application to use Oracle Coherence, i.e. embedding a GAR in the EAR. The application is deployed to Weblogic 12.1.3. Before embedding the GAR in the EAR, the application could be deployed without any problems.
On deployment, I get this error:
####<Feb 7, 2017 8:28:46 AM CET> <Error> <Deployer> <7fff0f95b4b8> <AdminServer> <[STANDBY] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1486452526709> <BEA-149265> <Failure occurred in the execution of deployment request with ID "6725384329688" for task "1". Error is: "weblogic.application.ModuleException: (Wrapped) Could not load cache configuration resource file:/home/oracle/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/myapp#1.0.0-SNAPSHOT/rmzguy/META-INF/coherence-cache-config.xml"
weblogic.application.ModuleException: (Wrapped) Could not load cache configuration resource file:/home/oracle/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/myapp#1.0.0-SNAPSHOT/rmzguy/META-INF/coherence-cache-config.xml
at weblogic.coherence.container.server.CoherenceModule.activate(CoherenceModule.java:237)
at weblogic.application.internal.flow.ModuleListenerInvoker.activate(ModuleListenerInvoker.java:114)
at weblogic.application.internal.flow.ModuleStateDriver$2.next(ModuleStateDriver.java:195)
at weblogic.application.internal.flow.ModuleStateDriver$2.next(ModuleStateDriver.java:190)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
at weblogic.application.internal.flow.ModuleStateDriver.activate(ModuleStateDriver.java:61)
at weblogic.application.internal.flow.DeploymentCallbackFlow.activate(DeploymentCallbackFlow.java:145)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:729)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:258)
at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:61)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:165)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:587)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:339)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:846)
at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1275)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:442)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:176)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:553)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
Caused By: java.io.IOException: Could not load cache configuration resource file:/home/oracle/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/myapp#1.0.0-SNAPSHOT/rmzguy/META-INF/coherence-cache-config.xml
at com.tangosol.net.ScopedCacheFactoryBuilder.loadConfigFromURI(ScopedCacheFactoryBuilder.java:351)
at com.tangosol.application.ContainerAdapter$ContainerCacheFactoryBuilder.buildFactory(ContainerAdapter.java:735)
at com.tangosol.net.ScopedCacheFactoryBuilder.getFactory(ScopedCacheFactoryBuilder.java:267)
at com.tangosol.net.ScopedCacheFactoryBuilder.getConfigurableCacheFactory(ScopedCacheFactoryBuilder.java:127)
at com.tangosol.application.ContainerAdapter.activate(ContainerAdapter.java:155)
at weblogic.coherence.container.server.CoherenceModule.activate(CoherenceModule.java:216)
at weblogic.application.internal.flow.ModuleListenerInvoker.activate(ModuleListenerInvoker.java:114)
at weblogic.application.internal.flow.ModuleStateDriver$2.next(ModuleStateDriver.java:195)
at weblogic.application.internal.flow.ModuleStateDriver$2.next(ModuleStateDriver.java:190)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
at weblogic.application.internal.flow.ModuleStateDriver.activate(ModuleStateDriver.java:61)
at weblogic.application.internal.flow.DeploymentCallbackFlow.activate(DeploymentCallbackFlow.java:145)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:729)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:258)
at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:61)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:165)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:587)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:339)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:846)
at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1275)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:442)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:176)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:553)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
Obviously, the cache configuration file can not be found, but I don't understand why. It looks like the GAR is not exploded/unpacked correctly but I dont't have a clue why.
EAR
Contents of the EAR
myapp-1.0.0-SNAPSHOT.ear
`-- META-INF
|-- application.xml
|-- weblogic-application.xml
|-- myapp-webapp-1.0.0-SNAPSHOT.war
|-- forward-webapp-1.0.0-SNAPSHOT.war
|-- mygar-1.0.0-SNAPSHOT.gar
application.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC
"-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
"http://java.sun.com/dtd/application_1_3.dtd">
<application>
<display-name>myapp</display-name>
<module>
<web>
<web-uri>myapp-webapp-1.0.0-SNAPSHOT.war</web-uri>
<context-root>/my/myapp-webapp</context-root>
</web>
</module>
<module>
<web>
<web-uri>forward-webapp-1.0.0-SNAPSHOT.war</web-uri>
<context-root>/my</context-root>
</web>
</module>
</application>
weblogic-application.xml
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-application
xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-application"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/javaee_5.xsd http://xmlns.oracle.com/weblogic/weblogic-application http://xmlns.oracle.com/weblogic/weblogic-application/1.6/weblogic-application.xsd">
<wls:application-param>
<wls:param-name>webapp.encoding.default</wls:param-name>
<wls:param-value>UTF-8</wls:param-value>
</wls:application-param>
<wls:module>
<wls:name>mygar</wls:name>
<wls:type>GAR</wls:type>
<wls:path>mygar-1.0.0-SNAPSHOT.gar</wls:path>
</wls:module>
<wls:prefer-application-packages>
<wls:package-name>org.slf4j.*</wls:package-name>
<wls:package-name>org.apache.log4j.*</wls:package-name>
</wls:prefer-application-packages>
<wls:prefer-application-resources>
<wls:resource-name>org.slf4j.*</wls:resource-name>
<wls:resource-name>org.apache.log4j.*</wls:resource-name>
</wls:prefer-application-resources>
</wls:weblogic-application>
GAR
Contents of the GAR
mygar-1.0.0-SNAPSHOT.gar
`-- META-INF
|-- coherence-application.xml
|-- coherence-cache-config.xml
`-- lib
|-- jar1.jar
|-- jar2.jar
|-- ...
|-- jarx.jar
coherence-application.xml
<?xml version="1.0"?>
<coherence-application
xmlns="http://xmlns.oracle.com/coherence/coherence-application">
<cache-configuration-ref>META-INF/coherence-cache-config.xml</cache-configuration-ref>
</coherence-application>
Does somebody have an idea what's going wrong?
As I'm really stuck on this one I just tried to explode the EAR "manually", i.e. unpack the contents of the EAR to a directory with the same name and - within that directory - do the same with the WAR and GAR archives. Then I tried to deploy that - and it works without any errors.
I'm even more confused now. What's the difference between deploying the exploded EAR vs. deploying the EAR as an archive? Any help or ideas on this would really be appreciated.
I finally found out what the problem is by remote Debugging the com.tangosol.net.ScopedCacheFactoryBuilder
class.
It turns out that the java.net.URL
class is not able to handle #
signs in URLs using the file://
protocol because the URL is then truncated after the #
sign, so
file:/home/oracle/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/myapp#1.0.0-SNAPSHOT/rmzguy/META-INF/coherence-cache-config.xml
is truncated to
file:/home/oracle/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/myapp
which indeed doesn't exist.
Unfortunately, the original IOException
reason stating that is lost so it isn't visible in the logs.
The reason for the #
being used for the temporary folder the EAR is exploded to is that I have the WebLogic-Application-Version
property set in the MANIFEST.MF
of the EAR.
So the solution to that problem is to remove the WebLogic-Application-Version
property set from the MANIFEST.MF
of the EAR.