Search code examples
oracle-databasemavenservicebusosb

Deploying Oracle Service Bus With Maven: Deploys Fine From One Directory But Fails From Another


I'm attempting to create an automated build and deployment for an OSB (Oracle Service Bus) composite. Such a system consists of two commands (run via command prompt from the directory in which the POM resides) after setting up Maven and the OSB plugin on the build server:

mvn package
mvn deploy -DoracleServerUrl=http://serverurl:port -DoraclUsername=username -DoraclePassword=password

This fails in the build system with the following exception:

The session cannot be activated due to the existence of conflicts.

But I believe, at it's core, this is because the build system creates the package with the first command during the build phase, and then deploys with the second command during the release phase.

If I take the code directly and run the two commands from the directory 1: D:\OSBComposites\HelloWorldOSBService\HelloWorldOSBService the commands run and the composite deploys fine.

If I literally copy the same code from Directory 1 to Directory 2 and run the same commands from directory 2: D:\OSBComposites\HelloWorldOSBService\HelloWorldOSBService2 the second command fails with the same exception cited above.

This isn't a one-off situation either - I can recreate it dozens of times consistently. Running the commands from Directory 1 always succeeds while running the commands from Directory 2 always fails with the exception noted above.

And yes, this is a simple default HelloWorld composite - as simple as can be with no references to absolute paths.

Is there a cache in Maven or OSB that's "remembering" the original path from which the composite was first deployed or some other mechanism that prevents a composite from being deployed from a different location?


Solution

  • If your pom.xml resides in /path/directory1/pom.xml , your OSB project would get deployed as directory1 - redeploying as directory2 could then cause conflicts that you observe. If you need to deploy it from a different location, you could place it in /path2/directory1/pom.xml

    For your example, this should work: Copy your project's content to the path similar to below and then run the maven deployment

    D:\OSBComposites\HelloWorldOSBService2\HelloWorldOSBService