我使用ServiceMix 3.5 我有多個ServiceAssemblies,每個ServiceUnit。 服務單位有許多共同的圖書館,所以我在maven pom中用'提供'範圍標記它們。 共享庫包含我想要服務單元共享的所有庫。 我根據以下Maven pom.xml中的內置,但效果是一個簡單的異常:如何使用jbi-maven-plugin集成servicemix共享庫?
拋出java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource類加載器 org.apache.xbean。 spring.context.FileSystemXmlApplicationContext
我可以做什麼(可能使用jbi-maven-plugin)以便我的服務單元使用共享庫中的jar?
共享庫服務單元POM:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>aaa.bbb</groupId>
<artifactId>SHARED_SU</artifactId>
<packaging>jbi-service-unit</packaging>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>aaa.bbb</groupId>
<artifactId>theParent</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<build>
<defaultGoal>install</defaultGoal>
<plugins/>
</build>
<properties><componentName>servicemix-camel</componentName></properties>
<dependencies>
...
</dependencies>
</project>
共享庫服務單元POM:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>aaa.bbb</groupId>
<artifactId>SHARED_SA</artifactId>
<packaging>jbi-shared-library</packaging>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>aaa.bbb</groupId>
<artifactId>theParent</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>aaa.bbb</groupId>
<artifactId>SHARED_SU</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>jbi-maven-plugin</artifactId>
<version>3.2.3</version>
<extensions>true</extensions>
<configuration>
<type>service-assembly</type>
<classLoaderDelegation>parent-first</classLoaderDelegation>
</configuration>
</plugin>
</plugins>
</build>
</project>
需要使用的共享庫的服務單元的聚甲醛:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>aaa.bbb</groupId>
<artifactId>theServiceUnit</artifactId>
<packaging>jbi-service-unit</packaging>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>aaa.bbb</groupId>
<artifactId>theParent</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>jbi-maven-plugin</artifactId>
<version>3.2.3</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
<dependencies>
... <!-- all "PROVIDED" in scope-->
<properties>
<componentName>servicemix-camel</componentName>
</properties>
</project>
爲服務單元
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>aaa.bbb</groupId>
<artifactId>theServiceAssembly</artifactId>
<packaging>jbi-service-assembly</packaging>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>aaa.bbb</groupId>
<artifactId>theParent</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>aaa.bbb</groupId>
<artifactId>theServiceUnit</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>jbi-maven-plugin</artifactId>
<version>3.2.3</version>
<extensions>true</extensions>
<configuration>
<type>service-assembly</type>
</configuration>
</plugin>
</plugins>
</build>
</project>