You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by objectorange <br...@briantaylor.us> on 2013/02/05 18:12:12 UTC

OSGi JPA

Is there an example/tutorial somewhere showing how to persist data using
ServiceMix 4.4 and OSGi? I have tried to use Camel-JPA, Camel-Hibernate, and
many, many other options each with countless classloading issues.

Thanks in advance,

Brian



--
View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-JPA-tp5715741.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: OSGi JPA

Posted by Christian Schneider <ch...@die-schneider.net>.
I don't think you can easily make the tutorial work in karaf 3.x.
The main missing piece is jta 1.2 support which would be difficult to 
provide in karaf 3.x.

So your best bet is to use an older version of the tutorial that was 
deployable on karaf 3.

https://github.com/cschneider/Karaf-Tutorial/tree/3634e6e1aa49c4173ccef047ae19c9f3a1a16c1e/tasklist-blueprint-cdi

Christian

On 09.12.2015 12:27, Kevin wrote:
> Hi Christian,
>
> I'm trying to follow your excellent tutorial here:
>
> http://www.liquid-reality.de/display/liquid/2015/03/05/Apache+Karaf+Tutorial+Part+9+-+Annotation+based+blueprint+and+JPA
>
> I've got it working nicely in standalone karaf 4.0.3 but my requirement for
> the project I'm working on is to use servicemix 6.0.0, which only contains
> karaf 3.0.5.
>
> I saw that another user had a similar requirement and you suggested manually
> installing the additional bundles.  I've tried installing all I can.  I
> added the enterprise 4.0.3 repo and manualling installing the latest jpa and
> persistence-api features, which seemed to work ok.  However it also looks
> for jndi feature, which I hit a block with when I attempted to install jndi
> (and others) I get a bigger problem:
>
> java.lang.IllegalStateException: Can't install feature jndi/0.0.0: 	
> Can not resolve feature:
> Unsatisfied requirement(s):
> ---------------------------
>    
> package:(&(package=org.osgi.framework)(version>=1.8.0)(!(version>=2.0.0)))
>        Apache Karaf :: JNDI :: Core
>
> How do I resolve this?
>
> Or alternatively, am I going down the wrong route- instead of trying to
> upgrade my karaf install by adding these features, should I instead be
> trying to change/remove features from your sample code to enable it to work
> in karaf 3.0.5?  If I was to go down that route, could you provide a little
> bit of help to get me started please?
>
> Sorry for asking fairly basic questions - I'm completely new to osgi and
> karaf/servicemix so am on a bit of a learning curve.
>
> Thanks,
>
> Kevin
>
>
>
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-JPA-tp5715741p5723255.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com


Re: OSGi JPA

Posted by Kevin <ji...@yahoo.co.uk>.
Hi Christian,

I'm trying to follow your excellent tutorial here:

http://www.liquid-reality.de/display/liquid/2015/03/05/Apache+Karaf+Tutorial+Part+9+-+Annotation+based+blueprint+and+JPA 

I've got it working nicely in standalone karaf 4.0.3 but my requirement for
the project I'm working on is to use servicemix 6.0.0, which only contains
karaf 3.0.5.

I saw that another user had a similar requirement and you suggested manually
installing the additional bundles.  I've tried installing all I can.  I
added the enterprise 4.0.3 repo and manualling installing the latest jpa and
persistence-api features, which seemed to work ok.  However it also looks
for jndi feature, which I hit a block with when I attempted to install jndi
(and others) I get a bigger problem:

java.lang.IllegalStateException: Can't install feature jndi/0.0.0: 	
Can not resolve feature:
Unsatisfied requirement(s):
---------------------------
  
package:(&(package=org.osgi.framework)(version>=1.8.0)(!(version>=2.0.0)))
      Apache Karaf :: JNDI :: Core

How do I resolve this?  

Or alternatively, am I going down the wrong route- instead of trying to
upgrade my karaf install by adding these features, should I instead be
trying to change/remove features from your sample code to enable it to work
in karaf 3.0.5?  If I was to go down that route, could you provide a little
bit of help to get me started please?

Sorry for asking fairly basic questions - I'm completely new to osgi and
karaf/servicemix so am on a bit of a learning curve.

Thanks,

Kevin






--
View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-JPA-tp5715741p5723255.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: OSGi JPA

Posted by Christian Schneider <ch...@die-schneider.net>.
Great to hear it works.

Christian

Am 09.02.2013 01:03, schrieb objectorange:
> We must use 'http://camel.apache.org/schema/blueprint' for the camel
> namespace within a blueprint xml. This now deploys to a 'created' status.
>
> Thanks Christian for getting me started! I owe you a virtual beer.
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-JPA-tp5715741p5715800.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.


-- 
  
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com


Re: OSGi JPA

Posted by objectorange <br...@briantaylor.us>.
We must use 'http://camel.apache.org/schema/blueprint' for the camel
namespace within a blueprint xml. This now deploys to a 'created' status.

Thanks Christian for getting me started! I owe you a virtual beer.



--
View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-JPA-tp5715741p5715800.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: OSGi JPA

Posted by objectorange <br...@briantaylor.us>.
It apparently doesn't like the Camel-Spring namespace within a blueprint.xml
file (below). Camel-Spring module is active so I'm not sure why the
blueprint container doesn't see it.

<blueprint xmlns="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/v1.1.0"
	xsi:schemaLocation="
  http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
  http://aries.apache.org/xmlns/jpa/v1.1.0
http://aries.apache.org/schemas/jpa/jpa_110.xsd
  ">

    <bean id="pp"
class="org.apache.openjpa.persistence.PersistenceProviderImpl"/>

    <service interface="javax.persistence.spi.PersistenceProvider" ref="pp">
        <service-properties>
            <entry key="javax.persistence.provider"
value="org.apache.openjpa.persistence.PersistenceProviderImpl"/>
        </service-properties>
    </service>

    <bean id="companyDS" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
        <property name="driverClassName"
value="${companydb.connection.driverClass}" />
        <property name="url" value="${companydb.connection.url}" />
        <property name="username" value="${companydb.connection.username}"
/>
        <property name="password" value="${companydb.connection.password}"
/>
    </bean>

    <service ref="companyDS" interface="javax.sql.DataSource">
        <service-properties>
            <entry key="osgi.jndi.service.name" value="jdbc/companydb"/>
        </service-properties>
    </service>

    <bean id="companyDAO"
class="com.vediscovery.infrastructure.database.rdbms.CompanyDAOImpl">
        <jpa:context property="entityManagerFactory" unitname="CompanyDB-PU"
/>
    </bean>

    <service ref="companyDAO"
interface="com.vediscovery.infrastructure.database.rdbms.CompanyDAO"/>

    <bean id="matterDS" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close"/>

    <service ref="matterDS" interface="javax.sql.DataSource">
        <service-properties>
            <entry key="osgi.jndi.service.name" value="jdbc/matterdb"/>
        </service-properties>
    </service>

    <bean id="matterDAO"
class="com.vediscovery.infrastructure.database.rdbms.MatterDAOImpl">
        <property name="companyDAO" ref="companyDAO"/>
        <jpa:context property="entityManagerFactory" unitname="MatterDB-PU"
/>
    </bean>

    <service ref="matterDAO"
interface="com.vediscovery.infrastructure.database.rdbms.MatterDAO"/>

    <camelContext id="RelationalDataService"
xmlns="http://camel.apache.org/schema/spring">

        <dataFormats>
            <jaxb id="jaxb-search"
contextPath="com.vediscovery.infrastructure.cdm.search"/>
            <jaxb id="jaxb-matter"
contextPath="com.vediscovery.infrastructure.cdm.matter"/>
        </dataFormats>

        <route id="RelationalDataService-GetAgentSearchCriteriaList-Route">

            <from
uri="vm:RelationalDataService-GetAgentSearchCriteriaList"/>

            <log
logName="RelationalDataService-GetAgentSearchCriteriaList-Route-Log"
                 message="GetAgentSearchCriteriaList Request: ${body}"
                 loggingLevel="DEBUG"/>

            <inOut uri="bean:matterDAO?method=getAgentSearchCriteriaList"/>

            <marshal ref="jaxb-matter"/>

        </route>

        <route id="RelationalDataService-SaveSearchCriteriaReport-Route">

            <from uri="vm:RelationalDataService-SaveSearchCriteriaReport"/>

            <log
logName="RelationalDataService-SaveSearchCriteriaReport-Route-Log"
                 message="SaveSearchCriteriaReport Request: ${body}"
                 loggingLevel="DEBUG"/>

            <unmarshal ref="jaxb-search"/>

            <inOnly uri="bean:matterDAO?method=saveSearchCriteriaReport"/>

            <marshal ref="jaxb-search"/>

        </route>

    </camelContext>

</blueprint>



--
View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-JPA-tp5715741p5715799.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: OSGi JPA

Posted by Christian Schneider <ch...@die-schneider.net>.
I am not sure if aries needs to be activated in servicemix. I always use 
pure karaf and install the features I need.
Typically servicemix is behind some versions compared to pure karaf.

You can try to install the features and bundles I installed in my 
tutorial. If the features are not present you could compare the 
installed bundles. Have you tried to install your bundle in pure karaf?

One thing I saw in your persistence.xml. You define two persistence 
units. I never tried that. So it may be worth a try to only define one.

Christian

Am 08.02.2013 23:16, schrieb objectorange:
> I changed the persistence.xml to reflect the 2.0 standard vs. 1.0
> (http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0")
> in the persistence tag and changed the openjpa.log Runtime to TRACE with the
> resulting logs to be ignored based on an IBM post.
>
> I'm just trying to figure out now why our component is waiting for
> 'namespace handlers' in the log snippet below. I don't see any aries
> 'features' in Karaf. Does aries need to be installed in ServiceMix? I
> thought it was already installed and 'active'.
>
> 16:51:38,653 | DEBUG | lixDispatchQueue | rdbms                            |
> 220 - com.vediscovery.infrastructure.database.rdbms - 1.0 | BundleEvent
> INSTALLED
> 16:51:39,248 | DEBUG | mix-4.4.2/deploy | Activator                        |
> 50 - org.apache.activemq.activemq-core - 5.5.1 | checking bundle 220
> 16:51:39,249 | DEBUG | mix-4.4.2/deploy | Activator                        |
> 50 - org.apache.activemq.activemq-core - 5.5.1 | The bundle does not import
> us: 220
> 16:51:39,249 | DEBUG | mix-4.4.2/deploy | Activator                        |
> 169 - org.apache.servicemix.bundles.openjpa - 1.2.1.2 | found persistence
> file at bundle://220.0:1/META-INF/persistence.xml
> 16:51:39,269 | DEBUG | mix-4.4.2/deploy | rdbms                            |
> 220 - com.vediscovery.infrastructure.database.rdbms - 1.0 | ServiceEvent
> REGISTERED
> 16:51:39,269 | DEBUG | mix-4.4.2/deploy | rdbms                            |
> 220 - com.vediscovery.infrastructure.database.rdbms - 1.0 | ServiceEvent
> REGISTERED
> 16:51:39,271 | DEBUG | lixDispatchQueue | rdbms                            |
> 220 - com.vediscovery.infrastructure.database.rdbms - 1.0 | BundleEvent
> RESOLVED
> 16:51:39,271 | DEBUG | mix-4.4.2/deploy | Deployer                         |
> 195 - org.apache.servicemix.jbi.deployer - 1.5.0 | Checking bundle:
> 'VeDISCOVERY Infrastructure :: Database :: RDBMS
> (com.vediscovery.infrastructure.database.rdbms)'
> 16:51:39,272 | DEBUG | mix-4.4.2/deploy | Deployer                         |
> 195 - org.apache.servicemix.jbi.deployer - 1.5.0 | Bundle 'VeDISCOVERY
> Infrastructure :: Database :: RDBMS
> (com.vediscovery.infrastructure.database.rdbms)' does not contain any JBI
> descriptor.
> 16:51:39,272 | DEBUG | mix-4.4.2/deploy | BundleWatcher                    |
> 122 - org.ops4j.pax.web.pax-web-extender-war - 1.0.7 | Scanning bundle
> [com.vediscovery.infrastructure.database.rdbms]
> 16:51:39,272 | DEBUG | mix-4.4.2/deploy | Activator                        |
> 91 - org.apache.camel.camel-core - 2.8.5 | Bundle started:
> com.vediscovery.infrastructure.database.rdbms
> 16:51:39,273 | DEBUG | mix-4.4.2/deploy | ContextLoaderListener            |
> 76 - org.springframework.osgi.extender - 1.2.1 | Scanning bundle
> [VeDISCOVERY Infrastructure :: Database :: RDBMS
> (com.vediscovery.infrastructure.database.rdbms)] for configurations...
> 16:51:39,273 | DEBUG | mix-4.4.2/deploy | ContextLoaderListener            |
> 76 - org.springframework.osgi.extender - 1.2.1 | Creating an application
> context for bundle [VeDISCOVERY Infrastructure :: Database :: RDBMS
> (com.vediscovery.infrastructure.database.rdbms)]
> 16:51:39,273 | DEBUG | mix-4.4.2/deploy | ContextLoaderListener            |
> 76 - org.springframework.osgi.extender - 1.2.1 | No application context
> created for bundle [VeDISCOVERY Infrastructure :: Database :: RDBMS
> (com.vediscovery.infrastructure.database.rdbms)]
> 16:51:39,273 | DEBUG | mix-4.4.2/deploy | BlueprintExtender                |
> 10 - org.apache.aries.blueprint - 0.3.1 | Scanning bundle
> com.vediscovery.infrastructure.database.rdbms for blueprint application
> 16:51:39,274 | DEBUG | mix-4.4.2/deploy | BlueprintExtender                |
> 10 - org.apache.aries.blueprint - 0.3.1 | Found blueprint application in
> bundle com.vediscovery.infrastructure.database.rdbms with paths:
> [bundle://220.0:0/OSGI-INF/blueprint/blueprint.xml]
> 16:51:39,274 | DEBUG | mix-4.4.2/deploy | geronimo-osgi-registry           |
> 83 - org.apache.geronimo.specs.geronimo-osgi-registry - 1.1 | Bundle
> Considered for class providers:
> com.vediscovery.infrastructure.database.rdbms
> 16:51:39,274 | DEBUG | rint Extender: 1 | BlueprintContainerImpl           |
> 10 - org.apache.aries.blueprint - 0.3.1 | Running blueprint container for
> bundle com.vediscovery.infrastructure.database.rdbms in state Unknown
> 16:51:39,274 | DEBUG | mix-4.4.2/deploy | geronimo-osgi-registry           |
> 83 - org.apache.geronimo.specs.geronimo-osgi-registry - 1.1 | adding bundle
> com.vediscovery.infrastructure.database.rdbms [220]
> 16:51:39,274 | DEBUG | rint Extender: 1 | BlueprintEventDispatcher         |
> 10 - org.apache.aries.blueprint - 0.3.1 | Sending blueprint container event
> BlueprintEvent[type=CREATING] for bundle
> com.vediscovery.infrastructure.database.rdbms
> 16:51:39,275 | DEBUG | lixDispatchQueue | rdbms                            |
> 220 - com.vediscovery.infrastructure.database.rdbms - 1.0 | BundleEvent
> STARTED
> 16:51:39,275 | DEBUG | nt Dispatcher: 1 | BlueprintListener                |
> 19 - org.apache.karaf.shell.osgi - 2.2.4 | Blueprint app state changed to
> Creating for bundle 220
> 16:51:39,279 | DEBUG | rint Extender: 1 | BlueprintContainerImpl           |
> 10 - org.apache.aries.blueprint - 0.3.1 | Running blueprint container for
> bundle com.vediscovery.infrastructure.database.rdbms in state
> WaitForNamespaceHandlers
> 16:51:39,280 | INFO  | rint Extender: 1 | BlueprintContainerImpl           |
> 10 - org.apache.aries.blueprint - 0.3.1 | Bundle
> com.vediscovery.infrastructure.database.rdbms is waiting for namespace
> handlers
> 16:51:39,280 | DEBUG | rint Extender: 1 | BlueprintEventDispatcher         |
> 10 - org.apache.aries.blueprint - 0.3.1 | Sending blueprint container event
> BlueprintEvent[type=GRACE_PERIOD,
> dependencies=[(&(objectClass=org.apache.aries.blueprint.NamespaceHandler)(osgi.service.blueprint.namespace=http://camel.apache.org/schema/spring))]]
> for bundle com.vediscovery.infrastructure.database.rdbms
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-JPA-tp5715741p5715798.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.


-- 
  
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com


Re: OSGi JPA

Posted by objectorange <br...@briantaylor.us>.
I changed the persistence.xml to reflect the 2.0 standard vs. 1.0
(http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0")
in the persistence tag and changed the openjpa.log Runtime to TRACE with the
resulting logs to be ignored based on an IBM post.

I'm just trying to figure out now why our component is waiting for
'namespace handlers' in the log snippet below. I don't see any aries
'features' in Karaf. Does aries need to be installed in ServiceMix? I
thought it was already installed and 'active'.

16:51:38,653 | DEBUG | lixDispatchQueue | rdbms                            |
220 - com.vediscovery.infrastructure.database.rdbms - 1.0 | BundleEvent
INSTALLED
16:51:39,248 | DEBUG | mix-4.4.2/deploy | Activator                        |
50 - org.apache.activemq.activemq-core - 5.5.1 | checking bundle 220
16:51:39,249 | DEBUG | mix-4.4.2/deploy | Activator                        |
50 - org.apache.activemq.activemq-core - 5.5.1 | The bundle does not import
us: 220
16:51:39,249 | DEBUG | mix-4.4.2/deploy | Activator                        |
169 - org.apache.servicemix.bundles.openjpa - 1.2.1.2 | found persistence
file at bundle://220.0:1/META-INF/persistence.xml
16:51:39,269 | DEBUG | mix-4.4.2/deploy | rdbms                            |
220 - com.vediscovery.infrastructure.database.rdbms - 1.0 | ServiceEvent
REGISTERED
16:51:39,269 | DEBUG | mix-4.4.2/deploy | rdbms                            |
220 - com.vediscovery.infrastructure.database.rdbms - 1.0 | ServiceEvent
REGISTERED
16:51:39,271 | DEBUG | lixDispatchQueue | rdbms                            |
220 - com.vediscovery.infrastructure.database.rdbms - 1.0 | BundleEvent
RESOLVED
16:51:39,271 | DEBUG | mix-4.4.2/deploy | Deployer                         |
195 - org.apache.servicemix.jbi.deployer - 1.5.0 | Checking bundle:
'VeDISCOVERY Infrastructure :: Database :: RDBMS
(com.vediscovery.infrastructure.database.rdbms)'
16:51:39,272 | DEBUG | mix-4.4.2/deploy | Deployer                         |
195 - org.apache.servicemix.jbi.deployer - 1.5.0 | Bundle 'VeDISCOVERY
Infrastructure :: Database :: RDBMS
(com.vediscovery.infrastructure.database.rdbms)' does not contain any JBI
descriptor.
16:51:39,272 | DEBUG | mix-4.4.2/deploy | BundleWatcher                    |
122 - org.ops4j.pax.web.pax-web-extender-war - 1.0.7 | Scanning bundle
[com.vediscovery.infrastructure.database.rdbms]
16:51:39,272 | DEBUG | mix-4.4.2/deploy | Activator                        |
91 - org.apache.camel.camel-core - 2.8.5 | Bundle started:
com.vediscovery.infrastructure.database.rdbms
16:51:39,273 | DEBUG | mix-4.4.2/deploy | ContextLoaderListener            |
76 - org.springframework.osgi.extender - 1.2.1 | Scanning bundle
[VeDISCOVERY Infrastructure :: Database :: RDBMS
(com.vediscovery.infrastructure.database.rdbms)] for configurations...
16:51:39,273 | DEBUG | mix-4.4.2/deploy | ContextLoaderListener            |
76 - org.springframework.osgi.extender - 1.2.1 | Creating an application
context for bundle [VeDISCOVERY Infrastructure :: Database :: RDBMS
(com.vediscovery.infrastructure.database.rdbms)]
16:51:39,273 | DEBUG | mix-4.4.2/deploy | ContextLoaderListener            |
76 - org.springframework.osgi.extender - 1.2.1 | No application context
created for bundle [VeDISCOVERY Infrastructure :: Database :: RDBMS
(com.vediscovery.infrastructure.database.rdbms)]
16:51:39,273 | DEBUG | mix-4.4.2/deploy | BlueprintExtender                |
10 - org.apache.aries.blueprint - 0.3.1 | Scanning bundle
com.vediscovery.infrastructure.database.rdbms for blueprint application
16:51:39,274 | DEBUG | mix-4.4.2/deploy | BlueprintExtender                |
10 - org.apache.aries.blueprint - 0.3.1 | Found blueprint application in
bundle com.vediscovery.infrastructure.database.rdbms with paths:
[bundle://220.0:0/OSGI-INF/blueprint/blueprint.xml]
16:51:39,274 | DEBUG | mix-4.4.2/deploy | geronimo-osgi-registry           |
83 - org.apache.geronimo.specs.geronimo-osgi-registry - 1.1 | Bundle
Considered for class providers:
com.vediscovery.infrastructure.database.rdbms
16:51:39,274 | DEBUG | rint Extender: 1 | BlueprintContainerImpl           |
10 - org.apache.aries.blueprint - 0.3.1 | Running blueprint container for
bundle com.vediscovery.infrastructure.database.rdbms in state Unknown
16:51:39,274 | DEBUG | mix-4.4.2/deploy | geronimo-osgi-registry           |
83 - org.apache.geronimo.specs.geronimo-osgi-registry - 1.1 | adding bundle
com.vediscovery.infrastructure.database.rdbms [220]
16:51:39,274 | DEBUG | rint Extender: 1 | BlueprintEventDispatcher         |
10 - org.apache.aries.blueprint - 0.3.1 | Sending blueprint container event
BlueprintEvent[type=CREATING] for bundle
com.vediscovery.infrastructure.database.rdbms
16:51:39,275 | DEBUG | lixDispatchQueue | rdbms                            |
220 - com.vediscovery.infrastructure.database.rdbms - 1.0 | BundleEvent
STARTED
16:51:39,275 | DEBUG | nt Dispatcher: 1 | BlueprintListener                |
19 - org.apache.karaf.shell.osgi - 2.2.4 | Blueprint app state changed to
Creating for bundle 220
16:51:39,279 | DEBUG | rint Extender: 1 | BlueprintContainerImpl           |
10 - org.apache.aries.blueprint - 0.3.1 | Running blueprint container for
bundle com.vediscovery.infrastructure.database.rdbms in state
WaitForNamespaceHandlers
16:51:39,280 | INFO  | rint Extender: 1 | BlueprintContainerImpl           |
10 - org.apache.aries.blueprint - 0.3.1 | Bundle
com.vediscovery.infrastructure.database.rdbms is waiting for namespace
handlers 
16:51:39,280 | DEBUG | rint Extender: 1 | BlueprintEventDispatcher         |
10 - org.apache.aries.blueprint - 0.3.1 | Sending blueprint container event
BlueprintEvent[type=GRACE_PERIOD,
dependencies=[(&(objectClass=org.apache.aries.blueprint.NamespaceHandler)(osgi.service.blueprint.namespace=http://camel.apache.org/schema/spring))]]
for bundle com.vediscovery.infrastructure.database.rdbms



--
View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-JPA-tp5715741p5715798.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: OSGi JPA

Posted by objectorange <br...@briantaylor.us>.
Found it in the persistence.xml (added Runtime=INFO):

<?xml version="1.0" encoding="UTF-8" ?>
<persistence 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_1_0.xsd"
version="1.0">

    <persistence-unit name="CompanyDB-PU" transaction-type="JTA">
        <description>Company DB Persistence Unit</description>
       
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
       
<jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/companydb)</jta-data-source>
        <mapping-file>META-INF/companydb-orm.xml</mapping-file>
        <properties>
            <property name="javax.persistence.jdbc.url"
value="${companydb.connection.url}"/>
            <property name="javax.persistence.jdbc.driver"
value="${companydb.connection.driverClass}"/>
            <property name="javax.persistence.jdbc.user"
value="${companydb.connection.username}"/>
            <property name="javax.persistence.jdbc.password"
value="${companydb.connection.password}" />
            <property name="openjpa.Log"
value="DefaultLevel=WARN,Tool=INFO,Runtime=INFO"/>
        </properties>
    </persistence-unit>

    <persistence-unit name="MatterDB-PU" transaction-type="JTA">
        <description>Matter DB Persistence Unit</description>
       
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
       
<jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/matterdb)</jta-data-source>
        <mapping-file>META-INF/matterdb-orm.xml</mapping-file>
        <properties>
            <property name="javax.persistence.jdbc.url" value=""/>
            <property name="javax.persistence.jdbc.driver" value=""/>
            <property name="javax.persistence.jdbc.user" value=""/>
            <property name="javax.persistence.jdbc.password" value="" />
            <property name="openjpa.Log"
value="DefaultLevel=WARN,Tool=INFO,Runtime=INFO"/>
        </properties>
    </persistence-unit>

</persistence>



--
View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-JPA-tp5715741p5715797.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: OSGi JPA

Posted by objectorange <br...@briantaylor.us>.
...and I'm not sure how to set that log level. Apparently we need to set it
as such:

<property name="openjpa.Log" value="SQL=TRACE"/>

...based on this link:
http://openjpa.apache.org/builds/2.2.1/apache-openjpa/docs/manual.html#ref_guide_logging

But I don't see where that property is defined anywhere.



--
View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-JPA-tp5715741p5715796.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: OSGi JPA

Posted by objectorange <br...@briantaylor.us>.
I increased the log to DEBUG and redeployed our bundle. Attached is the
updated log. Upon the redeploy, the following message was written to the
Karaf console: openjpa.Runtime - An error occurred while registering a
ClassTransformer with
org.apache.aries.jpa.container.unit.impl.PersistenceUnitInfo@5c03fks. The
error has been consumed. To see it, set your openjpa.Runtime log level to
TRACE. Load-time class transformation will not be available.

servicemix.log
<http://servicemix.396122.n5.nabble.com/file/n5715795/servicemix.log>  



--
View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-JPA-tp5715741p5715795.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: OSGi JPA

Posted by Christian Schneider <ch...@die-schneider.net>.
Try to increase the log level to debug with log:set. Then it will show 
which namespace handler it waits for. I guess it waits for the 
http://aries.apache.org/xmlns/jpa/v1.1.0 namespace.

Christian

Am 08.02.2013 20:24, schrieb objectorange:
> I don't know how to push the list of bundles to a log but attached is the
> servicemix log. I'm using openjpa 2.2.1 and that appears to be installing
> correctly  (is 'Active')..that solved the prior error message of '...no
> providers available' but our bundle still is in the 'GracePeriod' status and
> I don't know how to determine what dependencies it is waiting on.
>
> servicemix.log
> <http://servicemix.396122.n5.nabble.com/file/n5715793/servicemix.log>
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-JPA-tp5715741p5715793.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.


-- 
  
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com


Re: OSGi JPA

Posted by objectorange <br...@briantaylor.us>.
I don't know how to push the list of bundles to a log but attached is the
servicemix log. I'm using openjpa 2.2.1 and that appears to be installing
correctly  (is 'Active')..that solved the prior error message of '...no
providers available' but our bundle still is in the 'GracePeriod' status and
I don't know how to determine what dependencies it is waiting on.

servicemix.log
<http://servicemix.396122.n5.nabble.com/file/n5715793/servicemix.log>  



--
View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-JPA-tp5715741p5715793.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: OSGi JPA

Posted by Christian Schneider <ch...@die-schneider.net>.
Can you push the logs and the list of bundles you have in karaf to gist 
or similar and ideally also your example?
Are you using openjpa as a provider? If not I recommend to start with it 
as it is easiest to get running then you can switch if you want.

Christian

Am 07.02.2013 22:57, schrieb objectorange:
> ...and 'The bundle ... is already active, it may not be possible to create
> managed persistence units for it.' and 'There are no providers available.'
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-JPA-tp5715741p5715785.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.


-- 
  
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com


Re: OSGi JPA

Posted by objectorange <br...@briantaylor.us>.
...and 'The bundle ... is already active, it may not be possible to create
managed persistence units for it.' and 'There are no providers available.'



--
View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-JPA-tp5715741p5715785.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: OSGi JPA

Posted by objectorange <br...@briantaylor.us>.
To be more explicit, we are getting this in the log:

Bundle ... is waiting for namespace handlers



--
View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-JPA-tp5715741p5715784.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: OSGi JPA

Posted by objectorange <br...@briantaylor.us>.
I'm also getting [GracePeriod] in Karaf as the status for our deployed
component. The log says that it's waiting for dependencies but how do we
know what those dependencies?



--
View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-JPA-tp5715741p5715783.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: OSGi JPA

Posted by objectorange <br...@briantaylor.us>.
In step 3 of http://aries.apache.org/modules/jpaproject.html, shouldn't the
datasource be configured in the persistence.xml instead or do we have to
define it there and the blueprint.xml or just the blueprint.xml?



--
View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-JPA-tp5715741p5715782.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: OSGi JPA

Posted by Christian Schneider <ch...@die-schneider.net>.
My example uses the aries jpa support to connect to the provider:
http://aries.apache.org/modules/jpaproject.html
This implements the OSGI JPA Service spec (see the OSGi compendium spec
document).

>From your bundle you use the Manifest entry Meta-Persistence to tell
aries that it needs a jpa provider.
The jpa provider itself has to register itself in osgi as a service with
a special property javax.persistence.provider.
This way aries jpa finds available providers.

So basically you simply install the persistence provider you want and if
the provider follows the OSGI jpa service spec then it will
automatically be found by aries jpa.

As far as I know openjpa and eclipse link currenty work with this. My
example shows how to use openjpa. On the aries mailing list it was reported
that eclipse link also should work now but I do not know how to install it.

Christian

On 06.02.2013 23:03, objectorange wrote:
> Christian, where are you setting your JPA Provider?
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-JPA-tp5715741p5715772.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com


Re: OSGi JPA

Posted by objectorange <br...@briantaylor.us>.
Christian, where are you setting your JPA Provider?



--
View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-JPA-tp5715741p5715772.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: OSGi JPA

Posted by objectorange <br...@briantaylor.us>.
Thanks Christian I will give that a whirl!



--
View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-JPA-tp5715741p5715749.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: OSGi JPA

Posted by Christian Schneider <ch...@die-schneider.net>.
Hi Brian,

I got a tutorial that might help you:
http://www.liquid-reality.de/display/liquid/2012/07/20/Apache+Karaf+Tutorial+Part+7+-+Camel+JPA+and+JTA+transactions

Best regards
Christian

On 05.02.2013 18:12, objectorange wrote:
> Is there an example/tutorial somewhere showing how to persist data using
> ServiceMix 4.4 and OSGi? I have tried to use Camel-JPA, Camel-Hibernate, and
> many, many other options each with countless classloading issues.
>
> Thanks in advance,
>
> Brian
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/OSGi-JPA-tp5715741.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com