You are working in an OSGi environment, so you need to be thinking from the
osgi classloading perspective. Each osgi bundle under
repository/components/{plugins,dropins} has its own classloader and a
classpath.

Hence, the place you put your persistence.xml is important. I'm not sure
how you call OpenJPA, so I cannot comment on what steps to follow. But in
essence, re-build your connector as an osgi bundle (its just a jar with a
set of manifest entries in MANIFEST.MF), and place it in
repository/components/dropins. I have not tested this myself though.

Regards,
KasunG


On Wed, May 3, 2017 at 8:38 PM, Thomas LEGRAND <thomas.legr...@versusmind.eu
> wrote:

> Hello everybody,
>
> I am currently writing a custom connector to retrieve information from a
> database. Because the mediators to do so does not fit my needs, I am using
> a custom Java class which is currently implemented to retrieve a DataSource
> via the JNDI name I configured in the ESB interface. That works nicely :)
>
> But then, for maintenance purpose, I would like to use JPA (preferably,
> the OpenJPA implementation :)) but it is like the persistence.xml is not
> even read. :(
> My libraries are placed in the lib/ directory in the generated zip of my
> connector and I don't have any problem using the classes of OpenJPA.
> Actually, just this error message appears:
>
> 1 INFO [PassThroughMessageProcessor-313] openjpa.Runtime - Starting
> OpenJPA 2.4.0 org.apache.openjpa.persistence.ArgumentException: The
> persistence provi der is attempting to use properties in the
> persistence.xml file to resolve the data source. A Java Database
> Connectivity (JDBC) driver or data source class name must be specified in
> the openjpa.ConnectionDriverName or javax.persistence.jdbc.driver property.
> The following properties are available in the configuration:
> "org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl@442ce698".
>
> In the persistence.xml, you have the following content :
>
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence";
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>     xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
>     http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd";>
>     <persistence-unit name="my-pu" transaction-type="RESOURCE_LOCAL">
>         <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</
> provider>
>         <jta-data-source>jdbc/MyDataSource</jta-data-source>
>     </persistence-unit>
> </persistence>
>
> Is there some hidden magic to make it work?
>
> Thank you :)
>
> Regards,
>
> Thomas
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 

*Kasun Gajasinghe*Associate Technical Lead, WSO2 Inc.
email: kasung AT spamfree wso2.com
linked-in: http://lk.linkedin.com/in/gajasinghe
blog: http://kasunbg.org
phone: +1 650-745-4499, 77 678 0813
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to