You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by John MIPIH <wo...@free.fr> on 2008/04/28 10:30:48 UTC

Problem with JSR181 - Spring - JPA dependencies

Hello,

I have trouble trying to develop a JSR181 service unit. I wrote spring
services using JPA(hibernate) on a mysql database. I wrote on my pom.xml all
the dependencies I needed. All the jars are downloaded automatically by
Maven, so far everything's perfect.
When I try "mvn install" i got the message 

2008-04-28 09:59:14,412 [main] INFO edDataSourceConnectionProvider - Using
provided datasource
2008-04-28 09:59:14,412 [main] WARN SettingsFactory - Could not obtain
connection metadata org.apache.commons.dbcp.SQLNestedException: Cannot load
JDBC driver class 'com.mysql.jdbc.Driver' at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:770) 

com.mysql.jdbc.Driver is in one of my dependency (mysql-connector), I
checked.

I tried "mvn compile" and it worked fine but "mvn package" output the same
message.

The build ends successfully, all my jars are in target/service-xxxx/lib but
I have to put all this jar in service-mix-directory/lib to make it work fine
in servicemix...

I tried to put all my jar in /lib on my service unit but it changed nothing.

I uploaded all my SU in a .zip available at
http://dl.free.fr/hvr8JQBmg/services-spring-JSR181.zip (20 Ko) or enclosed
to this message 
http://www.nabble.com/file/p16930956/services-spring-JSR181.zip
services-spring-JSR181.zip . A simple "mvn clean compile package -e" shows
the problem.

Here's my file :
xbean.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0"
xmlns:krd="http://servicemix.apache.org/krd">
	
	<import resource="spring-config.xml"/> 
	
    <jsr181:endpoint service="krd:myPojo" pojo="#ServicePatient" />
	
</beans>

spring-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">

	<!-- couches applicatives -->
	<bean id="ServicePatientDAO" class="mm.dao.ServicePatientDAO" />
	<bean id="ServiceComptaDAO" class="mm.dao.ServiceComptaDAO" />
	
	<bean id="ServicePatient" class="mm.service.ServicePatientImpl">
		<property name="dao" ref="ServicePatientDAO" />
	</bean>
	<bean id="ServiceCompta" class="mm.service.ServiceComptaImpl">
		<property name="dao" ref="ServiceComptaDAO" />
	</bean>

	<bean id="persistenceUnitManager"
	
class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">
		<property name="persistenceXmlLocations">
			<list>
				<value>classpath*:persistence.xml</value>
			</list>
		</property>
		<property name="defaultDataSource" ref="dataSource"/>
	</bean>


	<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<property name="persistenceUnitManager" ref="persistenceUnitManager"/>
		<property name="jpaVendorAdapter">
			<bean
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
				<property name="databasePlatform"
value="org.hibernate.dialect.MySQL5InnoDBDialect" />
				<property name="generateDdl" value="true" />
			</bean>
		</property>
		<property name="loadTimeWeaver">
			<bean
class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"
/>
		</property>
	</bean>

	<!-- la source de donnéees -->
	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
		<property name="driverClassName" value="com.mysql.jdbc.Driver" />
		<property name="url" value="jdbc:mysql://localhost:3306/pocspring" />
		<property name="username" value="root" />
		<property name="password" value="" />
	</bean>

	<!-- le gestionnaire de transactions -->
	<tx:annotation-driven transaction-manager="txManager" />
	<bean id="txManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
		<property name="entityManagerFactory" ref="entityManagerFactory" />
	</bean>

	<!-- traduction des exceptions -->
	<bean
class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"
/>

	<!-- persistence -->
	<bean
class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"
/>

</beans>

pom.xml
<?xml version="1.0" encoding="UTF-8"?><project>
  <parent>
    <artifactId>parent</artifactId>
    <groupId>mm.poc.esb</groupId>
    <version>1.0</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <groupId>mm.poc.esb</groupId>
  <artifactId>services-spring-JSR181</artifactId>
  <packaging>jbi-service-unit</packaging>
  <name>Services spring exposes en JSR181</name>
  <version>1.0-SNAPSHOT</version>
  <url>http://www.mipih.net</url>
  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <includes>
          <include>**/*</include>
        </includes>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.servicemix.tooling</groupId>
        <artifactId>jbi-maven-plugin</artifactId>
        <version>${servicemix-version}</version>
        <extensions>true</extensions>
        <configuration>
          <type>service-unit</type>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <repositories>
    <repository>
      <releases />
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>apache</id>
      <name>Apache Repository</name>
      <url>http://people.apache.org/repo/m2-ibiblio-rsync-repository</url>
    </repository>
    <repository>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots />
      <id>apache.snapshots</id>
      <name>Apache Snapshots Repository</name>
      <url>http://people.apache.org/repo/m2-snapshot-repository</url>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <releases />
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>apache</id>
      <name>Apache Repository</name>
      <url>http://people.apache.org/repo/m2-ibiblio-rsync-repository</url>
    </pluginRepository>
    <pluginRepository>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots />
      <id>apache.snapshots</id>
      <name>Apache Snapshots Repository</name>
      <url>http://people.apache.org/repo/m2-snapshot-repository</url>
    </pluginRepository>
  </pluginRepositories>
  
  <dependencies>
 
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>5.0.5</version>
      <scope>compile</scope>
    </dependency> 
       
    <dependency>
      <groupId>org.apache.servicemix</groupId>
      <artifactId>servicemix-jsr181</artifactId>
      <version>${servicemix-version}</version>
    </dependency>
    
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>javax.persistence</groupId>
      <artifactId>ejb3-persistence</artifactId>
      <version>1.0</version>
    </dependency>
    
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-annotations</artifactId>
      <version>${hibernate-version}</version>
    </dependency>
    
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-entitymanager</artifactId>
      <version>${hibernate-version}</version>
    </dependency>
    
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-tools</artifactId>
      <version>${hibernate-version}</version>
    </dependency>  
      
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate</artifactId>
      <version>${hibernate-version}</version>
    </dependency>
    
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring</artifactId>
      <version>${spring-version}</version>
    </dependency>

  </dependencies>
  <properties>
    <servicemix-version>3.2.1</servicemix-version>
    <hibernate-version>3.2.0.ga</hibernate-version>
    <spring-version>2.0.5</spring-version>
  </properties>
</project>


Thanks by advance

John
-- 
View this message in context: http://www.nabble.com/Problem-with-JSR181---Spring---JPA-dependencies-tp16930956p16930956.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Problem with JSR181 - Spring - JPA dependencies

Posted by Guillaume Nodet <gn...@gmail.com>.
This is expected in some cases.
The maven jbi plugin tries to launch the spring configuration for the
SU (xbean.xml) to find some informations for the SU jbi descriptor
generation.  As the JBI descriptor for SU is not mandated by
ServiceMix, the maven plugin simply displays a warning when the
xbean.xml could not be started because it requires some specific
configuration.

On Tue, Apr 29, 2008 at 10:10 AM, John MIPIH <wo...@free.fr> wrote:
>
>  After some workaround i was able to deploy my service unit without any
>  additional jars in <servicemix-directory>/lib but "mvn install" still
>  complains even if it ends on a build successfull. What exactly does the mvn
>  install on a service-unit ?
>  --
>  View this message in context: http://www.nabble.com/Problem-with-JSR181---Spring---JPA-dependencies-tp16930956p16954519.html
>
>
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: Problem with JSR181 - Spring - JPA dependencies

Posted by John MIPIH <wo...@free.fr>.
After some workaround i was able to deploy my service unit without any
additional jars in <servicemix-directory>/lib but "mvn install" still
complains even if it ends on a build successfull. What exactly does the mvn
install on a service-unit ? 
-- 
View this message in context: http://www.nabble.com/Problem-with-JSR181---Spring---JPA-dependencies-tp16930956p16954519.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.