Dear community, i think i have a issue wiring up Spring(Blueprint) /
Hibernate / JPA / OPS4J JDBC / Camel, using:
1. Karaf 4.0.8 (Felix)
2. Servicemix Spring 3.2.17
3. Aries JPA 2.3.0
4. Hibernate 4.3.6
5. OPS4J Pax JDBC 0.9.0
6. Camel 2.16.5
The problem occurs when running a camel route using transaction demarcation
on it giving a javax.persistence.TransactionRequiredException: no
transaction is in progress.
Persistence unit
org.hibernate.jpa.HibernatePersistenceProvider
osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=pydio2xbound-mssql)
de.hmm.medit.esb.xbound.pydio2xbound.some.classes
true
DAO context:
http://www.osgi.org/xmlns/blueprint/v1.0.0;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
xmlns:jpa="http://aries.apache.org/xmlns/jpa/v2.0.0;
xmlns:tx="http://aries.apache.org/xmlns/transactions/v2.0.0;
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
https://osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://aries.apache.org/xmlns/jpa/v2.0.0
http://aries.apache.org/schemas/jpa/jpa_200.xsd;>
DAO service:
public class Dao implements DaoService {
@PersistenceContext(unitName = UNIT_NAME_MSSQL)
EntityManager entityManagerMSSQL;
@Transactional(Transactional.TxType.REQUIRED)
@Override
public void persist(AuftragsDatei auftragsDatei) {
entityManagerMSSQL.persist(auftragsDatei);
...etc...
OPS4J Persistence config file:
dataSourceName=pydio2xbound-mssql
databaseName=pydio2xbound
osgi.jdbc.driver.name=mssql-pool
url=jdbc:sqlserver://127.0.0.1:1433
user=root
password=
jdbc.pool.maxTotal=4
#jdbc.factory.defaultAutoCommit=false
Karaf list datasource:
^karaf@root>service:list DataSource
[javax.sql.DataSource]
--
databaseName = pydio2xbound
dataSourceName = pydio2xbound-mssql
felix.fileinstall.filename =
file:/E:/Development/karaf/medit-esb-1.3.1-SNAPSHOT/etc/org.ops4j.datasource-xbound.pydio2xbound.mssql.persistence.cfg
jdbc.pool.maxTotal = 4
osgi.jdbc.driver.name = mssql-pool
osgi.jndi.service.name = pydio2xbound-mssql
password = *
service.bundleid = 252
service.factoryPid = org.ops4j.datasource
service.id = 271
service.pid = org.ops4j.datasource.0025c61e-c8d5-451f-91e5-f1258d806ce5
service.scope = singleton
url = jdbc:sqlserver://127.0.0.1:1433
user = root
Provided by :
OPS4J Pax JDBC Config (252)
Used by:
Apache Aries JPA container (236)
Spring / Camel context:
http://camel.apache.org/schema/blueprint;>
GET
cxfrs:bean:dynamicClient?address=${in.header.CamelHttpUri}
${body}
${body.auftragsDatei}
<...some more routing...>
Complete stacktrace:
2017-08-23 16:43:00,070 | DEBUG | 4 - timer://rest |
> aggregation | 48 - org.apache.camel.camel-core -
> 2.16.5 | Processing file :
> https://transfer.zhp-online.de/pydio/api/v2/io/my-files/excel/Auftrags%2520daten_20170504-8.csv
> 2017-08-23 16:43:00,070 | DEBUG | 4 - timer://rest |
> DataSourceTransactionManager | 157 -
> org.apache.servicemix.bundles.spring-tx - 3.2.17.RELEASE_1 | Creating new
> transaction with name [null]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
> 2017-08-23 16:43:00,070 | DEBUG | 4 - timer://rest |
> DataSourceTransactionManager | 157 -
> org.apache.servicemix.bundles.spring-tx - 3.2.17.RELEASE_1 | Acquired
> Connection [1735559577,
> URL=jdbc:sqlserver://127.0.0.1:1433;authenticationScheme=nativeAuthentication;xopenStates=false;sendTimeAsDatetime=true;trustServerCertificate=false;sendStringParametersAsUnicode=true;selectMethod=direct;responseBuffering=adaptive;packetSize=8000;multiSubnetFailover=false;loginTimeout=15;lockTimeout=-1;lastUpdateCount=true;encrypt=false;disableStatementPooling=true;databaseName=pydio2xbound;applicationName=Microsoft
>
> JDBC Driver for SQL Server;applicationIntent=readwrite;, UserName=root,
> Microsoft JDBC Driver 4.1 for SQL Server] for JDBC transaction
> 2017-08-23 16:43:00,070 | DEBUG | 4 - timer://rest |
> DataSourceTransactionManager | 157 -
> org.apache.servicemix.bundles.spring-tx - 3.2.17.RELEASE_1 | Switching JDBC
> Connection [1735559577,
> URL=jdbc:sqlserver://127.0.0.1:1433;authenticationScheme=nativeAuthentication;xopenStates=false;sendTimeAsDatetime=true;trustServerCertificate=false;sendStringParametersAsUnicode=true;selectMethod=direct;responseBuffering=adaptive;packetSize=8000;multiSubnetFailover=false;loginTimeout=15;lockTimeout=-1;lastUpdateCount=true;encrypt=false;disableStatementPooling=true;databaseName=pydio2xbound;applicationName=Microsoft
>
> JDBC Driver for SQL Server;applicationIntent=readwrite;, UserName=root,
> Microsoft JDBC Driver 4.1 for SQL Server] to manual commit
> 2017-08-23