Hello,

That seems to be OK :)

osgi> p org.apache.openjpa.persistence
org.apache.openjpa.persistence; version="0.0.0"<openjpa_all_2.4.2_1.0.0
[132]>
org.apache.openjpa.persistence; version="2.3.0"<tomee_1.7.2.wso2v2 [632]>
  compass_2.0.1.wso2v2 [54] imports
  tomcat_7.0.75.wso2v1 [627] imports
osgi> ss openjpa
"Framework is launched."


id      State       Bundle
132     ACTIVE      openjpa_all_2.4.2_1.0.0
osgi>

So, I deployed my little JPA project and I can see that my package is
"registered":

osgi> p my.little.project.jpa
my.little.project.jpa; version="1.0.0"<mylittleproject-jpa_1.0.0 [60]>
  synapse-core_2.1.7.wso2v13 [619] imports
osgi>

So I tried to invoke my class to retrieve an EntityManager and now, I have:

javax.persistence.PersistenceException: Failed to load provider from
META-INF/services

I think that it is because the services/ directory in the META-INF in the
openjpa bundle is not parsed and I don't know what to do because this is
not me who generate the OSGi bundle but the ESB at startup.

Do you have an idea?

Regards,

Thomas


2017-05-04 20:37 GMT+02:00 KasunG Gajasinghe <[email protected]>:

>
> I do not think openjpa register any osgi services. Can you check whether
> the package is exposed? Also verify the status of the openjpa bundle.
>
> osgi> p org.apache.openjpa.persistence
> osgi> ss openjpa
>
> On Thu, May 4, 2017 at 7:01 PM, Thomas LEGRAND <
> [email protected]> wrote:
>
>> Hello again :)
>>
>> I retrieved the openjpa-all-2.4.2.jar file and dropped it in the 
>> <WSO2_ESB_HOME>/lib
>> directory to let the runtime taking care of the bundle generation during
>> the startup. The effect was the generation of the file
>> openjpa_all_2.4.2_1.0.0.jar in the directory <WSO2_ESB_HOME>/dropins.
>>
>> I restarted the EI with:
>>
>>  D:\ProjetESB\wso2ei-6.0.0\bin> .\integrator.bat -DosgiConsole=19444
>>
>> So I can connect to the OSGI  console via telnet. But, when I try to
>> retrieve the objectclasses starting with org.apache.openjpa.*, I have
>> nothing :(
>>
>> osgi> services (objectclass=org.apache.openjpa.*)
>> "No registered services."
>>
>> Am I missing something?
>>
>> Regards,
>>
>> Thomas
>>
>> 2017-05-04 10:49 GMT+02:00 KasunG Gajasinghe <[email protected]>:
>>
>>> Hi Thomas,
>>>
>>> Well, the connector itself cannot be deployed as an osgi bundle. But,
>>> you can call classes in osgi bundles from your connector. So, place your
>>> JPA logic in an osgi bundle and add it to dropins/ folder. Then, call that
>>> from your connector.
>>>
>>> This should give you flexibility over your classloading. I cannot
>>> comment on JPA stuff though.
>>>
>>> On Thu, May 4, 2017 at 1:26 PM, Thomas LEGRAND <
>>> [email protected]> wrote:
>>>
>>>> Hello KasunG,
>>>>
>>>> I forgot to mention that I am using wso2ei-6.0.0.
>>>>
>>>> During the build of my connector, I noticed that a .jar is created with
>>>> the .zip for the connector so I tried to deploy it. Actually, I tried the
>>>> following directories and my sequence does not find any of the components
>>>> like if my connector was not deployed :
>>>> - <WSO2_ESB_HOME>/repository/components/dropins (this directory did
>>>> not exist so I created it)
>>>> - <WSO2_ESB_HOME>/dropins
>>>>
>>>> In addition, I don't find anything in the documentation mentioning that
>>>> we can deploy connectors as an OSGi bundle :(
>>>>
>>>> When I deploy the .zip of the connector via the interface, it is
>>>> deployed in <WSO2_ESB_HOME>/repository/deployment/server/synapse-libs
>>>> which is the same directory used by Synapse:
>>>> http://synapse.apache.org/userguide/template_library.html
>>>>
>>>> Concerning the "architecture" of my component, I deployed a .zip with a
>>>> META-INF directory containing the persistence.xml but I don't think it is
>>>> used like the absence of mention in the Synaspe documentation above. :)
>>>> Then, I call OpenJPA with the following lines:
>>>>
>>>> EntityManagerFactory emf = Persistence.createEntityManage
>>>> rFactory("my-pu");
>>>> EntityManager mgr = emf.createEntityManager();
>>>>
>>>> But then, I have the exception.
>>>>
>>>> I made a topic on StackOverflow one or two weeks ago:
>>>> https://stackoverflow.com/questions/43538743/wso2-is-there-a
>>>> -way-to-use-jpa-in-a-custom-connector
>>>>
>>>> I you know a documentation to generate an OSGi bundle for a connector,
>>>> I am very interested. :)
>>>>
>>>> Regards,
>>>>
>>>> Thomas
>>>>
>>>> 2017-05-03 18:29 GMT+02:00 KasunG Gajasinghe <[email protected]>:
>>>>
>>>>> 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 <
>>>>> [email protected]> 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.PersistenceProvider
>>>>>> Impl</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
>>>>>> [email protected]
>>>>>> 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 <(650)%20745-4499>, 77 678 0813
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>>
>>> *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 <(650)%20745-4499>, 77 678 0813
>>>
>>>
>>
>>
>
>
> --
>
> *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 <(650)%20745-4499>, 77 678 0813
>
>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to