Re: Migrating from Karaf 2.4.1 to 4.0.5, JPA problems

2016-07-07 Thread Christian Schneider
Genereally Aries JPA should work with OpenJPA 2.4.1 but I think there is 
some bug in karaf 4.0.5.


I just tested again and found that persistence api 2.0 and 2.1 are both 
installed. This fails as Aries JPA can only bind to one of these and 
will choose the higher version.
As a workaround you should be able to create your own feature copied 
from the Aries JPA feature but make sure you install the persistence api 
only in version 2.0.


I will try to create a working version of the features for karaf 4.0.6.

Christian


On 07.07.2016 14:07, Bengt Rodehav wrote:
Installing feature "openjpa" also installs JPA 2.0 (version 1.1) so I 
shouldn't need to install JPA manually as well. However, then I won't 
get the Aries support for JPA. Feels a bit weird.


What Aries JPa version should be used together with OpenJPA 2.4.1?

/Bengt

2016-07-07 14:04 GMT+02:00 Bengt Rodehav <mailto:be...@rodehav.com>>:


It seems to be the "jpa" feature that installs JPA 2.1.

2016-07-07 13:58 GMT+02:00 Bengt Rodehav mailto:be...@rodehav.com>>:

On a fresh Karaf 4.0.5 I do:

/la | grep -i jpa/
/la | grep -i persistence/

Nothing is displayed. I then do:

/feature:install openjpa jpa
/

If I then execute the above commands I get:

/karaf@root()> la | grep -i jpa/
/62 | Active   |  80 | 2.3.0   | Apache Aries JPA
Container API/
/63 | Active   |  80 | 2.3.0   | Apache Aries JPA
blueprint/
/64 | Active   |  80 | 2.3.0   | Apache Aries JPA
container/
/65 | Active   |  80 | 2.3.0   | Apache Aries JPA
support/
/71 | Active   |  80 | 1.1 | Apache Geronimo
JSR-317 JPA 2.0 Spec AP/
/73 | Active   |  80 | 2.4.1   | OpenJPA Aggregate
Jar/
/karaf@root()> la | grep -i persistence/
/55 | Active   |  80 | 2.1.0.v201304241213 | Java Persistence
API 2.1/
/karaf@root()>/

So JPA 2.1 has indeed been installed. I don't know if this is
why I have problems but it still seems strange.

    /Bengt


2016-07-07 13:11 GMT+02:00 Christian Schneider
mailto:ch...@die-schneider.net>>:

Can you start from an empty karaf 4.0.5 and then do

feature:install openjpa jpa

This should install openjpa 2.4.1 and aries jpa 2.3.0 with
javax.persistence 2.0 and jta 1.2.

This configuration should work. So maybe something else
you install requires the jpa 2.1 spec.

Christian




On 07.07.2016 10:28, Bengt Rodehav wrote:

Reading your post again Christian I realize that I should
not use JPA 2.1 but JPA 2.0.

I seem to have JPA 2.0 and JPA 2.1 installed at runtime:

/karaf@root()> la | grep -i jpa/
/ 37 | Active   |  80 | 2.3.0 | Apache Aries JPA
Container API/
/ 38 | Active   |  80 | 2.3.0 | Apache Aries JPA
blueprint/
/ 39 | Active   |  80 | 2.3.0 | Apache Aries JPA
container/
/ 40 | Active   |  80 | 2.3.0 | Apache Aries JPA
support/
/ 70 | Active   |  80 | 1.1 | Apache Geronimo
JSR-317 JPA 2.0 Spec API/
/106 | Active   |  80 | 2.4.1 | OpenJPA Aggregate
Jar/
/karaf@root()> la | grep -i persistence/
/ 17 | Active   |  80 | 2.1.0.v201304241213   | Java
Persistence API 2.1/
/175 | Active   |  80 | 2.8.0.SNAPSHOT| Connect
:: persistence-util/

I don't really know why the JPA version 2.1
(2.1.0.v201304241213) is being installed. I do not do
this explicitly.

Looking at OpenJPA 2.4.1, it seems to depend on JTA 1.1
not JTA 1.2.

Looked again at my JPA version. I do use JPA 2.0. But I
use version 1.1 of artifact geronimo-jpa_2.0_spec which
caused me to believe I was using JPA 1.1

I'm still kind of confused. It would be thankful if you
could tell me what features (and versions of those
features) I should install in order to use the latest
    version (2.4.1) of OpenJPA.

/Bengt




-- 
Christian Schneider

http://www.liquid-reality.de

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







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

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



Re: Migrating from Karaf 2.4.1 to 4.0.5, JPA problems

2016-07-07 Thread Christian Schneider
Hmm this could actually explain the problems we see. I always wondered 
why karaf insists to install the 2.1 version of the jpa spec bundle but 
this explains it.


Luckily this should be easy to solve. Try to install the OSGi jpa spec 
bundle:

http://search.maven.org/#artifactdetails%7Corg.osgi%7Corg.osgi.service.jpa%7C1.0.0%7Cjar

It should contain exactly the missing package. I think we are missing 
this bundle in the feature. We just did not see it as it is embeded in 
the jpa 2.1 spec bundle we use.
You could also try to simply add this bundle to the persistence-api 
2.0.0 feature. Maybe then karaf already does the right thing.


Christian

On 07.07.2016 15:04, Bengt Rodehav wrote:


It seems like the or.apache.aries.jpa.container requires the package 
org.osgi.service.jpa (at least version 1.0.0) and that package is only 
provided by the JPA 2.1 bundle...


Hope you understand this a bit better than me but it does not seem to 
be easy to come up with a working solution including OpenJPA 2.4.1 in 
Karar 4.0.5. If you have a workaround to try before you get a fix inte 
Karaf 4.0.6 I would be grateful.


/Bengt



2016-07-07 14:17 GMT+02:00 Bengt Rodehav <mailto:be...@rodehav.com>>:


OK - thanks a lot for all your help Christian.

/Bengt


2016-07-07 14:14 GMT+02:00 Christian Schneider
mailto:ch...@die-schneider.net>>:

Genereally Aries JPA should work with OpenJPA 2.4.1 but I
think there is some bug in karaf 4.0.5.

I just tested again and found that persistence api 2.0 and 2.1
are both installed. This fails as Aries JPA can only bind to
one of these and will choose the higher version.
As a workaround you should be able to create your own feature
copied from the Aries JPA feature but make sure you install
the persistence api only in version 2.0.

I will try to create a working version of the features for
karaf 4.0.6.

Christian



On 07.07.2016 14:07, Bengt Rodehav wrote:

Installing feature "openjpa" also installs JPA 2.0 (version
1.1) so I shouldn't need to install JPA manually as well.
However, then I won't get the Aries support for JPA. Feels a
bit weird.

What Aries JPa version should be used together with OpenJPA
2.4.1?

/Bengt

2016-07-07 14:04 GMT+02:00 Bengt Rodehav mailto:be...@rodehav.com>>:

It seems to be the "jpa" feature that installs JPA 2.1.

2016-07-07 13:58 GMT+02:00 Bengt Rodehav
mailto:be...@rodehav.com>>:

On a fresh Karaf 4.0.5 I do:

/la | grep -i jpa/
/la | grep -i persistence/

Nothing is displayed. I then do:

/feature:install openjpa jpa
/

If I then execute the above commands I get:

/karaf@root()> la | grep -i jpa/
/62 | Active   |  80 | 2.3.0 | Apache
Aries JPA Container API/
/63 | Active   |  80 | 2.3.0 | Apache
Aries JPA blueprint/
/64 | Active   |  80 | 2.3.0 | Apache
Aries JPA container/
/65 | Active   |  80 | 2.3.0 | Apache
Aries JPA support/
/71 | Active   |  80 | 1.1 | Apache
Geronimo JSR-317 JPA 2.0 Spec AP/
/73 | Active   |  80 | 2.4.1 | OpenJPA
Aggregate Jar/
/karaf@root()> la | grep -i persistence/
/55 | Active   |  80 | 2.1.0.v201304241213 | Java
Persistence API 2.1/
/karaf@root()>/

So JPA 2.1 has indeed been installed. I don't know if
this is why I have problems but it still seems strange.

    /Bengt


2016-07-07 13:11 GMT+02:00 Christian Schneider
mailto:ch...@die-schneider.net>>:

Can you start from an empty karaf 4.0.5 and then do

feature:install openjpa jpa

This should install openjpa 2.4.1 and aries jpa
2.3.0 with javax.persistence 2.0 and jta 1.2.

This configuration should work. So maybe
something else you install requires the jpa 2.1 spec.

Christian




On 07.07.2016 10:28, Bengt Rodehav wrote:

Reading your post again Christian I realize that
I should not use JPA 2.1 but JPA 2.0.

I seem to have JPA 2.0 and JPA 2.1 installed at
runtime:

/karaf@root()> la | grep -i jpa/
/ 37 | Active   |  80 | 2.3.0 | Apache Aries JPA
Con

Re: Migrating from Karaf 2.4.1 to 4.0.5, JPA problems

2016-07-08 Thread Christian Schneider
(BundleTracker.java:469)[org.osgi.core-6.0.0.jar:]
at

org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415)[org.osgi.core-6.0.0.jar:]
at

org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)[org.osgi.core-6.0.0.jar:]
at

org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)[org.osgi.core-6.0.0.jar:]
at

org.osgi.util.tracker.BundleTracker.open(BundleTracker.java:156)[org.osgi.core-6.0.0.jar:]
at

org.apache.aries.jpa.container.impl.Activator.start(Activator.java:43)[38:org.apache.aries.jpa.container:2.3.0]
at

org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:697)[org.apache.felix.framework-5.4.0.jar:]
at

org.apache.felix.framework.Felix.activateBundle(Felix.java:2226)[org.apache.felix.framework-5.4.0.jar:]
... 11 more
Caused by: org.osgi.framework.InvalidSyntaxException: Only one
top-level operation allowed:
(&(objectClass=javax.sql.DataSource)(osgi.jndi.service.name

<http://osgi.jndi.service.name>=osgi:service/javax.sql.XADataSource/(osgi.jndi.service.name
<http://osgi.jndi.service.name>=jdbc/filetransferhistoryjta)))
at

org.apache.felix.framework.FilterImpl.(FilterImpl.java:51)[org.apache.felix.framework-5.4.0.jar:]
at

org.apache.felix.framework.BundleContextImpl.createFilter(BundleContextImpl.java:134)[org.apache.felix.framework-5.4.0.jar:]
at

org.apache.aries.jpa.container.impl.DataSourceTracker.createFilter(DataSourceTracker.java:62)[38:org.apache.aries.jpa.container:2.3.0]
... 33 more

It seems like the JNDI search has two top-level operations
which doesn't seem to be allowed. Looking at the exception it
looks like one top level operation to me. The operation is "&"
("and") and the two expressions that should be "anded"
together are:

/(objectClass=javax.sql.DataSource)
/

and

/(osgi.jndi.service.name

<http://osgi.jndi.service.name>=osgi:service/javax.sql.XADataSource/(osgi.jndi.service.name
<http://osgi.jndi.service.name>=jdbc/filetransferhistoryjta))
/

But the second expression looks a bit fishy to me although I'm
not a JNDI expert.


I assume the expressions has its origins in my persistence.xml:

//
/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"/
/version="2.0">/
//

/org.apache.openjpa.persistence.PersistenceProviderImpl/

/osgi:service/javax.sql.XADataSource/(osgi.jndi.service.name

<http://osgi.jndi.service.name>=jdbc/filetransferhistoryjta)/

/osgi:service/javax.sql.DataSource/(osgi.jndi.service.name

<http://osgi.jndi.service.name>=jdbc/filetransferhistorynojta)/
/se.digia.connect.filetransfer.history.domain.Entry/
/se.digia.connect.filetransfer.history.domain.FileEntry/
/se.digia.connect.filetransfer.history.domain.Retry/
/se.digia.connect.util.persistence.EntityBase/
/true/
/NONE/
//
/  /
/  /
/  /
/  /
/  /
//
//
//

I have both a  and a .
    Is that not supported anymore?

/Bengt














2016-07-07 15:28 GMT+02:00 Bengt Rodehav mailto:be...@rodehav.com>>:

OK - I'll try.

Thanks,

/Bengt

2016-07-07 15:22 GMT+02:00 Christian Schneider
mailto:ch...@die-schneider.net>>:

Hmm this could actually explain the problems we see. I
always wondered why karaf insists to install the 2.1
version of the jpa spec bundle but this explains it.

Luckily this should be easy to solve. Try to install
the OSGi jpa spec bundle:

http://search.maven.org/#artifactdetails%7Corg.osgi%7Corg.osgi.service.jpa%7C1.0.0%7Cjar

It should contain exactly the missing package. I think
we are missing this bundle in the feature. We just did
not see it as it is embeded in the jpa 2.1 spec bundle
we use.
You could also try to simply add this bundle to the
persistence-api 2.0.0 feature. Maybe then karaf
already does the right thing.

Christian


On 07.07.2016 15:04, Bengt Rodehav wrote:


It seems like the or.apache.aries.jpa.container
  

Re: Properties cfg wish...

2016-07-08 Thread Christian Schneider
If multi-location solves your problem and you are on R4.2 the

solution is not to reinvent it for R4.2 or blueprint but to
upgrade to R5+.

thanks
david jencks


On Jul 7, 2016, at 12:38 PM, Brad Johnson
mailto:brad.john...@mediadriver.com>> wrote:

Isn't this the Aries discussion forum which has a Blueprint
implementation?  Why would this be the incorrect place to ask
about such issues?

On Thu, Jul 7, 2016 at 2:34 PM, Brad Johnson
mailto:brad.john...@mediadriver.com>> wrote:

As I said on the Camel mailing list Red Hat isn't pushing
that approach and I can't push my clients into things they
don't want.  You and Scott England Sullivan seem to be the
ones who think that DS is going to save the world.  I have a
number of friends in consultancy both inside and outside Red
Hat and they don't like or push DS.

On Thu, Jul 7, 2016 at 2:30 PM, David Jencks
mailto:david_jen...@yahoo.com>> wrote:

I strongly suggest that you work on this in the context
of an OSGI RFP/RFC.  You are apt to get much better
advice that conducting the design discussion here.  I
think it’s fairly ridiculous that after all these years
blueprint’s relationship to config admin is unspecified.
I think that there are no “blueprint people” other than
users these days.

I would also suggest studying at least the R6 config
admin spec and understanding multi locations as that
will make it clear that blueprint shouldn’t have
anything explicit to do with bundle locations and that
your concerns about sharing configuration across bundles
have been dealt with in the appropriate spec already.

In addition I suggest studying the DS R6 multiple pid
support as a possible model for what you are interested
in.  I don’t think your apparent idea of using pid name
parsing as the way of relating multiple pids is very
scalable or comprehensible.

On the other hand, you could approach this all from a
management agent perspective and have the management
agent merge configuration source data with related
“names" into a single configuration.  This would work
with current blueprint cm.

I think that merging data in config admin is an
untenable approach.  It certainly wasn’t the approach
adopted for DS, and I would think getting spec support
for it would be difficult.

david jencks


> On Jul 7, 2016, at 10:53 AM, Brad Johnson
mailto:brad.john...@mediadriver.com>> wrote:
>
> As I work in more environments now that want to use
microservices the limitations of the blueprint
properties mechanics become a bit hairier.  I commonly
find that I have bundles that have common properties
shared across them and I can't find a good solution
other than creating my own OSGi service for serving them
up for such crosscutting concerns.
>
> I'm not an expert on the specification and
implementations of compendium or blueprint libraries so
don't know how feasible something like this would be but
I would find the following terribly useful.
>
> A properties hierarchy much like Maven that permits
you to specify a parent that you inherit from and then
can add to or override.
>
> com.foo.parent.cfg
> com.foo.child.cfg
>
> The child cfg file might have a #! directive at the
top specifying com.foo.parent PID. And if another one was
>
> com.foo.grandchild.cfg
>
> it might specify com.foo.child as its parent.  Then
the CM would load parent, override it with child and
finally override that grahdchild.
>
> Yes, I'd still have to specify
>
> 
>
> in my bundle and that would still be bound to that
single bundle but this could alleviate the need for
replication of properties across a lot of bundles.
>
    > Technically that is all rather straightforward but I'm
not sure how well that would align with the
specifications or goals of CM.
>
> Brad











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

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



Re: Properties cfg wish...

2016-07-08 Thread Christian Schneider
ll have to specify



in my bundle and that would still be bound to that single
bundle but this could alleviate the need for replication
of properties across a lot of bundles.

Technically that is all rather straightforward but I'm not
sure how well that would align with the specifications or
goals of CM.

Brad







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

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



Re: Properties cfg wish...

2016-07-08 Thread Christian Schneider

> proxies ensure that Camel has what it needs when it runs

Unfortunately this is not true. Camel only runs well because the defined 
start levels start the components before your user bundles. This is a 
very fragile approach though and totally breaks when not using karaf. 
The core of the problem is that in camel you access a component by just 
a String uri. If the component is present at the time the route starts 
then this will work if not it will break.
As the dependency to the component is just a URI there is no way to use 
static code analysis to make sure all necessary components are present. 
So I am not sure how to solve this.


Christian

On 08.07.2016 13:05, Brad Johnson wrote:

Christian,

Perhaps that's why my view of DS isn't as sunny as it could be since I 
use Camel extensively and did not have great experiences with it and 
DS.  While I know that proxies have their downside and that chaining 
is preferable, proxies ensure that Camel has what it needs when it 
runs.  When I fire up Fuse with 800 bundles the thought of having to 
manage start up orders as one more configuration chore is a bit 
depressing.


I'm very much looking forward to when I can do more work with Karaf 4 
and profiles.  For most of my clients they are in Fuse back in 2.x 
however.


Brad



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

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



Re: Properties cfg wish...

2016-07-08 Thread Christian Schneider
If you only need very generic configs then using a System property is 
also a good choice. You can not change these at runtime but

Aries blueprint can use System properties quite conveniently.

Christian

On 08.07.2016 14:11, Brad Johnson wrote:

David B,

The Configurator looks like it is on a good track.  I'll have to 
re-read to grok all the implications.  Interestingly this made me 
think of an interim work around for some of the issues identified in 
the paper with the way the file based blueprint cfg mechanics work.  
Currently I associate my cfg files with my bundles and use features to 
install and rename them.


But if those cfg files for a subsystem existed in the same bundle then 
it would be easy to create a plugin to merge parent->child properties 
into the final pid.cfg file. Reinstalling the bundle would then 
trigger a reload on bundles specifying that update strategy.  One 
would still end up with one bundle/one PID cfg in the end bound to the 
blueprint properties.  But to modify something like a common URI for a 
file location or endpoint could happen in a parent cfg file that is 
then compiled into the various concrete PID.cfgs, put into the bundle, 
and then installed into the system (with overwrite = true).


Not an ideal way of doing this perhaps but maybe a way to work around 
the limitations imposed by blueprint's lack of support of 
multilocations and single PID binding.  That could also make creating 
dev/test/production configuration bundles easier since that could be a 
settable parameter.





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

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



Re: Properties cfg wish...

2016-07-08 Thread Christian Schneider
Can you give some examples of typical config properties that need to be 
shared between these bundles. Maybe they lead to an idea for a different 
design.


Christian

On 08.07.2016 15:09, Brad Johnson wrote:

Christian,

Thanks for the feedback.  I'm actually looking for a bit more robust 
solution.  Just the one small project I'm working on now has 12 
business processes with a number of OSGi services that provide 
cross-cutting concerns.  In this case they are service like credit 
card authorization, refunds, etc.   CXF front ends them with REST/SOAP 
and I use recipientList to route them.  But each of those business 
processes use OSGi services that might call out to banks, PayPal, 
analytics services, etc.  Keeping these nicely segregated in their own 
bundles makes them very testable for the routing, data transformation 
to/from canonical form, etc.  But configuration management is a bit of 
a pain because of the PID pinning.  I use update strategy reload on 
the bundles so that configurations can be changed in different 
environments.


Until now I've kept my configuration files in each bundle and pop them 
out using the features install mechanism.  But I'm rethinking that 
based on these discussions.  I don't know if the Maven properties 
plugin would do what I'm thinking about but it might be a platform to 
develop such a plugin.  In this case I'd have a separate configuration 
bundle with my PID cfgs in them and N levels of parent cfg files.  The 
properties would just be rolled up and written out into PID specific 
cfg files.  If I define a port or directory in a parent then all the 
children would inherit or override that property.  That would permit 
the use of profiles for dev, test and production as well.  Modifying 
any of the cfg files and then putting that through Jenkins would 
result in a nice configuration bundle that once reinstalled would 
trigger a reload.  In the end the port or directory or endpoint 
configuration information would be duplicated in each cfg but it 
wouldn't require hand massaging of each cfg to change.




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

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



Re: Migrating from Karaf 2.4.1 to 4.0.5, JPA problems

2016-07-08 Thread Christian Schneider
framework.BundleImpl.start(BundleImpl.java:998)[org.apache.felix.framework-5.4.0.jar:]/
/at 
org.apache.karaf.bundle.command.Start.executeOnBundle(Start.java:38)[73:org.apache.karaf.bundle.core:4.0.5]/
/at 
org.apache.karaf.bundle.command.BundlesCommand.doExecute(BundlesCommand.java:64)[73:org.apache.karaf.bundle.core:4.0.5]/
/at 
org.apache.karaf.bundle.command.BundlesCommand.execute(BundlesCommand.java:54)[73:org.apache.karaf.bundle.core:4.0.5]/
/at 
org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:83)[97:org.apache.karaf.shell.core:4.0.5]/
/at 
org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:67)[97:org.apache.karaf.shell.core:4.0.5]/
/at 
org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:87)[97:org.apache.karaf.shell.core:4.0.5]/
/at 
org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:480)[97:org.apache.karaf.shell.core:4.0.5]/
/at 
org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:406)[97:org.apache.karaf.shell.core:4.0.5]/
/at 
org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[97:org.apache.karaf.shell.core:4.0.5]/
/at 
org.apache.felix.gogo.runtime.Closure.execute(Closure.java:182)[97:org.apache.karaf.shell.core:4.0.5]/
/at 
org.apache.felix.gogo.runtime.Closure.execute(Closure.java:119)[97:org.apache.karaf.shell.core:4.0.5]/
/at 
org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:94)[97:org.apache.karaf.shell.core:4.0.5]/
/at 
org.apache.karaf.shell.impl.console.ConsoleSessionImpl.run(ConsoleSessionImpl.java:270)[97:org.apache.karaf.shell.core:4.0.5]/

/at java.lang.Thread.run(Thread.java:745)[:1.8.0_74]/
/Caused by: 
org.osgi.service.blueprint.container.ComponentDefinitionException: 
org.osgi.service.blueprint.container.ComponentDefinitionException: 
Unable to find property descriptor url on class 
org.apache.derby.jdbc.EmbeddedDataSource/
/at 
org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:310)[24:org.apache.aries.blueprint.core:1.6.1]/
/at 
org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:252)[24:org.apache.aries.blueprint.core:1.6.1]/
/at 
org.apache.aries.blueprint.container.ServiceRecipe.getService(ServiceRecipe.java:365)[24:org.apache.aries.blueprint.core:1.6.1]/
/at 
org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:541)[24:org.apache.aries.blueprint.core:1.6.1]/
/at 
org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:347)[org.apache.felix.framework-5.4.0.jar:]/

/... 51 more/
/Caused by: 
org.osgi.service.blueprint.container.ComponentDefinitionException: 
Unable to find property descriptor url on class 
org.apache.derby.jdbc.EmbeddedDataSource/
/at 
org.apache.aries.blueprint.container.BeanRecipe.getPropertyDescriptor(BeanRecipe.java:976)[24:org.apache.aries.blueprint.core:1.6.1]/
/at 
org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:958)[24:org.apache.aries.blueprint.core:1.6.1]/
/at 
org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:929)[24:org.apache.aries.blueprint.core:1.6.1]/
/at 
org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:910)[24:org.apache.aries.blueprint.core:1.6.1]/
/at 
org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:844)[24:org.apache.aries.blueprint.core:1.6.1]/
/at 
org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:811)[24:org.apache.aries.blueprint.core:1.6.1]/
/at 
org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[24:org.apache.aries.blueprint.core:1.6.1]/

/at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_74]/
/at 
org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[24:org.apache.aries.blueprint.core:1.6.1]/
/at 
org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62)[24:org.apache.aries.blueprint.core:1.6.1]/
/at 
org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)[24:org.apache.aries.blueprint.core:1.6.1]/
/at 
org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:285)[24:org.apache.aries.blueprint.core:1.6.1]/

/... 55 more/

So, maybe the "url" property can't be used for pax-jdbc-derby?


/Bengt




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

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



Re: Migrating from Karaf 2.4.1 to 4.0.5, JPA problems

2016-07-11 Thread Christian Schneider
You config looks good. I think it would be great to update the docs. Can 
you edit this yourself in the pax-jdbc wiki?

If you do not have wiki access you can ask for it on the ops4j mailing list.

The error you get: Auto-commit can not be set while enrolled in a 
transaction" might be an issue in dbcp2. I thought it would be solved 
already.
You can try to report it at openjpa and dbcp2. If you do not use the 
newest pax-jdbc version then you could also try that.


Unfortunately I was not able to find the issue at pax-jdbc or dbcp2.

Christian




On 11.07.2016 10:00, Bengt Rodehav wrote:

Thanks Christian,

It seemed the reason why the pax-jdbc datasource wasn't picked up by 
JPA Blueprint was that I had given it the wrong name...


I had forgotten the "jdbc/" prefix that I use in my persistence.xml. 
It is now picked up as it should.


There is, however, an error in the documentation in the link you gave 
me. It says:


---


  Method Arguments

The argument passed to |createDataSource(), 
createConnectionPoolDataSource(), createXADataSource()| supports the 
following properties:


  * |DataSourceFactory.JDBC_DATABASE_NAME| (mandatory)
  * |DataSourceFactory.JDBC_USER|
  * |DataSourceFactory.JDBC_PASSWORD|

_An |SQLException| is thrown if any other properties are set_ or if a 
mandatory property is missing.



--


But I need to pass properties directly to the jdbc driver. In my case 
"createDatabase=create" so that the database is created if it doesn't 
already exists. I therefore set this property in my 
org.ops4j.datasource configuration as follows:


osgi.jdbc.driver.name <http://osgi.jdbc.driver.name>=derby-pool-xa
databaseName=historyDB
dataSourceName=jdbc/filetransferhistory
createDatabase=create

The "createDatabase" property is passed to the driver so that the 
database is created. So, it is OK to pass other properties as well - 
they get passed along.


However, I do still have a problem getting the Derby database to be 
created. When trying to create a new database I get:



Caused by: java.sql.SQLException: Auto-commit can not be set while 
enrolled in a transaction
at 
org.apache.commons.dbcp2.managed.ManagedConnection.setAutoCommit(ManagedConnection.java:223)
at 
org.apache.openjpa.lib.jdbc.DelegatingConnection.setAutoCommit(DelegatingConnection.java:167)
at 
org.apache.openjpa.lib.jdbc.DelegatingConnection.setAutoCommit(DelegatingConnection.java:167)
at 
org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator$ConfiguringConnection.setAutoCommit(ConfiguringConnectionDecorator.java:116)
at 
org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:1297)
at 
org.apache.openjpa.jdbc.schema.SchemaTool.createTable(SchemaTool.java:1017)
at 
org.apache.openjpa.jdbc.schema.SchemaTool.buildSchema(SchemaTool.java:573)
at 
org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:481)
at 
org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:368)
at 
org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:343)
at 
org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:507)

... 46 more

It works if I instead use "derby" or "derby-pool" DataSourceFactory. I 
tried to provide a  for this purpose but it is 
never being used. I thought this was the reason why a 
 should be provided. Not sure whether this is a 
problem with JPA blueprint or if its a problem in OpenJPA. Maybe I 
should ask on the OpenJPA mailing list?


/Bengt




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

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



Re: Migrating from Karaf 2.4.1 to 4.0.5, JPA problems

2016-07-11 Thread Christian Schneider
This is decided by Aries JPA. If you use transaction-type="JTA" then the 
jta-datasource is used else the non-jta-datasource.


Christian

On 11.07.2016 11:03, Bengt Rodehav wrote:
I think the important question is: _Who_ determines whether to use the 
 or the ?


The follow-up question would be: _What criteria_ is being used to 
choose between them?


/Bengt



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

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



Re: Migrating from Karaf 2.4.1 to 4.0.5, JPA problems

2016-07-11 Thread Christian Schneider

On 11.07.2016 10:58, Bengt Rodehav wrote:


There is also a difference in the way I published the datasource with 
Blueprint and the way it is being done in pax-jdbc. With Blueprint I 
published both a DataSource and an XADataSource. pax-jdbc is only 
publishing a DataSource but somehow still supports XA (I don't really 
know how this works).
This is something I read in the transaction specs. The user should 
always use a DataSource. XADataSource is just for internal use by the 
app server.
The app server has the responsibility of wrapping the XADataSource in a 
DataSource and do the resource enlistment with the TransactionManager.


Christian


There is a risk that someone (OpenJPA, JPA Blueprint, ...) is checking 
if it is dealing with a DataSource or an XADataSource. If the first 
then auto commit should be OK, if the latter not and it may then try 
the  instead. Since we are only publishing a 
DataSource (via pax-jdbc) it could signal to a client that auto commit 
is OK since this is not an XADataSource. Do you agree?


/Bengt

-- 
Christian Schneider

http://www.liquid-reality.de

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





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

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



Re: Migrating from Karaf 2.4.1 to 4.0.5, JPA problems

2016-07-11 Thread Christian Schneider
Hmm ... honestly I do not know. Why does creating the mappings not work 
in a a transaction?


Christian

On 11.07.2016 11:14, Bengt Rodehav wrote:
But isn't the whole idea with providing both a  and a 
 that the latter can be used for example when 
creating the database schema outside of any transaction? My 
persistence.sql looks like this:


//
/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"/

/  version="2.0">/
//
/org.apache.openjpa.persistence.PersistenceProviderImpl/
/osgi:service/javax.sql.DataSource/(osgi.jndi.service.name 
<http://osgi.jndi.service.name>=jdbc/filetransferhistory)/
/osgi:service/javax.sql.DataSource/(osgi.jndi.service.name 
<http://osgi.jndi.service.name>=jdbc/filetransferhistorynojta)/

/se.digia.connect.filetransfer.history.domain.Entry/
/se.digia.connect.filetransfer.history.domain.FileEntry/
/se.digia.connect.filetransfer.history.domain.Retry/
/se.digia.connect.util.persistence.EntityBase/
/true/
/NONE/
//
/  /
/  value="buildSchema(ForeignKeys=true)" />/

/  /
/  value="operation-order" />/
/  /

//
//
//

The "..SynchronizeMappings" should be used outside JTA transactions 
using auto commit. How could this ever work with JPA Blueprint then?


/Bengt

2016-07-11 11:10 GMT+02:00 Christian Schneider 
mailto:ch...@die-schneider.net>>:


This is decided by Aries JPA. If you use transaction-type="JTA"
then the jta-datasource is used else the non-jta-datasource.

Christian

On 11.07.2016 11:03, Bengt Rodehav wrote:

I think the important question is: _Who_ determines whether to
use the  or the ?

The follow-up question would be: _What criteria_ is being used to
choose between them?

/Bengt



-- 
Christian Schneider

http://www.liquid-reality.de

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





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

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



Re: Migrating from Karaf 2.4.1 to 4.0.5, JPA problems

2016-07-11 Thread Christian Schneider
As far as I undetrstood you use the non-jta-datasource if you use local 
transactions instead of jta.
I have no clue though why there are these two elements. It is very well 
posssible of course that I missunderstood something in the spec.


Did you find any explanation in the jpa specs about this?

Christian

On 11.07.2016 11:15, Bengt Rodehav wrote:

Sorry missed your last mail...

Still wonders when the  would be used?

/Bengt

2016-07-11 11:13 GMT+02:00 Christian Schneider 
mailto:ch...@die-schneider.net>>:


On 11.07.2016 10:58, Bengt Rodehav wrote:


There is also a difference in the way I published the datasource
with Blueprint and the way it is being done in pax-jdbc. With
Blueprint I published both a DataSource and an XADataSource.
pax-jdbc is only publishing a DataSource but somehow still
supports XA (I don't really know how this works).

This is something I read in the transaction specs. The user should
always use a DataSource. XADataSource is just for internal use by
the app server.
The app server has the responsibility of wrapping the XADataSource
in a DataSource and do the resource enlistment with the
TransactionManager.

Christian


There is a risk that someone (OpenJPA, JPA Blueprint, ...) is
checking if it is dealing with a DataSource or an XADataSource.
If the first then auto commit should be OK, if the latter not and
it may then try the  instead. Since we are
only publishing a DataSource (via pax-jdbc) it could signal to a
client that auto commit is OK since this is not an XADataSource.
Do you agree?

/Bengt

-- 
    Christian Schneider

http://www.liquid-reality.de

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





    -- 
    Christian Schneider

http://www.liquid-reality.de

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





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

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



Re: Migrating from Karaf 2.4.1 to 4.0.5, JPA problems

2016-07-11 Thread Christian Schneider
I looked it up in the jpa spec (see below). So I think I interpreted 
this correctly.

Christian

8.2.1.2 transaction-type
The transaction-type attribute is used to specify whether the entity 
managers provided by the
entity manager factory for the persistence unit must be JTA entity 
managers or resource-local entity
managers. The value of this element is JTA or RESOURCE_LOCAL. A 
transaction-type of JTA
assumes that a JTA data source will be provided—either as specified by 
the jta-data-source ele-
ment or provided by the container. In general, in Java EE environments, 
a transaction-type of
RESOURCE_LOCAL assumes that a non-JTA datasource will be provided. In a 
Java EE environment, if
this element is not specified, the default is JTA. In a Java SE 
environment, if this element is not speci-

fied, the default is RESOURCE_LOCAL.

On 11.07.2016 11:15, Bengt Rodehav wrote:

Sorry missed your last mail...

Still wonders when the  would be used?

/Bengt

2016-07-11 11:13 GMT+02:00 Christian Schneider 
mailto:ch...@die-schneider.net>>:


On 11.07.2016 10:58, Bengt Rodehav wrote:


There is also a difference in the way I published the datasource
with Blueprint and the way it is being done in pax-jdbc. With
Blueprint I published both a DataSource and an XADataSource.
pax-jdbc is only publishing a DataSource but somehow still
supports XA (I don't really know how this works).

This is something I read in the transaction specs. The user should
always use a DataSource. XADataSource is just for internal use by
the app server.
The app server has the responsibility of wrapping the XADataSource
in a DataSource and do the resource enlistment with the
TransactionManager.

Christian


There is a risk that someone (OpenJPA, JPA Blueprint, ...) is
checking if it is dealing with a DataSource or an XADataSource.
If the first then auto commit should be OK, if the latter not and
it may then try the  instead. Since we are
only publishing a DataSource (via pax-jdbc) it could signal to a
client that auto commit is OK since this is not an XADataSource.
Do you agree?

/Bengt

-- 
    Christian Schneider

http://www.liquid-reality.de

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





    -- 
    Christian Schneider

http://www.liquid-reality.de

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





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

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



Re: Migrating from Karaf 2.4.1 to 4.0.5, JPA problems

2016-07-11 Thread Christian Schneider

On 11.07.2016 11:33, Bengt Rodehav wrote:

So the spec doesn't really allow for both of them to be used...

Maybe, before, a JTA transaction wasn't created for the "synchronize 
mappings" and therefore the  was used. Now a JTA 
transaction is being created. Not sure if this was changed now that I 
upgraded to newer Aries versions...
Can you try to just switch the db to H2. I did all my tutorials on H2 
lately. It would be interesting if the issue also happens there. If it 
happens there too then I think it is not a derby issue.
I normally use hibernate though so if it is a openjpa issue then I maybe 
just did not see it because of that. As openjpa only supports jta 1.2 
lately I did not have the chance to test openjpa a lot.




It is a bit of a problem of course. It was a convenient way to create 
the database on first usage that now does not seem to work. The only 
way I can think of is to use an alternative pax-jdbc configuration on 
startup (that uses derby or derby-pool datasource) and then shut down 
the container and replace it with the derby-pool-xa datasource. Really 
complicates our installations procedures...


BTW, how come it works if I use the derby-pool datasource? Does 
someone (who) recognize that this datasource does not support JTA and 
therefore uses a RESOURCE_LOCAL transaction instead? Who is the "someone"?

No idea.


/Bengt



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

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



Re: Can't get MySQL non-jta connection pool with Aries-2.4.0 and EL-2.6.2 working - Looking for (more) example(s).

2016-07-25 Thread Christian Schneider
aSource registered it somehow feels like 
there is some more stuff going on behind the (EL?) scenes that I don’t 
have a handle on yet.


BTW... I have also created an org.apache.aries.jpa.my.pu.cfg 
configuration file, but when I leave the DB properties out of the 
persistence.xml I get bunch of ClassNotFound exceptions, so that is 
suspicious.


BTW2… the examples link at the bottom of this page is broken: 
https://commons.apache.org/proper/commons-dbcp/



Regards,

Erwin




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

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



Re: DS vs Blueprint

2016-09-06 Thread Christian Schneider
* org.apache.felix.scr.annotations*
>>>>> * *
>>>>>
>>>>>
>>>>> On Tue, Sep 6, 2016 at 10:47 AM, Brad Johnson <
>>>>> brad.john...@mediadriver.com> wrote:
>>>>>
>>>>>> @gnodet
>>>>>>
>>>>>> Thanks for the info regarding the @OsgiServe/@OsgiServiceProvider.
>>>>>> Perhaps that's where I go the idea that one needed to specify start up
>>>>>> order on bundles. In some recent test projects I have been using the 
>>>>>> Felix
>>>>>> SCR but most of the testing has been using the CamelCDI runner as it is
>>>>>> very fast. That obviously creates some problems with having to double
>>>>>> annotate some items for Inject vs Reference and so on and the fact that 
>>>>>> CDI
>>>>>> isn't going to respect bundle boundaries inside the test.  But that 
>>>>>> isn't a
>>>>>> huge problem because in the context of testing it isn't like I have 300
>>>>>> bundles running.  It's just a few application bundles and their
>>>>>> dependencies.
>>>>>>
>>>>>> It does mean I'll have to get ready to deal with some errors when
>>>>>> moving from the IDE environment over to the Karaf/felix environment but 
>>>>>> for
>>>>>> development/testing speed it definitely seems worth it.
>>>>>>
>>>>>> I'm so used to using CamelBlueprintTestSupport and blueprint.xml that
>>>>>> all of this still feels a bit left handed -- "If I were doing this in
>>>>>> blueprint, this what I'd do"
>>>>>>
>>>>>> On Mon, Sep 5, 2016 at 6:38 AM, Guillaume Nodet 
>>>>>> wrote:
>>>>>>
>>>>>>> I don't really recommend using the @OsgiService /
>>>>>>> @OsgiServiceProvider of Pax-CDI.
>>>>>>> The main reason is that if the bundles are not started in the
>>>>>>> correct order, the bean validation will simply fail and your CDI app 
>>>>>>> won't
>>>>>>> be created at all.
>>>>>>> I'd really recommend to look at the new annotations of Pax-CDI which
>>>>>>> haven't been released yet (in 1.0.0-SNAPSHOT).  They are very similar to
>>>>>>> the DS semantics (and they actually use part of Felix SCR 
>>>>>>> implementation as
>>>>>>> the core engine).  The lifecycle of the CDI beans is similar to those of
>>>>>>> DS, so the dependency mechanism is really straightforward from a user 
>>>>>>> point
>>>>>>> of view.
>>>>>>>
>>>>>>> Cheers,
>>>>>>> Guillaume
>>>>>>>
>>>>>>> 2016-09-02 19:46 GMT+02:00 Brad Johnson <
>>>>>>> brad.john...@mediadriver.com>:
>>>>>>>
>>>>>>>> Matt,
>>>>>>>>
>>>>>>>> For the past few weeks I've been working with the Camel 2.17 CDI
>>>>>>>> and it's marvelous.  I've been using blueprint for a few years now and 
>>>>>>>> I
>>>>>>>> won't be going back to twiddling XML unless I have to (I'm not sure 
>>>>>>>> how to
>>>>>>>> set up CXF server without it right now).  But the CDI test runner is 
>>>>>>>> fast
>>>>>>>> and a snap to use. The annotation automated wire up and RouteBuilder
>>>>>>>> automatic running is just like you'd think ought to be.
>>>>>>>>
>>>>>>>> The pax-cdi implementation actually creates blueprint proxies for
>>>>>>>> annotations like @OSGiServiceProvider and will inject it where you 
>>>>>>>> specify
>>>>>>>> the service consumer. The only caveat to the CDI test runner is that 
>>>>>>>> it is
>>>>>>>> not OSGi based but uses Weld.  So you have to be careful about what you
>>>>>>>> test but I can live with that.  Truly stunning when one sees a 
>>>>>>>> technology
>>>>>>>> that works almost like magic - like you'd dream it should work.
>>>>>>>>
>>>>>>>> On Fri, Sep 2, 2016 at 12:04 PM, Matt Sicker 
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> On 2 September 2016 at 11:30, Timothy Ward <
>>>>>>>>> timothyjw...@apache.org> wrote:
>>>>>>>>>
>>>>>>>>>> As things stand currently blueprint is most widely used for
>>>>>>>>>> working with Camel. From what I can tell configuring Camel is 
>>>>>>>>>> horrible, and
>>>>>>>>>> my understanding is that the main advantage of blueprint is that 
>>>>>>>>>> there is a
>>>>>>>>>> huge amount of ready-built Camel integration available. If Camel had 
>>>>>>>>>> a
>>>>>>>>>> nicer, container agnostic configuration mechanism then I would see 
>>>>>>>>>> little
>>>>>>>>>> reason to choose blueprint over DS.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> This right here is exactly how I feel. If there was a well
>>>>>>>>> supported way of simply using DS instead of Blueprint with Camel, 
>>>>>>>>> then I'd
>>>>>>>>> drop Blueprint in a single sprint and never look back.
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> 
>>>>>>> Guillaume Nodet
>>>>>>> 
>>>>>>> Red Hat, Open Source Integration
>>>>>>>
>>>>>>> Email: gno...@redhat.com
>>>>>>> Web: http://fusesource.com
>>>>>>> Blog: http://gnodet.blogspot.com/
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> 
>>>> Guillaume Nodet
>>>> 
>>>> Red Hat, Open Source Integration
>>>>
>>>> Email: gno...@redhat.com
>>>> Web: http://fusesource.com
>>>> Blog: http://gnodet.blogspot.com/
>>>>
>>>>
>>>
>>
>>
>> --
>> 
>> Guillaume Nodet
>> 
>> Red Hat, Open Source Integration
>>
>> Email: gno...@redhat.com
>> Web: http://fusesource.com
>> Blog: http://gnodet.blogspot.com/
>>
>>
>


-- 
-- 
Christian Schneider
http://www.liquid-reality.de
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de>

Open Source Architect
http://www.talend.com
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.talend.com>


Re: DS vs Blueprint

2016-09-07 Thread Christian Schneider
In the old code the DS xml was manually created. The wiki is still at 
that level.
In the new code the user only uses annotations and the maven bundle 
plugin does the xml creation.


Christian

On 07.09.2016 17:06, Brad Johnson wrote:

http://cxf.apache.org/dosgi-ds-demo-page.html

I see the SCR using XML in there but the annotations and SCR 
annotation processor Maven plugin will automatically create that won't 
it.  I'm so used to using blueprint that it all feels a bit lopsided.


On Wed, Sep 7, 2016 at 9:52 AM, Brad Johnson 
mailto:brad.john...@mediadriver.com>> 
wrote:


http://cxf.apache.org/docs/a-simple-jax-ws-service.html
<http://cxf.apache.org/docs/a-simple-jax-ws-service.html>

That looks a lot like what I'm looking for.  Then I could set up a
server bundle to do the repetitious stuff and have it export a
service like SoapServer that takes a SoapInstallEvent and inside
that I could send the interface, implementation and URI. 
Obviously the URI could be settable in cfg or properties file. 
Then when the bundle is being uninstalled it could send a

SoapUninstallEvent.  So the SoapServer OSGi service would only
take those two events. Obviously I could set up the same thing for
REST service.

In that blueprint project I did that's pretty much how I handled
it and it worked fine but I never knew about what the transport
was really doing (Jetty, HTTP server, etc.)  I don't like rolling
my own code like that when it's far better letting the guys who
know the libraries set it up.

Brad

On Wed, Sep 7, 2016 at 9:16 AM, Brad Johnson
mailto:brad.john...@mediadriver.com>> wrote:

I'll give it a look. That sounds like a move in the right
direction.  In the short term I'll just set up the CXF
server/endpoints with blueprint and use the camel recipient
list to route them to the correct bundle.  That doesn't work
well for microservices.  It probably would be OK for cxfrs
since it can take lists of interfaces to expose and those
could be read from an external configuration file.  To move a
service in or out one would just modify the etc cfg file to
add or remove the service interface and install or uninstall
the bundle.  But I don't think that the CXF soap server can
take lists like that as far as I know.

The CDI annotations added in to pax-cdi for using OSGi
services right from a bundle using only CDI and not a
combination of CDI/DS is a very big deal I think.  That's
going t be a real winner for a couple of reasons.  First it
has fewer dependencies and annotations one must get right. 
Second it will aid folks from other platforms who know how to

use CDI but are not as familiar with OSGi or DS. So making the
move from any platform to the Camel, pax-cdi platform is going
to be much smoother.

Brad

On Wed, Sep 7, 2016 at 1:34 AM, Christian Schneider
mailto:ch...@die-schneider.net>> wrote:

For CXF in DS or CDI you should try CXF DOSGi. I am
currently woking on a new major version that is slimmer
and should allow almost all CXF settings you can also do
in blueprint.
The idea is to publish the settings as OSGi services
marked as intents. The new CXF DOSGi examples are all
using DS and one example shows the setup of https with
client cert authentication which was not possible before
without blueprint.

Christian

2016-09-07 0:19 GMT+02:00 Brad Johnson
mailto:brad.john...@mediadriver.com>>:

I'll definitely get my Nexus instance pointed at that
repo and pull it down.  One of the biggest problems
I'm going to have in the near term is that the
blueprint CXF allows for set up of everything to run
on Jetty fairly easily but to do the same thing on
straight Java I end up having to roll that myself. 
Perhaps an SCR/CDI library using the pax-cdi is in the

works once it has been released.  I'll probably look
at the Camel src code for CXF to see how they do it
internally with blueprint and attempt to duplicate it.

One of the frustrations I was having trying to do the
CDI/SCR was that I have it working perfectly well in
one project but couldn't get it to work correctly in
the second project.  I'm trying to make this so my
bundles can be microservices that when installed are
picked up by the CXF Rest and/or SOAP service and

Re: DS vs Blueprint

2016-09-07 Thread Christian Schneider
It depends on the address (like in plain cxf). If the address start with /
then it will use the HttpService of the container. If it starts with
http://server:port it will start a new jetty instance.

Christian

2016-09-07 22:18 GMT+02:00 Brad Johnson :

> Thanks.  Fuse launches Jetty by default I just wanted to make sure that
> under the covers it wasn't using its own server instead.
>
> Brad
>
> On Wed, Sep 7, 2016 at 3:13 PM, Benson Margulies 
> wrote:
>
>> On Wed, Sep 7, 2016 at 4:03 PM, Brad Johnson
>>  wrote:
>> > Christian,
>> >
>> > One last question and I promise to stop.  In the simple example, when
>> > starting the JaxWsFactory bean or its equivalent in Rs, that will not
>> take
>> > advantage of Jetty in a stack like ServiceMix or Fuse but use its own
>> > in-built HttpServer. Do I have that correct?  In a lot of cases it won't
>> > really matter if I use the same address?  The simple example uses:
>> >
>> > svrFactory.setAddress("http://localhost:9000/helloWorld";);
>>
>> That depends on which CXF transport you include. You can depend on
>> pax-web, or you can let CXF launch jetty for itself.
>> >
>> > But if Jetty is running on port 8081 then if I change that to:
>> > svrFactory.setAddress("http://localhost:8081/helloWorld";);
>> >
>> > will that simply use the Jetty port?
>> >
>> >
>> > http://cxf.apache.org/docs/a-simple-jax-ws-service.html
>> >
>> > On Wed, Sep 7, 2016 at 10:44 AM, Brad Johnson <
>> brad.john...@mediadriver.com>
>> > wrote:
>> >>
>> >> Great, that's sort of how I figured it would work and I'l give it a
>> shot.
>> >>
>> >> Brad
>> >>
>> >> On Wed, Sep 7, 2016 at 10:36 AM, Christian Schneider
>> >>  wrote:
>> >>>
>> >>> In the old code the DS xml was manually created. The wiki is still at
>> >>> that level.
>> >>> In the new code the user only uses annotations and the maven bundle
>> >>> plugin does the xml creation.
>> >>>
>> >>> Christian
>> >>>
>> >>>
>> >>> On 07.09.2016 17:06, Brad Johnson wrote:
>> >>>
>> >>> http://cxf.apache.org/dosgi-ds-demo-page.html
>> >>>
>> >>> I see the SCR using XML in there but the annotations and SCR
>> annotation
>> >>> processor Maven plugin will automatically create that won't it.  I'm
>> so used
>> >>> to using blueprint that it all feels a bit lopsided.
>> >>>
>> >>> On Wed, Sep 7, 2016 at 9:52 AM, Brad Johnson
>> >>>  wrote:
>> >>>>
>> >>>> http://cxf.apache.org/docs/a-simple-jax-ws-service.html
>> >>>>
>> >>>> That looks a lot like what I'm looking for.  Then I could set up a
>> >>>> server bundle to do the repetitious stuff and have it export a
>> service like
>> >>>> SoapServer that takes a SoapInstallEvent and inside that I could
>> send the
>> >>>> interface, implementation and URI.  Obviously the URI could be
>> settable in
>> >>>> cfg or properties file.  Then when the bundle is being uninstalled
>> it could
>> >>>> send a SoapUninstallEvent.  So the SoapServer OSGi service would
>> only take
>> >>>> those two events. Obviously I could set up the same thing for REST
>> service.
>> >>>>
>> >>>> In that blueprint project I did that's pretty much how I handled it
>> and
>> >>>> it worked fine but I never knew about what the transport was really
>> doing
>> >>>> (Jetty, HTTP server, etc.)  I don't like rolling my own code like
>> that when
>> >>>> it's far better letting the guys who know the libraries set it up.
>> >>>>
>> >>>> Brad
>> >>>>
>> >>>> On Wed, Sep 7, 2016 at 9:16 AM, Brad Johnson
>> >>>>  wrote:
>> >>>>>
>> >>>>> I'll give it a look. That sounds like a move in the right direction.
>> >>>>> In the short term I'll just set up the CXF server/endpoints with
>> blueprint
>> >>>>> and use the camel recipient list to route them to the correct
>> bundle.  That
>> >>>>> doesn't work well for 

Re: DS vs Blueprint

2016-09-07 Thread Christian Schneider
It simply uses the existing HttpService so it will not start a new
instance. You can even use the felix http service bundle instead. CXF will
not care.

I typically use this variant as it only needs one port for all services
which makes it easier to manage.

Christian

2016-09-08 0:25 GMT+02:00 Brad Johnson :

> Ah, very good.  Does it start a new instance or does it piggyback
> endpoints on the already running one configured in the etc dir?  (Yeah, I
> promised no more questions but a guy's just gotta know!)
>
> On Wed, Sep 7, 2016 at 4:01 PM, Christian Schneider <
> ch...@die-schneider.net> wrote:
>
>> It depends on the address (like in plain cxf). If the address start with
>> / then it will use the HttpService of the container. If it starts with
>> http://server:port it will start a new jetty instance.
>>
>> Christian
>>
>> 2016-09-07 22:18 GMT+02:00 Brad Johnson :
>>
>>> Thanks.  Fuse launches Jetty by default I just wanted to make sure that
>>> under the covers it wasn't using its own server instead.
>>>
>>> Brad
>>>
>>> On Wed, Sep 7, 2016 at 3:13 PM, Benson Margulies 
>>> wrote:
>>>
>>>> On Wed, Sep 7, 2016 at 4:03 PM, Brad Johnson
>>>>  wrote:
>>>> > Christian,
>>>> >
>>>> > One last question and I promise to stop.  In the simple example, when
>>>> > starting the JaxWsFactory bean or its equivalent in Rs, that will not
>>>> take
>>>> > advantage of Jetty in a stack like ServiceMix or Fuse but use its own
>>>> > in-built HttpServer. Do I have that correct?  In a lot of cases it
>>>> won't
>>>> > really matter if I use the same address?  The simple example uses:
>>>> >
>>>> > svrFactory.setAddress("http://localhost:9000/helloWorld";);
>>>>
>>>> That depends on which CXF transport you include. You can depend on
>>>> pax-web, or you can let CXF launch jetty for itself.
>>>> >
>>>> > But if Jetty is running on port 8081 then if I change that to:
>>>> > svrFactory.setAddress("http://localhost:8081/helloWorld";);
>>>> >
>>>> > will that simply use the Jetty port?
>>>> >
>>>> >
>>>> > http://cxf.apache.org/docs/a-simple-jax-ws-service.html
>>>> >
>>>> > On Wed, Sep 7, 2016 at 10:44 AM, Brad Johnson <
>>>> brad.john...@mediadriver.com>
>>>> > wrote:
>>>> >>
>>>> >> Great, that's sort of how I figured it would work and I'l give it a
>>>> shot.
>>>> >>
>>>> >> Brad
>>>> >>
>>>> >> On Wed, Sep 7, 2016 at 10:36 AM, Christian Schneider
>>>> >>  wrote:
>>>> >>>
>>>> >>> In the old code the DS xml was manually created. The wiki is still
>>>> at
>>>> >>> that level.
>>>> >>> In the new code the user only uses annotations and the maven bundle
>>>> >>> plugin does the xml creation.
>>>> >>>
>>>> >>> Christian
>>>> >>>
>>>> >>>
>>>> >>> On 07.09.2016 17:06, Brad Johnson wrote:
>>>> >>>
>>>> >>> http://cxf.apache.org/dosgi-ds-demo-page.html
>>>> >>>
>>>> >>> I see the SCR using XML in there but the annotations and SCR
>>>> annotation
>>>> >>> processor Maven plugin will automatically create that won't it.
>>>> I'm so used
>>>> >>> to using blueprint that it all feels a bit lopsided.
>>>> >>>
>>>> >>> On Wed, Sep 7, 2016 at 9:52 AM, Brad Johnson
>>>> >>>  wrote:
>>>> >>>>
>>>> >>>> http://cxf.apache.org/docs/a-simple-jax-ws-service.html
>>>> >>>>
>>>> >>>> That looks a lot like what I'm looking for.  Then I could set up a
>>>> >>>> server bundle to do the repetitious stuff and have it export a
>>>> service like
>>>> >>>> SoapServer that takes a SoapInstallEvent and inside that I could
>>>> send the
>>>> >>>> interface, implementation and URI.  Obviously the URI could be
>>>> settable in
>>>> >>>> cfg or properties file.  Then

Re: DS vs Blueprint

2016-09-08 Thread Christian Schneider
If you use ds then you can always override any service property using a
config. This allows to dynamically change the address at runtime.

Christian

Am 08.09.2016 16:39 schrieb "Brad Johnson" :

> Perfect. Thanks.  It was always a bit unclear as to whether I was firing
> up a new instance of HTTP server instead of reusing the instance specified
> in the Jetty setup.  It sounds though that as long as I specify uri and
> port along with everything else I get the Jetty instance.  That makes it a
> lot easier because even if I want to use a different port in my Jetty, for
> whatever reason, I can pass that port in from my cfg file and not have to
> rebundle.  That's how I normally do it.  Such as:
>
>  serviceClass="com.foo.api.MyServicesAPI">  That really does make self
> contained bundles, almost microservices, practical. And then one bundle
> should be able to be the one that specifically sets up jaas, interceptors,
> providers, etc. without the need for setting those up in all the separated
> bundles.  If nothing else I guess one can specify those on the cxf:bus to
> make sure they are shared.
>
>
> On Thu, Sep 8, 2016 at 1:08 AM, Christian Schneider <
> ch...@die-schneider.net> wrote:
>
>> It simply uses the existing HttpService so it will not start a new
>> instance. You can even use the felix http service bundle instead. CXF will
>> not care.
>>
>> I typically use this variant as it only needs one port for all services
>> which makes it easier to manage.
>>
>> Christian
>>
>> 2016-09-08 0:25 GMT+02:00 Brad Johnson :
>>
>>> Ah, very good.  Does it start a new instance or does it piggyback
>>> endpoints on the already running one configured in the etc dir?  (Yeah, I
>>> promised no more questions but a guy's just gotta know!)
>>>
>>> On Wed, Sep 7, 2016 at 4:01 PM, Christian Schneider <
>>> ch...@die-schneider.net> wrote:
>>>
>>>> It depends on the address (like in plain cxf). If the address start
>>>> with / then it will use the HttpService of the container. If it starts with
>>>> http://server:port it will start a new jetty instance.
>>>>
>>>> Christian
>>>>
>>>> 2016-09-07 22:18 GMT+02:00 Brad Johnson :
>>>>
>>>>> Thanks.  Fuse launches Jetty by default I just wanted to make sure
>>>>> that under the covers it wasn't using its own server instead.
>>>>>
>>>>> Brad
>>>>>
>>>>> On Wed, Sep 7, 2016 at 3:13 PM, Benson Margulies <
>>>>> bimargul...@gmail.com> wrote:
>>>>>
>>>>>> On Wed, Sep 7, 2016 at 4:03 PM, Brad Johnson
>>>>>>  wrote:
>>>>>> > Christian,
>>>>>> >
>>>>>> > One last question and I promise to stop.  In the simple example,
>>>>>> when
>>>>>> > starting the JaxWsFactory bean or its equivalent in Rs, that will
>>>>>> not take
>>>>>> > advantage of Jetty in a stack like ServiceMix or Fuse but use its
>>>>>> own
>>>>>> > in-built HttpServer. Do I have that correct?  In a lot of cases it
>>>>>> won't
>>>>>> > really matter if I use the same address?  The simple example uses:
>>>>>> >
>>>>>> > svrFactory.setAddress("http://localhost:9000/helloWorld";);
>>>>>>
>>>>>> That depends on which CXF transport you include. You can depend on
>>>>>> pax-web, or you can let CXF launch jetty for itself.
>>>>>> >
>>>>>> > But if Jetty is running on port 8081 then if I change that to:
>>>>>> > svrFactory.setAddress("http://localhost:8081/helloWorld";);
>>>>>> >
>>>>>> > will that simply use the Jetty port?
>>>>>> >
>>>>>> >
>>>>>> > http://cxf.apache.org/docs/a-simple-jax-ws-service.html
>>>>>> >
>>>>>> > On Wed, Sep 7, 2016 at 10:44 AM, Brad Johnson <
>>>>>> brad.john...@mediadriver.com>
>>>>>> > wrote:
>>>>>> >>
>>>>>> >> Great, that's sort of how I figured it would work and I'l give it
>>>>>> a shot.
>>>>>> >>
>>>>>> >> Brad
>>>>>> >>
>>>>>> >> On Wed, Sep 7, 201

Re: NullPointerException - createAndCloseDummyEMF (JPA Container)

2016-09-20 Thread Christian Schneider
 
org.apache.aries.jpa.eclipselink.adapter.EclipseLinkPersistenceProvider.createContainerEntityManagerFactory(EclipseLinkPersistenceProvider.java:52)
at 
org.apache.aries.jpa.container.impl.PersistenceProviderTracker.createAndCloseDummyEMF(PersistenceProviderTracker.java:105)
at 
org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:85)
at 
org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:44)
at 
org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
at 
org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)
at 
org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
at 
org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:901)
at 
org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)
at 
org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:914)
at 
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at 
org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at 
org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:862)
at 
org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:801)
at 
org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127)
at 
org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:225)
at 
org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:464)
at 
org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:482)
at 
org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:998)
at 
org.apache.aries.jpa.eclipselink.adapter.Activator.handlePotentialEclipseLink(Activator.java:116)
at 
org.apache.aries.jpa.eclipselink.adapter.Activator.start(Activator.java:72)
at 
org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:771)
at 
org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
at java.security.AccessController.doPrivileged(Native Method)
at 
org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:764)
at 
org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:721)
at 
org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:941)
at 
org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:318)
at org.eclipse.osgi.container.Module.doStart(Module.java:571)
at org.eclipse.osgi.container.Module.start(Module.java:439)
at 
org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
at 
org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1562)
at 
org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
at 
org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
at 
org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
at 
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at 
org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

We started debugging and were able to narrow the issue. In the class 
"DatabaseAccessor" of EclipseLink the following code is called (line 1570):

statement = nativeConnection.prepareStatement(call.getSQLString());

The nativeConnection is return by the class "DummyDataSource" and is a dynamic proxy using "DummyHandler" as InvocationHandler. Because the method 
"prepareStatement" returns an instance of the type "java.sql.PreparedStatement" the method "proxyClasses" gets called. The method now 
returns "null", because the type "PreparedStatement" is not covered by the if-clauses. The call "rowCount = 
((PreparedStatement)statement).executeUpdate();" (line: 892) in the class "DatabaseAccessor" now results to a NullPointerExcpetion.

We require your help? How can we fix the issue? Thank you very much!

Regards,
Jens



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

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



Re: Aw: Re: NullPointerException - createAndCloseDummyEMF (JPA Container)

2016-09-20 Thread Christian Schneider
Sounds good. If it works for you and the PR does not break anything else 
I will apply it then.


Christian

On 20.09.2016 16:50, Jens Offenbach wrote:

I have created the JIRA issue ARIES-1615: Calling the method 
createAndCloseDummyEMF() causes NullPointerException 
(https://issues.apache.org/jira/browse/ARIES-1615).

I will add the following lines to the class "DummyDataSource"

if (type == PreparedStatement.class) {
 return createProxy(classLoader, PreparedStatement.class);
}

and check if this extension already fixes the issue. I will report back as soon 
as possible. When things are working properly, I will open a pull request on 
Github.

Thank you very much for your quick response.

Regards,
Jens


Gesendet: Dienstag, 20. September 2016 um 16:11 Uhr
Von: "Christian Schneider" 
An: user@aries.apache.org
Betreff: Re: NullPointerException - createAndCloseDummyEMF (JPA Container)
I guess we can add this case to the proxy.
Can you help by creating an issue on Aries jira and later test the
changed code from master?

Alternatively if you want you can also try to fix it yourself and
provide a pull request on github.

Christian


On 20.09.2016 15:38, Jens Offenbach wrote:

Hi,
we want to use EclipseLink (2.6.3) within OSGi and currently Aries JPA (2.4.0) 
seems to fit our needs, but we are heavily in trouble getting things working. 
Dynamic weaving does not seem to work, maybe related to the following exception:

[EL Warning]: 2016-09-20 
14:59:39.373--ServerSession(1864482722)--Thread(Thread[Start Level: Equinox 
Container: 
80090ef3-307f-0016-1904-9194b7ab7645,5,main])--java.lang.NullPointerException
[EL Severe]: 2016-09-20 
14:59:39.373--ServerSession(1864482722)--Thread(Thread[Start Level: Equinox 
Container: 
80090ef3-307f-0016-1904-9194b7ab7645,5,main])--java.lang.NullPointerException
at 
org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:892)
at 
org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:964)
at 
org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:633)
at 
org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:560)
at 
org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:2056)
at 
org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:570)
at 
org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:242)
at 
org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:228)
at 
org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeNoSelectCall(DatasourceCallQueryMechanism.java:271)
at 
org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeNoSelect(DatasourceCallQueryMechanism.java:251)
at 
org.eclipse.persistence.queries.DataModifyQuery.executeDatabaseQuery(DataModifyQuery.java:85)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:904)
at 
org.eclipse.persistence.internal.sessions.AbstractSession.internalExecuteQuery(AbstractSession.java:3271)
at 
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1857)
at 
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1839)
at 
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1790)
at 
org.eclipse.persistence.internal.sessions.AbstractSession.priviledgedExecuteNonSelectingCall(AbstractSession.java:5079)
at 
org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition.createOnDatabase(DatabaseObjectDefinition.java:202)
at 
org.eclipse.persistence.tools.schemaframework.SchemaManager.createObject(SchemaManager.java:223)
at 
org.eclipse.persistence.tools.schemaframework.TableCreator.createTables(TableCreator.java:171)
at 
org.eclipse.persistence.tools.schemaframework.TableCreator.createTables(TableCreator.java:148)
at 
org.eclipse.persistence.tools.schemaframework.TableCreator.createTables(TableCreator.java:140)
at 
org.eclipse.persistence.tools.schemaframework.SchemaManager.createDefaultTables(SchemaManager.java:1032)
at 
org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.generateDefaultTables(EntityManagerFactoryProvider.java:109)
at 
org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.writeDDLToDatabase(EntityManagerSetupImpl.java:4225)
at 
org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.writeDDL(EntityManagerSetupImpl.java:4153)
at 
org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.writeDDL(EntityManagerSetupImpl.java:4053)
at 
org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:777)
at 
org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegat

Re: jax-rs bootstrap of RFC-217

2016-10-12 Thread Christian Schneider
I would prefer maven as I am more familiar with it. If you choose gradle 
make sure you take some extra effort to explain how people do the build 
and also how to setup eclipse to work with the code.


In any case I propose to use a separate git repo for the new project 
from the start (Like Aries RSA). I would also rather not use the old 
parent in the main aries repo and
rather build a parent like I did in the Aries RSA project. The parent 
there might be lacking some few features but it makes the whole project 
so much simpler.

See https://github.com/apache/aries-rsa
I also propose to do the OSGi configs in bnd.bnd files from the start.

Christian

On 11.10.2016 20:10, Raymond Auge wrote:

Hello everyone,

We're getting closer (slower than anticipated) to bootstrap Aries with 
the RFC-217 impl.


I'd like to ask about project structure. Currently we've got a gradle 
based build. Does Aries require the build to be maven?


Sincerely,
--
*Raymond Augé* 
<http://www.liferay.com/web/raymond.auge/profile> (@rotty3000)
Senior Software Architect *Liferay, Inc.* 
<http://www.liferay.com> (@Liferay)
Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org> 
(@OSGiAlliance)



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

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



Re: LogReaderService Blueprint?

2016-11-03 Thread Christian Schneider
You should have a look at karaf decanter.
https://karaf.apache.org/manual/decanter/latest-1/

You can simply combine the log collector and the jms appender.

Christian

2016-11-03 19:10 GMT+01:00 Brad Johnson :

> I'm trying to find a good mechanism for intercepting logging events to
> fire them off to an AMQ queue for consumption elsewhere.  I don't really
> want to scrape log files for a number of reasons (obvious I think).\
>
> I'm in karaf using AMQ and the Red Hat stack - with many of the items from
> Fuse but not all.
>
> I had one fairly successful way of doing this which simply implemented the
> same interface as the Logger itself and when the Logger.getLogger(Class)
> was called I created a wrapper class that both logged to a file and sent
> the message via the queue.
>
> But I noticed that there are a number of different mechanisms from camel
> log component to broker plugin (which I also implemented) and the OSGi
> LoggerReaderService and Listener and wondered if there's a good example of
> using that with Blueprint.  Most of the examples I've found are with ol'
> fashion service trackers and the like.
>



-- 
-- 
Christian Schneider
http://www.liquid-reality.de
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de>

Open Source Architect
http://www.talend.com
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.talend.com>


Re: Aries RSA with fastbin provider and 3 nodes throws Address already in use exception?

2016-11-21 Thread Christian Schneider
The Endpoint configuration is done using service properties. So you need 
to set it on the service you export using DS.


Christian

On 21.11.2016 08:47, Alex Weirig wrote:


Hello,

I'm facing a problem to get fastbin provider working in the following 
configuration:


I have

3 karaf containers (4.0.7) running on 3 different (virtual) machines, 
all have aries RSA (1.9.0) with zookeeper discovery and fastbin 
provider features installed


1 zookeeper server (3.4.9)

2 of the karaf servers provide services (declarative services) that 
are correctly registered in zookeeper.



On the 3rd karaf server I want to use the services in a shell command, 
unfortunately I'm getting an "Address already in use" exception in 
this karaf container.


2016-11-18 16:43:14,565 | WARN  | pool-64-thread-1 | 
Activator| 56 - 
org.apache.aries.rsa.provider.fastbin - 1.9.0 | Error starting activator
java.io.IOException: Failed to bind to server socket: /0.0.0.0:2543 
due to: java.net.BindException: Address already in use
at 
org.apache.aries.rsa.provider.fastbin.tcp.TcpTransportServer.start(TcpTransportServer.java:99)[56:org.apache.aries.rsa.provider.fastbin:1.9.0]
at 
org.apache.aries.rsa.provider.fastbin.tcp.ServerInvokerImpl.start(ServerInvokerImpl.java:194)[56:org.apache.aries.rsa.provider.fastbin:1.9.0]
at 
org.apache.aries.rsa.provider.fastbin.tcp.ServerInvokerImpl.start(ServerInvokerImpl.java:190)[56:org.apache.aries.rsa.provider.fastbin:1.9.0]
at 
org.apache.aries.rsa.provider.fastbin.FastBinProvider.(FastBinProvider.java:67)[56:org.apache.aries.rsa.provider.fastbin:1.9.0]
at 
org.apache.aries.rsa.provider.fastbin.Activator.doStart(Activator.java:47)[56:org.apache.aries.rsa.provider.fastbin:1.9.0]
at 
org.apache.aries.rsa.provider.fastbin.BaseActivator.run(BaseActivator.java:230)[56:org.apache.aries.rsa.provider.fastbin:1.9.0]
at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_72]
at 
java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_72]
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_72]
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_72]

at java.lang.Thread.run(Thread.java:745)[:1.8.0_72]
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)[:1.8.0_72]
at sun.nio.ch.Net.bind(Net.java:433)[:1.8.0_72]
at sun.nio.ch.Net.bind(Net.java:425)[:1.8.0_72]
at 
sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)[:1.8.0_72]
at 
sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)[:1.8.0_72]
at 
org.apache.aries.rsa.provider.fastbin.tcp.TcpTransportServer.start(TcpTransportServer.java:97)[56:org.apache.aries.rsa.provider.fastbin:1.9.0]

... 10 more

When I deploy my command on one of the other karaf container 
everything works fine.


On the fastbin github site there is an "endpoint configuration" section:

Endpoint Configuration

service.exported.configs: aries.fastbin

KeyDefaultDescription
uritcp://0.0.0.0:2543The bind address to use
exportAddresslooks up the hostnameThe ip/hostname how remote 
clients can reach this server

timeout30The timeout for sync calls (default 5 minutes)

I guess I'm supposed to change the "uri" value (maybe a different one 
on each karaf container?) in order to not get a collision.


Unfortunately there is no indication where to specify these values, a 
.cfg file in karaf/etc/? Is the file supposed to be named 
service.exported.configs.cfg? Is the syntax supposed to be 
aries.fastbin.uri?


Many thanks in advance for your support

--
Schéin Gréiss, Mit freundlichen Grüßen, Meilleures salutations, Kind 
regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg - Centre Technolink 2, rue Charles de Tornaco L - 
2623 LUXEMBOURG alex.wei...@technolink.lu 
<mailto:alex.wei...@technolink.lu> Tel: +352 4796 - 6127 Fax: +352 42 
88 81 www.technolink.lu <http://www.technolink.lu>



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

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



Re: Aries RSA with fastbin provider and 3 nodes throws Address already in use exception?

2016-11-21 Thread Christian Schneider

I just looked into the source code.

It seems there is a I am not very experienced with the fastbin 
transport.cfg.

Where you can set the uri for the whole server.

We seem to be lacking documentation here. I will update the github 
README file to reflect what I found.


Christian

On 21.11.2016 10:12, Alex Weirig wrote:


Hi Christian,

thanks for your answer ... do you mean we have to use a different port 
for each service? This can become complicated to manage when the 
number of services increases ...


Why is the address collision only showing up when I use the 3rd karaf, 
not when I only have 2 of them?


Schéin Gréiss, Mit freundlichen Grüßen, Meilleures salutations, Kind 
regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg - Centre Technolink 2, rue Charles de Tornaco L - 
2623 LUXEMBOURG alex.wei...@technolink.lu 
<mailto:alex.wei...@technolink.lu> Tel: +352 4796 - 6127 Fax: +352 42 
88 81 www.technolink.lu <http://www.technolink.lu>

On 21/11/2016 10:03, Christian Schneider wrote:
The Endpoint configuration is done using service properties. So you 
need to set it on the service you export using DS.


Christian

On 21.11.2016 08:47, Alex Weirig wrote:


Hello,

I'm facing a problem to get fastbin provider working in the 
following configuration:


I have

3 karaf containers (4.0.7) running on 3 different (virtual) 
machines, all have aries RSA (1.9.0) with zookeeper discovery and 
fastbin provider features installed


1 zookeeper server (3.4.9)

2 of the karaf servers provide services (declarative services) that 
are correctly registered in zookeeper.



On the 3rd karaf server I want to use the services in a shell 
command, unfortunately I'm getting an "Address already in use" 
exception in this karaf container.


2016-11-18 16:43:14,565 | WARN  | pool-64-thread-1 | 
Activator| 56 - 
org.apache.aries.rsa.provider.fastbin - 1.9.0 | Error starting activator
java.io.IOException: Failed to bind to server socket: /0.0.0.0:2543 
due to: java.net.BindException: Address already in use
at 
org.apache.aries.rsa.provider.fastbin.tcp.TcpTransportServer.start(TcpTransportServer.java:99)[56:org.apache.aries.rsa.provider.fastbin:1.9.0]
at 
org.apache.aries.rsa.provider.fastbin.tcp.ServerInvokerImpl.start(ServerInvokerImpl.java:194)[56:org.apache.aries.rsa.provider.fastbin:1.9.0]
at 
org.apache.aries.rsa.provider.fastbin.tcp.ServerInvokerImpl.start(ServerInvokerImpl.java:190)[56:org.apache.aries.rsa.provider.fastbin:1.9.0]
at 
org.apache.aries.rsa.provider.fastbin.FastBinProvider.(FastBinProvider.java:67)[56:org.apache.aries.rsa.provider.fastbin:1.9.0]
at 
org.apache.aries.rsa.provider.fastbin.Activator.doStart(Activator.java:47)[56:org.apache.aries.rsa.provider.fastbin:1.9.0]
at 
org.apache.aries.rsa.provider.fastbin.BaseActivator.run(BaseActivator.java:230)[56:org.apache.aries.rsa.provider.fastbin:1.9.0]
at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_72]
at 
java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_72]
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_72]
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_72]

at java.lang.Thread.run(Thread.java:745)[:1.8.0_72]
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)[:1.8.0_72]
at sun.nio.ch.Net.bind(Net.java:433)[:1.8.0_72]
at sun.nio.ch.Net.bind(Net.java:425)[:1.8.0_72]
at 
sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)[:1.8.0_72]
at 
sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)[:1.8.0_72]
at 
org.apache.aries.rsa.provider.fastbin.tcp.TcpTransportServer.start(TcpTransportServer.java:97)[56:org.apache.aries.rsa.provider.fastbin:1.9.0]

... 10 more

When I deploy my command on one of the other karaf container 
everything works fine.


On the fastbin github site there is an "endpoint configuration" section:

Endpoint Configuration

service.exported.configs: aries.fastbin

KeyDefaultDescription
uritcp://0.0.0.0:2543The bind address to use
exportAddresslooks up the hostnameThe ip/hostname how remote 
clients can reach this server

timeout30The timeout for sync calls (default 5 minutes)

I guess I'm supposed to change the "uri" value (maybe a different 
one on each karaf container?) in order to not get a collision.


Unfortunately there is no indication where to specify these values, 
a .cfg file in karaf/etc/? Is the file supposed to be named 
service.exported.configs.cfg? Is the syntax supposed to be 
aries.fastbin.uri?


Many thanks in advance for your support

--
Schéin Gréiss, Mit freundlichen Grüßen, Meilleures salutations, Kind 
regards,

Alex Weirig
Responsable

Re: Aries RSA with fastbin provider and 3 nodes throws Address already in use exception?

2016-11-21 Thread Christian Schneider

I have updated the docs to reflect where you can configure fastbin.
It seems that the configuration is only done on the general transport 
level not on the endpoint.


See
https://github.com/apache/aries-rsa/tree/master/provider/fastbin

Christian

On 21.11.2016 10:33, Christian Schneider wrote:

I just looked into the source code.

It seems there is a I am not very experienced with the fastbin 
transport.cfg.

Where you can set the uri for the whole server.

We seem to be lacking documentation here. I will update the github 
README file to reflect what I found.


Christian

On 21.11.2016 10:12, Alex Weirig wrote:


Hi Christian,

thanks for your answer ... do you mean we have to use a different 
port for each service? This can become complicated to manage when the 
number of services increases ...


Why is the address collision only showing up when I use the 3rd 
karaf, not when I only have 2 of them?


Schéin Gréiss, Mit freundlichen Grüßen, Meilleures salutations, Kind 
regards,

Alex Weirig
Responsable Technique
Ville de Luxembourg - Centre Technolink 2, rue Charles de Tornaco L - 
2623 LUXEMBOURG alex.wei...@technolink.lu 
<mailto:alex.wei...@technolink.lu> Tel: +352 4796 - 6127 Fax: +352 42 
88 81 www.technolink.lu <http://www.technolink.lu>

On 21/11/2016 10:03, Christian Schneider wrote:
The Endpoint configuration is done using service properties. So you 
need to set it on the service you export using DS.


Christian

On 21.11.2016 08:47, Alex Weirig wrote:


Hello,

I'm facing a problem to get fastbin provider working in the 
following configuration:


I have

3 karaf containers (4.0.7) running on 3 different (virtual) 
machines, all have aries RSA (1.9.0) with zookeeper discovery and 
fastbin provider features installed


1 zookeeper server (3.4.9)

2 of the karaf servers provide services (declarative services) that 
are correctly registered in zookeeper.



On the 3rd karaf server I want to use the services in a shell 
command, unfortunately I'm getting an "Address already in use" 
exception in this karaf container.


2016-11-18 16:43:14,565 | WARN  | pool-64-thread-1 | 
Activator| 56 - 
org.apache.aries.rsa.provider.fastbin - 1.9.0 | Error starting 
activator
java.io.IOException: Failed to bind to server socket: /0.0.0.0:2543 
due to: java.net.BindException: Address already in use
at 
org.apache.aries.rsa.provider.fastbin.tcp.TcpTransportServer.start(TcpTransportServer.java:99)[56:org.apache.aries.rsa.provider.fastbin:1.9.0]
at 
org.apache.aries.rsa.provider.fastbin.tcp.ServerInvokerImpl.start(ServerInvokerImpl.java:194)[56:org.apache.aries.rsa.provider.fastbin:1.9.0]
at 
org.apache.aries.rsa.provider.fastbin.tcp.ServerInvokerImpl.start(ServerInvokerImpl.java:190)[56:org.apache.aries.rsa.provider.fastbin:1.9.0]
at 
org.apache.aries.rsa.provider.fastbin.FastBinProvider.(FastBinProvider.java:67)[56:org.apache.aries.rsa.provider.fastbin:1.9.0]
at 
org.apache.aries.rsa.provider.fastbin.Activator.doStart(Activator.java:47)[56:org.apache.aries.rsa.provider.fastbin:1.9.0]
at 
org.apache.aries.rsa.provider.fastbin.BaseActivator.run(BaseActivator.java:230)[56:org.apache.aries.rsa.provider.fastbin:1.9.0]
at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_72]
at 
java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_72]
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_72]
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_72]

at java.lang.Thread.run(Thread.java:745)[:1.8.0_72]
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)[:1.8.0_72]
at sun.nio.ch.Net.bind(Net.java:433)[:1.8.0_72]
at sun.nio.ch.Net.bind(Net.java:425)[:1.8.0_72]
at 
sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)[:1.8.0_72]
at 
sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)[:1.8.0_72]
at 
org.apache.aries.rsa.provider.fastbin.tcp.TcpTransportServer.start(TcpTransportServer.java:97)[56:org.apache.aries.rsa.provider.fastbin:1.9.0]

... 10 more

When I deploy my command on one of the other karaf container 
everything works fine.


On the fastbin github site there is an "endpoint configuration" 
section:


Endpoint Configuration

service.exported.configs: aries.fastbin

KeyDefaultDescription
uritcp://0.0.0.0:2543The bind address to use
exportAddresslooks up the hostnameThe ip/hostname how 
remote clients can reach this server

timeout30The timeout for sync calls (default 5 minutes)

I guess I'm supposed to change the "uri" value (maybe a different 
one on each karaf container?) in order to not get a collision.


Unfortunately there is no indication where to specify these

Re: Implementation of RFC-193 CDI

2016-11-23 Thread Christian Schneider

+1

Looking forward to this since I talked with Emily at eclipsecon 2015 :-)

Christian

On 23.11.2016 16:33, Raymond Auge wrote:

Hello All,

I've been working through implementing RFC-193 [1] and have a 
relatively decent initial cut with most major details already sorted out.


I'm wondering if Apache Aries project is interested in hosting this 
implementation?


- Ray

[1] https://github.com/osgi/design/tree/master/rfcs/rfc0193

PS: If you look at RFC-193 in it's current state please note that it 
needs to be re-factored so that the technical section follows from the 
requirements section and I will do that in the next little while.





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

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



Re: Implementation of RFC-193 CDI

2016-11-23 Thread Christian Schneider
I think it would be great if Guillaume and Ray could work on the impl 
together. Ray could then feed the experiences back into the RFC.

In any case I would support having Ray as an aries committer.

Christian

On 23.11.2016 17:30, David Bosschaert wrote:

Hi Guillaume,

My understanding is that the technical design of the RFC will be 
significantly changed to better support the OSGi dynamics - hopefully 
we'll see an update soon at 
https://github.com/osgi/design/tree/master/rfcs/rfc0193


If I understand things correctly then Ray's CDI implementation will 
support the improved design.


Cheers,

David


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

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



Re: RFC-217 Snapshot build

2017-01-04 Thread Christian Schneider
We do not use the OSS sonatype repo at apache. Instead we deploy to the 
apache snapshot repo.


See https://issues.apache.org/jira/browse/ARIES-1651
I just added the relevant repos to the pom and did a mvn deploy.

You should now find the artifacts at 
https://repository.apache.org/content/repositories/snapshots/org/apache/aries/jax/rs/


Christian

On 03.01.2017 17:49, marc.schle...@sdv-it.de wrote:

Hello everyone


Could someone please release a snapshot for the current implementation 
of JAX-RS Osgi-Service 
(https://github.com/apache/aries-jax-rs-whiteboard)to the 
OSS-Sonatype-Snapshot-Repo 
(https://oss.sonatype.org/content/groups/osgi/org/osgi/)?


I cannot build the sources with Maven because the project depends on 
bnd-3.4.0-SNAPSHOT which is not available via my company Nexus 
(everything else is blocked by a proxy).


If there is a CI-Job which is producing a JAR that I could download 
would also be fine...I just couldnt find one



Thanks.
Marc



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

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



Re: JPA Container - Unexpected EntityManagerFactory Service Registration

2017-01-05 Thread Christian Schneider
That might be a bug. I think jpa container should register
both EntityManagerFactoryBuilder and EntityManagerFactory in the name of
the persistence bundle.
Can you open an issue for this?

Christian

2017-01-05 14:31 GMT+01:00 Erwin Hogeweg :

> Hi,
>
> I am seeing a strange (wildly confusing) service registration when using
> the Aries JPA Container with Equinox. Not sure where the problem is, so I
> figured I start here.
>
> When the DataSource and the PersistenceProvider are available the
> container registers the EntityMangerFactory* services. However, the
> EntityManagerFactoryBuilder Service shows up as being registered by the
> container bundle while the EntityMangerFactory Services shows up as being
> registered by the bundle that provides the persistence unit.
>
> g! b 53
> org.apache.aries.jpa.container_2.3.0 [53]
>   Id=53, Status=ACTIVE  Data Root=...
>  * "Registered Services"*
> {org.osgi.framework.hooks.weaving.WeavingHook}=...
> {org.osgi.service.cm.ManagedService}=...
> *{org.osgi.service.jpa.EntityManagerFactoryBuilder}*={
> osgi.unit.version=4.1.0.SNAPSHOT_20170104-, osgi.unit.name=my.pu,
> osgi.unit.provider=org.eclipse.persistence.jpa.PersistenceProvider,
> service.id=119, *service.bundleid=53*, service.scope=singleton}
>   Services in use:
> {javax.sql.DataSource}=...
> {javax.persistence.spi.PersistenceProvider}=...
>
> g! b 111
> com.my.model_4.1.0.SNAPSHOT_20170104- [111]
>   Id=111, Status=ACTIVE  Data Root=/Users/erwin/.../org.
> eclipse.osgi/111/data
>  * "Registered Services"*
> *{javax.persistence.EntityManagerFactory}*={osgi.
> unit.version=4.1.0.SNAPSHOT_20170104-, osgi.unit.name=my.pu,
> osgi.unit.provider=org.eclipse.persistence.jpa.PersistenceProvider,
> service.id=125, *service.bundleid=111*, service.scope=singleton}
>   No services in use.
>
> This is with equinox 3.10.2.v20150203-1939, J8.
>
> BTW, I see the same thing happening with the mysql and the pax-jdbc-config
> bundles. The DataSourceFactory service shows as being registered by the
> mysql bundle, while it is actually registered by the config bundle.
>
> What am I missing here? Is this a feature, a bug, or is my brain not
> flexible enough to comprehend this?
>
>
> Thanks,
>
> Erwin
>



-- 
-- 
Christian Schneider
http://www.liquid-reality.de
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de>

Open Source Architect
http://www.talend.com
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.talend.com>


Re: JPA Container - Unexpected EntityManagerFactory Service Registration

2017-01-06 Thread Christian Schneider
I think the behaviour of pax-jdbc is correct. It should register the DSF in
the name of the jdbc provider bundle.

Christian

2017-01-06 13:52 GMT+01:00 Erwin Hogeweg :

> Christian,
>
> On Jan 6, 2017, at 2:22 AM, Christian Schneider 
> wrote:
>
> That might be a bug. I think jpa container should register both 
> EntityManagerFactoryBuilder
> and EntityManagerFactory in the name of the persistence bundle.
> Can you open an issue for this?
>
> Sure: https://issues.apache.org/jira/browse/ARIES-1652
>
> Do you want me to open a separate one for the pax-jdbc-config bundle? I
> believe that bundle has the same author(s)…
>
> Erwin
>
> Christian
>
> 2017-01-05 14:31 GMT+01:00 Erwin Hogeweg :
>
>> Hi,
>>
>> I am seeing a strange (wildly confusing) service registration when using
>> the Aries JPA Container with Equinox. Not sure where the problem is, so I
>> figured I start here.
>>
>> When the DataSource and the PersistenceProvider are available the
>> container registers the EntityMangerFactory* services. However, the
>> EntityManagerFactoryBuilder Service shows up as being registered by the
>> container bundle while the EntityMangerFactory Services shows up as being
>> registered by the bundle that provides the persistence unit.
>>
>> g! b 53
>> org.apache.aries.jpa.container_2.3.0 [53]
>>   Id=53, Status=ACTIVE  Data Root=...
>>  * "Registered Services"*
>> {org.osgi.framework.hooks.weaving.WeavingHook}=...
>> {org.osgi.service.cm.ManagedService}=...
>> *{org.osgi.service.jpa.EntityManagerFactoryBuilder}*={osgi.
>> unit.version=4.1.0.SNAPSHOT_20170104-, osgi.unit.name=my.pu,
>> osgi.unit.provider=org.eclipse.persistence.jpa.PersistenceProvider,
>> service.id=119, *service.bundleid=53*, service.scope=singleton}
>>   Services in use:
>> {javax.sql.DataSource}=...
>> {javax.persistence.spi.PersistenceProvider}=...
>>
>> g! b 111
>> com.my.model_4.1.0.SNAPSHOT_20170104- [111]
>>   Id=111, Status=ACTIVE  Data Root=/Users/erwin/.../org.ecli
>> pse.osgi/111/data
>>  * "Registered Services"*
>> *
>> {javax.persistence.EntityManagerFactory}*={osgi.unit.version=4.1.0.SNAPSHOT_20170104-,
>> osgi.unit.name=my.pu, osgi.unit.provider=org.eclipse
>> .persistence.jpa.PersistenceProvider, service.id=125,
>> *service.bundleid=111*, service.scope=singleton}
>>   No services in use.
>>
>> This is with equinox 3.10.2.v20150203-1939, J8.
>>
>> BTW, I see the same thing happening with the mysql and the
>> pax-jdbc-config bundles. The DataSourceFactory service shows as being
>> registered by the mysql bundle, while it is actually registered by the
>> config bundle.
>>
>> What am I missing here? Is this a feature, a bug, or is my brain not
>> flexible enough to comprehend this?
>>
>>
>> Thanks,
>>
>> Erwin
>>
>
>
>
> --
> --
> Christian Schneider
> http://www.liquid-reality.de
> <https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de>
>
> Open Source Architect
> http://www.talend.com
> <https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.talend.com>
>
>
>


-- 
-- 
Christian Schneider
http://www.liquid-reality.de
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de>

Open Source Architect
http://www.talend.com
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.talend.com>


Re: JPA Container - Unexpected EntityManagerFactory Service Registration

2017-01-07 Thread Christian Schneider
I think the mysql driver indeed registers the DSF. You might need to
provide the bundle for the DataSourceFactory api though. Can you try that?

Christian

2017-01-06 18:18 GMT+01:00 Erwin Hogeweg :

> Thanks,
>
> I can see the reasoning. That is confusing though. I thought that the
> MySQL driver now registered the DSF, just like the h2 bundle, so I removed
> the pax-jdbc bundles... after which the MySQL bundle did NOT 'register' the
> DSF anymore :-)
>
> Erwin
>
> El ene. 6, 2017, a las 10:30, Christian Schneider 
> escribió:
>
> I think the behaviour of pax-jdbc is correct. It should register the DSF
> in the name of the jdbc provider bundle.
>
> Christian
>
> 2017-01-06 13:52 GMT+01:00 Erwin Hogeweg :
>
>> Christian,
>>
>> On Jan 6, 2017, at 2:22 AM, Christian Schneider 
>> wrote:
>>
>> That might be a bug. I think jpa container should register
>> both EntityManagerFactoryBuilder and EntityManagerFactory in the name of
>> the persistence bundle.
>> Can you open an issue for this?
>>
>> Sure: https://issues.apache.org/jira/browse/ARIES-1652
>>
>> Do you want me to open a separate one for the pax-jdbc-config bundle? I
>> believe that bundle has the same author(s)…
>>
>> Erwin
>>
>> Christian
>>
>> 2017-01-05 14:31 GMT+01:00 Erwin Hogeweg :
>>
>>> Hi,
>>>
>>> I am seeing a strange (wildly confusing) service registration when using
>>> the Aries JPA Container with Equinox. Not sure where the problem is, so I
>>> figured I start here.
>>>
>>> When the DataSource and the PersistenceProvider are available the
>>> container registers the EntityMangerFactory* services. However, the
>>> EntityManagerFactoryBuilder Service shows up as being registered by the
>>> container bundle while the EntityMangerFactory Services shows up as being
>>> registered by the bundle that provides the persistence unit.
>>>
>>> g! b 53
>>> org.apache.aries.jpa.container_2.3.0 [53]
>>>   Id=53, Status=ACTIVE  Data Root=...
>>>  * "Registered Services"*
>>> {org.osgi.framework.hooks.weaving.WeavingHook}=...
>>> {org.osgi.service.cm.ManagedService}=...
>>> *{org.osgi.service.jpa.EntityManagerFactoryBuilder}*={osgi.uni
>>> t.version=4.1.0.SNAPSHOT_20170104-, osgi.unit.name=my.pu,
>>> osgi.unit.provider=org.eclipse.persistence.jpa.PersistenceProvider,
>>> service.id=119, *service.bundleid=53*, service.scope=singleton}
>>>   Services in use:
>>> {javax.sql.DataSource}=...
>>> {javax.persistence.spi.PersistenceProvider}=...
>>>
>>> g! b 111
>>> com.my.model_4.1.0.SNAPSHOT_20170104- [111]
>>>   Id=111, Status=ACTIVE  Data Root=/Users/erwin/.../org.ecli
>>> pse.osgi/111/data
>>>  * "Registered Services"*
>>> *
>>> {javax.persistence.EntityManagerFactory}*={osgi.unit.version=4.1.0.SNAPSHOT_20170104-,
>>> osgi.unit.name=my.pu, osgi.unit.provider=org.eclipse
>>> .persistence.jpa.PersistenceProvider, service.id=125,
>>> *service.bundleid=111*, service.scope=singleton}
>>>   No services in use.
>>>
>>> This is with equinox 3.10.2.v20150203-1939, J8.
>>>
>>> BTW, I see the same thing happening with the mysql and the
>>> pax-jdbc-config bundles. The DataSourceFactory service shows as being
>>> registered by the mysql bundle, while it is actually registered by the
>>> config bundle.
>>>
>>> What am I missing here? Is this a feature, a bug, or is my brain not
>>> flexible enough to comprehend this?
>>>
>>>
>>> Thanks,
>>>
>>> Erwin
>>>
>>
>>
>>
>> --
>> --
>> Christian Schneider
>> http://www.liquid-reality.de
>> <https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de>
>>
>> Open Source Architect
>> http://www.talend.com
>> <https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.talend.com>
>>
>>
>>
>
>
> --
> --
> Christian Schneider
> http://www.liquid-reality.de
> <https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de>
>
> Open Source Architect
> http://www.talend.com
> <https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.talend.com>
>
>


-- 
-- 
Christian Schneider
http://www.liquid-reality.de
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de>

Open Source Architect
http://www.talend.com
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.talend.com>


Re: JPA Container - Unexpected EntityManagerFactory Service Registration

2017-01-19 Thread Christian Schneider
Yes you are right. The mysql bundle does not create the DSF. So you 
still need pax-jdbc-mysql.


Christian

On 09.01.2017 18:30, Erwin Hogeweg wrote:

Christian,

Thanks.

I think the mysql driver indeed registers the DSF. You might need to 
provide the bundle for the DataSourceFactory api though. Can you try 
that?
The DataSourceFactory is exported by the enterprise bundle (Ugh, I 
didn’t really write that… that shouldn’t even be in my runtime).


g! packages org.osgi.service.jdbc
osgi.wiring.package; bundle-symbolic-name="osgi.enterprise"; 
bundle-version:Version="5.0.0.201203141834"; 
version:Version="1.0.0"; osgi.wiring.package="org.osgi.service.jdbc"; 
uses:="javax.sql"

  org.apache.aries.jpa.container_2.3.0 [51] imports
  org.ops4j.pax.jdbc.pool.common_0.9.0 [60] imports
  org.ops4j.pax.jdbc.pool.dbcp2_0.9.0 [58] imports
  org.ops4j.pax.jdbc.config_0.9.0 [59] imports
  org.ops4j.pax.jdbc_0.9.0 [57] imports

I also don’t see that package imported by the mysql bundle.

Erwin



Christian

2017-01-06 18:18 GMT+01:00 Erwin Hogeweg <mailto:erwin.hoge...@me.com>>:


Thanks,

I can see the reasoning. That is confusing though. I thought that
the MySQL driver now registered the DSF, just like the h2 bundle,
so I removed the pax-jdbc bundles... after which the MySQL bundle
did NOT 'register' the DSF anymore :-)

Erwin

El ene. 6, 2017, a las 10:30, Christian Schneider
mailto:ch...@die-schneider.net>> escribió:


I think the behaviour of pax-jdbc is correct. It should register
the DSF in the name of the jdbc provider bundle.

Christian

2017-01-06 13:52 GMT+01:00 Erwin Hogeweg mailto:erwin.hoge...@me.com>>:

Christian,


On Jan 6, 2017, at 2:22 AM, Christian Schneider
mailto:ch...@die-schneider.net>>
wrote:

That might be a bug. I think jpa container should register
both EntityManagerFactoryBuilder and EntityManagerFactory
in the name of the persistence bundle.
Can you open an issue for this?


Sure: https://issues.apache.org/jira/browse/ARIES-1652
<https://issues.apache.org/jira/browse/ARIES-1652>

Do you want me to open a separate one for the
pax-jdbc-config bundle? I believe that bundle has the same
author(s)…

Erwin

Christian

2017-01-05 14:31 GMT+01:00 Erwin Hogeweg
mailto:erwin.hoge...@me.com>>:

Hi,

I am seeing a strange (wildly confusing) service
registration when using the Aries JPA Container with
Equinox. Not sure where the problem is, so I figured I
start here.

When the DataSource and the PersistenceProvider are
available the container registers the
EntityMangerFactory* services. However, the
EntityManagerFactoryBuilder Service shows up as being
registered by the container bundle while the
EntityMangerFactory Services shows up as being
registered by the bundle that provides the persistence
unit.

g! b 53
org.apache.aries.jpa.container_2.3.0 [53]
  Id=53, Status=ACTIVE  Data Root=...
*"Registered Services"*
{org.osgi.framework.hooks.weaving.WeavingHook}=...
{org.osgi.service.cm
<http://org.osgi.service.cm/>.ManagedService}=...

*{org.osgi.service.jpa.EntityManagerFactoryBuilder}*={osgi.unit.version=4.1.0.SNAPSHOT_20170104-,
osgi.unit.name <http://osgi.unit.name/>=my.pu,
osgi.unit.provider=org.eclipse.persistence.jpa.PersistenceProvider,
service.id <http://service.id/>=119,
*service.bundleid=53*, service.scope=singleton}
  Services in use:
{javax.sql.DataSource}=...
{javax.persistence.spi.PersistenceProvider}=...

g! b 111
com.my.model_4.1.0.SNAPSHOT_20170104- [111]
  Id=111, Status=ACTIVE  Data
Root=/Users/erwin/.../org.eclipse.osgi/111/data
*"Registered Services"*

*{javax.persistence.EntityManagerFactory}*={osgi.unit.version=4.1.0.SNAPSHOT_20170104-,
osgi.unit.name <http://osgi.unit.name/>=my.pu,
osgi.unit.provider=org.eclipse.persistence.jpa.PersistenceProvider,
service.id <http://service.id/>=125,
*service.bundleid=111*, service.scope=singleton}
  No services in use.

This is with equinox 3.10.2.v20150203-1939, J8.

BTW, I see the same thing happening with the mysql and
the pax-jdbc-config bundles. The DataSourceFactory
service shows as being registered by the mysql bundle,
while it is actually registered by the config bundle.


Re: Export Control ECCN /CCATS information Request

2017-02-06 Thread Christian Schneider

Aries is more like an umbrella project for several independent libraries.
See the list of modules at http://aries.apache.org/.
As none of these modules can run by itself I am not sure if they can be 
classified as a product at all.


About an existing classification. This might be something for our 
committers from IBM. Maybe they already did this. I am not sure though 
if you can really classify a library or just the end product you build 
from the set of libraries.


Christian


On 06.02.2017 10:18, PORCHER LABREUILLE, Bertrand wrote:

Hello,
We need to confirm the ECCN (Export Control Classification Number) of 
the product “Apache Aries” to assess the eventual export control 
requirements associated with it.
We are especially interested in assessing whether this product 
contains encryption controlled under the United States EAR (Export 
Administration Regulation, _http://www.bis.doc.gov/_.)
If this product has been the subject of a classification review, 
please provide also the CCATS number if any. In the case there is 
encryption in your product, please confirm the key strength.
If you have the exact website where we can look up this information, 
please provide us with the relevant URL.

Thank you very much in advance for your reply,
Bertrand P.Labreuille
Third-Party Software Audit & Export Control Office
Airbus Defense & Space / France
***
Ce courriel (incluant ses eventuelles pieces jointes) peut contenir des 
informations confidentielles et/ou protegees ou dont la diffusion est 
restreinte. Si vous avez recu ce courriel par erreur, vous ne devez ni le 
copier, ni l'utiliser, ni en divulguer le contenu a quiconque. Merci d'en 
avertir immediatement l'expediteur et d'effacer ce courriel de votre systeme. 
Airbus Defence and Space et les sociétés Airbus Group declinent toute 
responsabilite en cas de corruption par virus, d'alteration ou de falsification 
de ce courriel lors de sa transmission par voie electronique.
This email (including any attachments) may contain confidential and/or 
privileged information or information otherwise protected from disclosure. If 
you are not the intended recipient, please notify the sender immediately, do 
not copy this message or any attachments and do not use it for any purpose or 
disclose its content to any person, but delete this message and any attachments 
from your system. Airbus Defence and Space and Airbus Group companies disclaim 
any and all liability if this email transmission was virus corrupted, altered 
or falsified.
-
Airbus Defence and Space SAS (393 341 516 RCS Versailles) - Capital: 16.587.728 
EUR - Siege social: 51-61 Route de Verneuil, 78130 Les Mureaux, France




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

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



Re: Updating entities with Aries JPA in Declarative Services

2017-04-18 Thread Christian Schneider
Transaction type JTA means that you need  a JTA transaction instead of a 
local transaction on the em.
In both cases it is necessary to be in a transaction when you do changes 
to the database.


The JPATemplate allows to transparently begin and commit the 
transaction. It also demarcates the lifecycle of the em. So outside the 
outermost JPATemplate execution the em is closed and your entities are 
detached.


Your code without a transaction might work but rather as a side effect 
of persistence manager caching. For example hibernate does not directly 
write to the database when you change properties.
So simply changing the properties might work outside the transaction. 
Still I would not recommend it as you never know when hibernate decides 
to write to the db.


Christian

On 18.04.2017 08:59, Jens Offenbach wrote:

Hallo,
I have got a question regarding updates of JPA entities using Aries JPA with 
Declarative Services (DS). Hopefully, someone can help me.

Let's assume we have the Task entity from the example here: 
https://github.com/apache/aries/blob/trunk/jpa/examples/tasklist-model/src/main/java/org/apache/aries/jpa/example/tasklist/model/Task.java

When e.g. the fields "title" and "description" must be updated, is it mandatory 
to do it via JpaTemplate within a transaction like this:

jpa.tx(em -> {
 task.setDescription("New description");
 task.setTitle("New title");
 em.flush();
  });

or can safely be done without any transaction like this:

task.setDescription("New description");
task.setTitle("New title");

I would say, it can be done directly without any transactions on application-level because 
transaction-type is "JTA" and not "RESOURCE_LOCAL".

persistence.xml:

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";
version="2.0">



org.eclipse.persistence.jpa.PersistenceProvider


osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/treedb)


osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/treedb)

...
true











    
        





Thank you very much.

Regards,
Jens



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

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



Re: Consistent entity updates without exposing JpaTemplate

2017-04-22 Thread Christian Schneider
For now this is a good pattern. I plan to add  a pure TransactionTemplate
or similar to cover this case outside of JPATemplate.

Alternatively you can inject a UserTransaction and use it to create the
transaction.

Christian

2017-04-21 16:49 GMT+02:00 Jens Offenbach :

> Hallo,
> I am sorry, but I am still in trouble with JpaTemplate and API design. I
> am trying to hide JpaTemplate in my service implementation, but I am not
> sure, if this is the recommended approach. Unfortuantely, I cannot find any
> complex examples in the web.
>
> Let me explain the problem with the help of the TaskService example (
> https://github.com/apache/aries/blob/trunk/jpa/examples/
> tasklist-ds/src/main/java/org/apache/aries/jpa/example/tasklist/ds/impl/
> TaskServiceImpl.java):
>
> Task task = taskService.getTask(1);
> task.setTitle("New Title#1");
>
> Both calls must be done under transaction control to keep the database
> consistent (Thanks Christian), so the only correct way would be:
>
> jpa.tx(em -> {
> Task task = taskService.getTask(1);
> task.setTitle("New Title#1");
> });
>
> The problem is, that service users must have the JpaTemplate reference for
> consistent entity updates. The only way to hide JpaTemplate would be to
> extend TaskService like this:
>
> public interface TaskService {
>
> void tx(Runnable runnable);
>
> Task getTask(Integer id);
>
> void addTask(Task task);
>
> void updateTask(Task task);
>
> void deleteTask(Integer id);
>
> Collection getTasks();
>
> }
>
> @Component
> public class TaskServiceImpl implements TaskService {
>
> @Reference(target = "(osgi.unit.name=tasklist)")
> private JpaTemplate jpa;
>
> @Override
> public void tx(Runnable runnable) {
> jpa.tx(em -> runnable.run());
> }
>
> }
>
> The resulting user code that updates an entity consistently (hopefully)
> would look like this:
>
> @Component(immediate = true)
> public class TasklistUpdater {
>
> @Reference
> TaskService taskService;
>
> @Activate
> public void addDemoTask() {
> if (taskService.getTask(1) == null) {
> Task task = new Task();
> task.setId(1);
> task.setTitle("Task1");
> taskService.addTask(task);
> }
> updateDemoTask();
> }
>
> private void updateDemoTask() {
> taskService.tx(() -> {
> Task task = taskService.getTask(1);
> task.setDescription("A description");
> task.setTitle("A title");
> });
> }
>
> }
>
> I am not sure, if this approach works as expected and if JpaTemplate calls
> can be nested as shown above. What about overhead?
>
> Are there any best practices known regarding API design in respect to
> JpaTemplate?
>
> I am thankful for any comments or ideas for improvement?
>
> Thank you very much,
> Jens
>
>


-- 
-- 
Christian Schneider
http://www.liquid-reality.de
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de>

Open Source Architect
http://www.talend.com
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.talend.com>


Re: Re: Consistent entity updates without exposing JpaTemplate

2017-04-23 Thread Christian Schneider
Aries transaction control is an option but you have to completely switch
then.
Unfortunately tx control is not compatible to JPATemplate.

Christian

2017-04-23 2:18 GMT+02:00 Yogesh Rao :

> Hello Jens,
>
> You could try using Aries Transaction Control Service =>
> http://aries.apache.org/modules/tx-control/ instead of injecting
> jpaTemplate
>
> Regards,
> -Yogesh
>
> On Sat, 22 Apr 2017 at 8:38 PM, Jens Offenbach  wrote:
>
>> Thanks Christian! That are good news... Especially, your future planning
>> regarding "TransactionTemplate" sounds really interesting.
>>
>> Can you plase provide a small example for your alternative solutions. How
>> can I obtain a "UserTransaction" to create the transaction?
>>
>> Best regards,
>> Jens
>>
>> Gesendet: Samstag, 22. April 2017 um 13:22 Uhr
>> Von: "Christian Schneider" 
>> An: user@aries.apache.org
>> Betreff: Re: Consistent entity updates without exposing JpaTemplate
>>
>> For now this is a good pattern. I plan to add  a pure TransactionTemplate
>> or similar to cover this case outside of JPATemplate.
>>
>> Alternatively you can inject a UserTransaction and use it to create the
>> transaction.
>>
>> Christian
>>
>> 2017-04-21 16:49 GMT+02:00 Jens Offenbach mailto:wolle
>> 5...@gmx.de]>:Hallo,
>> I am sorry, but I am still in trouble with JpaTemplate and API design. I
>> am trying to hide JpaTemplate in my service implementation, but I am not
>> sure, if this is the recommended approach. Unfortuantely, I cannot find any
>> complex examples in the web.
>>
>> Let me explain the problem with the help of the TaskService example (
>> https://github.com/apache/aries/blob/trunk/jpa/examples/
>> tasklist-ds/src/main/java/org/apache/aries/jpa/example/tasklist/ds/impl/
>> TaskServiceImpl.java[https://github.com/apache/aries/blob/
>> trunk/jpa/examples/tasklist-ds/src/main/java/org/apache/
>> aries/jpa/example/tasklist/ds/impl/TaskServiceImpl.java]):
>>
>> Task task = taskService.getTask(1);
>> task.setTitle("New Title#1");
>>
>> Both calls must be done under transaction control to keep the database
>> consistent (Thanks Christian), so the only correct way would be:
>>
>> jpa.tx(em -> {
>> Task task = taskService.getTask(1);
>> task.setTitle("New Title#1");
>> });
>>
>> The problem is, that service users must have the JpaTemplate reference
>> for consistent entity updates. The only way to hide JpaTemplate would be to
>> extend TaskService like this:
>>
>> public interface TaskService {
>>
>> void tx(Runnable runnable);
>>
>> Task getTask(Integer id);
>>
>> void addTask(Task task);
>>
>> void updateTask(Task task);
>>
>> void deleteTask(Integer id);
>>
>> Collection getTasks();
>>
>> }
>>
>> @Component
>> public class TaskServiceImpl implements TaskService {
>>
>> @Reference(target = "(osgi.unit.name[http://osgi.unit.name
>> ]=tasklist)")
>> private JpaTemplate jpa;
>>
>> @Override
>> public void tx(Runnable runnable) {
>> jpa.tx(em -> runnable.run());
>> }
>>
>> }
>>
>> The resulting user code that updates an entity consistently (hopefully)
>> would look like this:
>>
>> @Component(immediate = true)
>> public class TasklistUpdater {
>>
>> @Reference
>> TaskService taskService;
>>
>> @Activate
>> public void addDemoTask() {
>> if (taskService.getTask(1) == null) {
>> Task task = new Task();
>> task.setId(1);
>> task.setTitle("Task1");
>>     taskService.addTask(task);
>> }
>> updateDemoTask();
>> }
>>
>> private void updateDemoTask() {
>> taskService.tx(() -> {
>> Task task = taskService.getTask(1);
>> task.setDescription("A description");
>>     task.setTitle("A title");
>> });
>> }
>>
>> }
>>
>> I am not sure, if this approach works as expected and if JpaTemplate
>> calls can be nested as shown above. What about overhead?
>>
>> Are there any best practices known regarding API design in respect to
>> JpaTemplate?
>>
>> I am thankful for any comments or ideas for improvement?
>>
>> Thank you very much,
>> Jens
>>
>>  --
>>
>> --
>> Christian Schneider
>> http://www.liquid-reality.de[https://owa.talend.com/owa/redir.aspx?C=
>> 3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de]
>>
>> Open Source Architect
>> http://www.talend.com[https://owa.talend.com/owa/redir.aspx?C=
>> 3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.talend.com]
>>
>


-- 
-- 
Christian Schneider
http://www.liquid-reality.de
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de>

Open Source Architect
http://www.talend.com
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.talend.com>


Re: Use Existing Zookeeper Instance for RSA / Multiple RSA Instances Per Machine

2017-09-29 Thread Christian Schneider
Both cases should already work with the echotcp example.
https://github.com/apache/aries-rsa/tree/master/examples/echotcp

In the readme we start two karaf instances. The first instance starts a
zookeeper server while the second instance only connects to it.

In karaf you achieve this by installing the
aries-rsa-discovery-zookeeper-server feature if you want a server and
the aries-rsa-discovery-zookeeper if you only want a client.

If you look at the feature file you see that the diference between the two
features is indeed just the config file
https://github.com/apache/aries-rsa/blob/master/features/src/main/resources/features.xml

So if zookeeper server is created then you seem to have a config for it in
config admin. Normally it is sufficient to remove the config file to remove
the config .. but it does not work in all cases. For example if you remove
the config while karaf is stopped then it will still be present in config
admin. So I suggest to use the config commands to check if a config exists
and to remove it.

For running two instances on the same machine you indeed need to tweak some
configs. It depends on which transports you use.
Can you give some more details?

For example for the tcp transport you need to provide one unique port per
service:
https://github.com/apache/aries-rsa/blob/master/examples/echotcp/service/src/main/java/org/apache/aries/rsa/examples/echotcp/service/EchoServiceImpl.java

Christian

2017-09-29 18:45 GMT+02:00 Jonathan knez :

> I am successfully using Aries RSA to provide an OSGi service on one host
> and consume it on other hosts. I am impressed at how well it works. Thanks
> to the Aries team for doing all the hard work.
>
>
>
> No on to my question. I want to run my own zookeeper server externally and
> have RSA connect to it. I do not want RSA to try to start its own zookeeper
> server. I also want to run multiple OSGi containers (ServiceMix in this
> case) with RSA loaded on a single machine.
>
>
>
> This webpage describes how to configure RSA zookeeper discovery.
>
> https://github.com/apache/aries-rsa/tree/master/discovery/zookeeper
>
>
>
> I have successfully updated the “org.apache.aries.rsa.discovery.zookeeper”
> file to point to my existing server. RSA successfully connects to it and
> life is good. It looks like RSA still tries to create its own zookeeper
> server however. How do I prevent that behavior? I have tried leaving the
> org.apache.aries.rsa.discovery.zookeeper.server empty and also deleting
> the file entirely. In both cases, I still see stuff listening on 2181
> (default zk client port).
>
>
>
> My second question is how can I successfully run two servicemix instances
> with RSA on a single host? When I attempt this, the first instances starts
> fine and connects to zookeeper without issue. The second instance fails to
> even attempt to connect to zookeeper. If I shutdown the first instance and
> only star the second, the second connects without issue. I assume some port
> numbers need to change to avoid conflicts between the two servicemix
> instances. Any thoughts on what configs needs to change?
>
>
>
> My ultimate need is to for a team of developers to be able to share a
> single machine with each developer running at least 2 instances of
> servicemix to test their stuff without affecting any of the other
> developers. That is why I want each developer to be responsible for running
> their own zookeeper server at some unique address, then telling
> unique RSA instances where to find their zookeeper instance. If there is a
> different way to achieve what I am after, I would welcome the feedback.
> Thanks.
>
>


-- 
-- 
Christian Schneider
http://www.liquid-reality.de
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de>

Computer Scientist
http://www.adobe.com


Re: Aries-RSA - Question regarding bundle start order

2017-11-26 Thread Christian Schneider
Can you do a quick check if the problem also happens with the tcp
transport? I think it should be independent of fastbin.

In general remote services should be independent of the start order of the
bundles. So this might be a bug in TopoligyManager or in the zookeeper
discovery.

Christian

2017-11-26 19:49 GMT+01:00 João Assunção :

> Hello all,
>
> I'm testing RSA with zookeeper and fastbin (1.10.0) and I'm experiencing
> some issues in regards to the discovery of the remote endpoints.
> I have two karaf instances. Instance A runs zookeeper server and instance
> B that connects to instance A zookeeper. Instance B publishes some remote
> services.
>
> A lot of times, when I restart instance A, no remotes services from
> instance B are imported. I noticed that this happens less frequently when
> fastbin uses a start level below zookeeper discovery. I also experience
> situations where the remote services are imported but the endpoints command
> show no endpoints.
>
> Can anyone give me some hints regarding these issues?
>
> Thank you.
>
> Regards,
>
> João Assunção
>
> Email: joao.assun...@exploitsys.com
> Mobile: +351 916968984 <+351%20916%20968%20984>
> Phone: +351 211933149 <+351%2021%20193%203149>
> Web: www.exploitsys.com
>
>
>


-- 
-- 
Christian Schneider
http://www.liquid-reality.de
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de>

Computer Scientist
http://www.adobe.com


[HEADS UP] Removal of DiscoveryPlugin in Aries RSA zookeeper discovery

2018-02-07 Thread Christian Schneider
I am currently preparing Aries RSA for the OSGi R7 tck tests.

During this work I am also looking into cleaning up old stuff.
I found that the DiscoveryPlugin facility in the zookeeper discovery does
not seem to work at all.
The properties are changed but never used in writing the endpoint to
zookeeper.
So as this was not found until now I doubt anyone is using the
DiscoveryPlugin services.

I would like to take the opportunity to remove this extensibility point.

Please speak up if you need or use this.

Christian

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

Computer Scientist
http://www.adobe.com


JAX-RS Whiteboard and Swagger

2018-08-16 Thread Christian Schneider
I would like to create a demo for how to do REST in OSGi and plan to use
the new JAX-RS whiteboard. One important feature for REST services today is
to have Swagger descriptor and the Swagger UI. Is this possible with the
whiteboard? Are there examples for it?

Christian

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

Computer Scientist
http://www.adobe.com


Re: Access Cluster Information Service as Remote Service

2018-10-22 Thread Christian Schneider
I have not tried Cluster Information Service at all. If you provide some
sample setup for it I can take a look.

Christian

Am Mo., 22. Okt. 2018 um 12:02 Uhr schrieb "Jörn Schumann (
joern.schum...@hs-furtwangen.de)" :

> Hey together,
>
> i am using your Remote Service Admin Service implementation "aries-rsa" to
> provide remote services in the cluster. This works very well, but not for
> the
> osgi specificated "Cluster Informaion Service". Since your last commit
> it's possible to import it,
> but i don't get any registered instances for the interface
> "FrameworkNodeStatus" in the program code. Have you
> tried the remote access for this service?
>
> Greetings,
> Jörn Schumann
>


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

Computer Scientist
http://www.adobe.com


Re: Aries RSA: securing exported services with ExportPolicy

2018-10-25 Thread Christian Schneider
Does it work if you set the interceptor directly on the service?

Christian

Am Do., 25. Okt. 2018 um 08:57 Uhr schrieb Niehues, Christian <
christian.nieh...@its-digital.de>:

> Hi,
>
>
> I try to export a service in my karaf to be able to process SOAP messages
> sent from remote client but I am facing problems to secure it. The
> documentation for Aries RSA about the TopologyManager notes that
> ExportPolicy implementations can be used to add authentication but I am
> missing further details.
>
>
> I tried to achieve it by adding an interceptor in my ExportPolicy but that
> seems not to help:
>
>
> props.put("service.exported.configs", "org.apache.cxf.ws");
> props.put("org.apache.cxf.ws.address", "http://192.168.1.100:9000/sync";);
> props.put("org.apache.cxf.ws.in.interceptors", "com.acme.MyInterceptor");
>
> com.acme.Myinterceptor extends
> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor
>
> I also tried to provide the Interceptor classname as List or
> String[] but that didn't work either, the interceptor never get's invoked
> when sending messages.
>
> So what I am doing wrong or is there any other/better way to secure a
> service provided by Aries RSA?
>
> Thanks,
>
> Christian
>
>

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

Computer Scientist
http://www.adobe.com


Re: Aries RSA: securing exported services with ExportPolicy

2018-10-26 Thread Christian Schneider
Any webservice exported using blueprint is accessible from remote. You will
only not see it as a rsa remote service.

What I meant is. Can you export your service using rsa but without an
Export policy if you add the interceptor as a service property? I am not
sure if this kind of interceptors work with the current cxf dosgi versions.

In general the recommended practice for securing services is using a CXF
feature and refer to it as an intent. For example the new CXF logging
feature registers itself as an intent.
https://github.com/apache/cxf/blob/master/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/osgi/Activator.java#L89-L90

The rest example readme shows how to add such an intent to your service:
https://github.com/apache/cxf-dosgi/blob/59e432afabb2a8f6a812b2a8f12cda68f4bfa775/samples/rest/README.md#add-logging-intent
(Basically you simply add a service property "service.exported.intents"
with your intent name as value).

This way you could create a feature that adds the security interceptors and
export it with intent name "mysecurity" and then add the service property
above to all services that should be secured.

The ExportPolicy is only needed if you want to add this property
transparently to your services without touching them.

Christian

Am Fr., 26. Okt. 2018 um 12:27 Uhr schrieb Niehues, Christian <
christian.nieh...@its-digital.de>:

> It works if I define the service as CXF endpoint in blueprint. But if I
> set it there it is not published as RSA endpoint and so it seems it's not
> accessible from remote.
>
>
> Christian
>
>
> --
> *Von:* Christian Schneider 
> *Gesendet:* Donnerstag, 25. Oktober 2018 17:24:40
> *An:* user@aries.apache.org
> *Betreff:* Re: Aries RSA: securing exported services with ExportPolicy
>
> Does it work if you set the interceptor directly on the service?
>
> Christian
>
> Am Do., 25. Okt. 2018 um 08:57 Uhr schrieb Niehues, Christian <
> christian.nieh...@its-digital.de>:
>
>> Hi,
>>
>>
>> I try to export a service in my karaf to be able to process SOAP messages
>> sent from remote client but I am facing problems to secure it. The
>> documentation for Aries RSA about the TopologyManager notes that
>> ExportPolicy implementations can be used to add authentication but I am
>> missing further details.
>>
>>
>> I tried to achieve it by adding an interceptor in my ExportPolicy but
>> that seems not to help:
>>
>>
>> props.put("service.exported.configs", "org.apache.cxf.ws");
>> props.put("org.apache.cxf.ws.address", "http://192.168.1.100:9000/sync";);
>> props.put("org.apache.cxf.ws.in.interceptors", "com.acme.MyInterceptor");
>>
>> com.acme.Myinterceptor extends
>> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor
>>
>> I also tried to provide the Interceptor classname as List or
>> String[] but that didn't work either, the interceptor never get's invoked
>> when sending messages.
>>
>> So what I am doing wrong or is there any other/better way to secure a
>> service provided by Aries RSA?
>>
>> Thanks,
>>
>> Christian
>>
>>
>
> --
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Computer Scientist
> http://www.adobe.com
>
>

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

Computer Scientist
http://www.adobe.com


Re: Aries RSA: securing exported services with ExportPolicy

2018-10-29 Thread Christian Schneider
Hi Christian,

the JAASAuthenticationFeature only does authentication.
When deployed in karaf the default realm should be fine.

For authorisation see e.g the SimpleAuthorizingInterceptor.
http://cxf.apache.org/docs/securing-cxf-services.html

Christian

Am Mo., 29. Okt. 2018 um 09:42 Uhr schrieb Niehues, Christian <
christian.nieh...@its-digital.de>:

> I was not able to add an interceptor by setting a service property (I used
> "org.apache.cxf.ws.in.interceptors").
>
>
> But I followed your advice and tried to use a CXF feature. I noticed that
> there is a ready-to-use JAASAuthenticationFeature so I registered it as
> a service intend. If I understand it right I can select the realm to use by
> setting the contextname of the feature but it is also possible to choose a
> specific group or user?
>
>
> Thanks
>
> Christian
>
>
> --
> *Von:* Christian Schneider 
> *Gesendet:* Freitag, 26. Oktober 2018 12:44:05
> *An:* user@aries.apache.org
> *Betreff:* Re: Aries RSA: securing exported services with ExportPolicy
>
> Any webservice exported using blueprint is accessible from remote. You
> will only not see it as a rsa remote service.
>
> What I meant is. Can you export your service using rsa but without an
> Export policy if you add the interceptor as a service property? I am not
> sure if this kind of interceptors work with the current cxf dosgi versions.
>
> In general the recommended practice for securing services is using a CXF
> feature and refer to it as an intent. For example the new CXF logging
> feature registers itself as an intent.
>
> https://github.com/apache/cxf/blob/master/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/osgi/Activator.java#L89-L90
>
> The rest example readme shows how to add such an intent to your service:
>
> https://github.com/apache/cxf-dosgi/blob/59e432afabb2a8f6a812b2a8f12cda68f4bfa775/samples/rest/README.md#add-logging-intent
> (Basically you simply add a service property "service.exported.intents"
> with your intent name as value).
>
> This way you could create a feature that adds the security interceptors
> and export it with intent name "mysecurity" and then add the service
> property above to all services that should be secured.
>
> The ExportPolicy is only needed if you want to add this property
> transparently to your services without touching them.
>
> Christian
>
> Am Fr., 26. Okt. 2018 um 12:27 Uhr schrieb Niehues, Christian <
> christian.nieh...@its-digital.de>:
>
>> It works if I define the service as CXF endpoint in blueprint. But if I
>> set it there it is not published as RSA endpoint and so it seems it's not
>> accessible from remote.
>>
>>
>> Christian
>>
>>
>> --
>> *Von:* Christian Schneider 
>> *Gesendet:* Donnerstag, 25. Oktober 2018 17:24:40
>> *An:* user@aries.apache.org
>> *Betreff:* Re: Aries RSA: securing exported services with ExportPolicy
>>
>> Does it work if you set the interceptor directly on the service?
>>
>> Christian
>>
>> Am Do., 25. Okt. 2018 um 08:57 Uhr schrieb Niehues, Christian <
>> christian.nieh...@its-digital.de>:
>>
>>> Hi,
>>>
>>>
>>> I try to export a service in my karaf to be able to process SOAP
>>> messages sent from remote client but I am facing problems to secure it. The
>>> documentation for Aries RSA about the TopologyManager notes that
>>> ExportPolicy implementations can be used to add authentication but I am
>>> missing further details.
>>>
>>>
>>> I tried to achieve it by adding an interceptor in my ExportPolicy but
>>> that seems not to help:
>>>
>>>
>>> props.put("service.exported.configs", "org.apache.cxf.ws");
>>> props.put("org.apache.cxf.ws.address", "http://192.168.1.100:9000/sync
>>> ");
>>> props.put("org.apache.cxf.ws.in.interceptors", "com.acme.MyInterceptor");
>>>
>>> com.acme.Myinterceptor extends
>>> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor
>>>
>>> I also tried to provide the Interceptor classname as List or
>>> String[] but that didn't work either, the interceptor never get's invoked
>>> when sending messages.
>>>
>>> So what I am doing wrong or is there any other/better way to secure a
>>> service provided by Aries RSA?
>>>
>>> Thanks,
>>>
>>> Christian
>>>
>>>
>>
>> --
>> --
>> Christian Schneider
>> http://www.liquid-reality.de
>>
>> Computer Scientist
>> http://www.adobe.com
>>
>>
>
> --
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Computer Scientist
> http://www.adobe.com
>
>

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

Computer Scientist
http://www.adobe.com


Re: Aries RSA: securing exported services with ExportPolicy

2018-11-02 Thread Christian Schneider
In plain CXF you can specify the endpoint address which can include an IP
Adress but there are no placeholders.
What do you try to achieve with a specific IP?

Christian

Am Fr., 2. Nov. 2018 um 09:56 Uhr schrieb Niehues, Christian <
christian.nieh...@its-digital.de>:

> Hi Christian,
>
>
> meanwhile I was also able to access a simple CXF endpoint from remote that
> has been defined in blueprint, including authorization and authentication.
> My only remaining problem with that solution is that I don't know how to
> define something like a placeholder for the address value to get a IP
> specific address. A placeholder definition value like {{hostIP}} doesn't
> seems to be replaced.
>
>
> Is there maybe another way to achieve this?
>
>
> Thanks
>
> Christian
>
>
> --
> Christian Niehues
> Tel.: +49 (0)221 820 07 27
>
> 
> ITS Digital Solutions GmbH
> Dillenburger Str. 77
> D-51105 Köln
> Tel.: +49 (0)221 820 07 0
> Fax : +49 (0)221 820 07 22 <%2B49%20%280%29221%20820%2007%2022>
> Mail: i...@its-digital.de 
> Web : http://www.its-digital.de <http://www.its-telco.de/>
> 
> Sitz der Gesellschaft: Dortmund
> Amtsgericht Dortmund, HRB 28563
> Geschäftsführer: Gunnar Haack, Ludger Schulte, Heinrich Toben, Raimund
> Schipp, Ralf Petersilka
> 
>
> Diese E-Mail enthält vertrauliche Informationen. Wenn Sie nicht der
> richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben,
> informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail.
> Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist
> nicht gestattet.
>
> This e-mail may contain confidential information. If you are not the
> intended recipient (or have received this e-mail in error) please notify
> the sender immediately and destroy this e-mail. Any unauthorised copying,
> disclosure or distribution of the material in this e-mail is strictly
> forbidden.
>
> --
> *Von:* Christian Schneider 
> *Gesendet:* Montag, 29. Oktober 2018 16:57:14
> *An:* user@aries.apache.org
> *Betreff:* Re: Aries RSA: securing exported services with ExportPolicy
>
> Hi Christian,
>
> the JAASAuthenticationFeature only does authentication.
> When deployed in karaf the default realm should be fine.
>
> For authorisation see e.g the SimpleAuthorizingInterceptor.
> http://cxf.apache.org/docs/securing-cxf-services.html
>
> Christian
>
> Am Mo., 29. Okt. 2018 um 09:42 Uhr schrieb Niehues, Christian <
> christian.nieh...@its-digital.de>:
>
>> I was not able to add an interceptor by setting a service property (I
>> used "org.apache.cxf.ws.in.interceptors").
>>
>>
>> But I followed your advice and tried to use a CXF feature. I noticed that
>> there is a ready-to-use JAASAuthenticationFeature so I registered it as
>> a service intend. If I understand it right I can select the realm to use by
>> setting the contextname of the feature but it is also possible to choose a
>> specific group or user?
>>
>>
>> Thanks
>>
>> Christian
>>
>>
>> --
>> *Von:* Christian Schneider 
>> *Gesendet:* Freitag, 26. Oktober 2018 12:44:05
>> *An:* user@aries.apache.org
>> *Betreff:* Re: Aries RSA: securing exported services with ExportPolicy
>>
>> Any webservice exported using blueprint is accessible from remote. You
>> will only not see it as a rsa remote service.
>>
>> What I meant is. Can you export your service using rsa but without an
>> Export policy if you add the interceptor as a service property? I am not
>> sure if this kind of interceptors work with the current cxf dosgi versions.
>>
>> In general the recommended practice for securing services is using a CXF
>> feature and refer to it as an intent. For example the new CXF logging
>> feature registers itself as an intent.
>>
>> https://github.com/apache/cxf/blob/master/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/osgi/Activator.java#L89-L90
>>
>> The rest example readme shows how to add such an intent to your service:
>>
>> https://github.com/apache/cxf-dosgi/blob/59e432afabb2a8f6a812b2a8f12cda68f4bfa775/samples/rest/README.md#add-logging-intent
>> (Basically you simply add a service property "service.exported.intents"
>> with your intent name as value).
>>
>> This way you could create a feature that adds the security interceptors
>> and exp

Re: Aries RSA: securing exported services with ExportPolicy

2018-11-02 Thread Christian Schneider
This is not necessary. In both cases (cxf blueprint namespace as well as
rsa) you can use a path like "/myservice".
This uses the servlet transport. In karaf it is provided by pax web.

Christian

Am Fr., 2. Nov. 2018 um 10:52 Uhr schrieb Niehues, Christian <
christian.nieh...@its-digital.de>:

> I want to be able to access the CXF endpoint from remote which is not
> possible if I use localhost or something like that. So I thought I have to
> set the address in relation to the IP of the machine its installed on. That
> was the reason I started to use Aries RSA and the ExportPolicy.
>
>
> Christian
>
> ------
> *Von:* Christian Schneider 
> *Gesendet:* Freitag, 2. November 2018 10:29:38
> *An:* user@aries.apache.org
> *Betreff:* Re: Aries RSA: securing exported services with ExportPolicy
>
> In plain CXF you can specify the endpoint address which can include an IP
> Adress but there are no placeholders.
> What do you try to achieve with a specific IP?
>
> Christian
>
> Am Fr., 2. Nov. 2018 um 09:56 Uhr schrieb Niehues, Christian <
> christian.nieh...@its-digital.de>:
>
>> Hi Christian,
>>
>>
>> meanwhile I was also able to access a simple CXF endpoint from
>> remote that has been defined in blueprint, including authorization and
>> authentication. My only remaining problem with that solution is that I
>> don't know how to define something like a placeholder for the address value
>> to get a IP specific address. A placeholder definition value like
>> {{hostIP}} doesn't seems to be replaced.
>>
>>
>> Is there maybe another way to achieve this?
>>
>>
>> Thanks
>>
>> Christian
>>
>>
>> --
>> Christian Niehues
>> Tel.: +49 (0)221 820 07 27
>>
>> 
>> ITS Digital Solutions GmbH
>> Dillenburger Str. 77
>> D-51105 Köln
>> Tel.: +49 (0)221 820 07 0
>> Fax : +49 (0)221 820 07 22 <%2B49%20%280%29221%20820%2007%2022>
>> Mail: i...@its-digital.de 
>> Web : http://www.its-digital.de <http://www.its-telco.de/>
>> 
>> Sitz der Gesellschaft: Dortmund
>> Amtsgericht Dortmund, HRB 28563
>> Geschäftsführer: Gunnar Haack, Ludger Schulte, Heinrich Toben, Raimund
>> Schipp, Ralf Petersilka
>> 
>>
>> Diese E-Mail enthält vertrauliche Informationen. Wenn Sie nicht der
>> richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben,
>> informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail.
>> Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist
>> nicht gestattet.
>>
>> This e-mail may contain confidential information. If you are not the
>> intended recipient (or have received this e-mail in error) please notify
>> the sender immediately and destroy this e-mail. Any unauthorised copying,
>> disclosure or distribution of the material in this e-mail is strictly
>> forbidden.
>>
>> --
>> *Von:* Christian Schneider 
>> *Gesendet:* Montag, 29. Oktober 2018 16:57:14
>> *An:* user@aries.apache.org
>> *Betreff:* Re: Aries RSA: securing exported services with ExportPolicy
>>
>> Hi Christian,
>>
>> the JAASAuthenticationFeature only does authentication.
>> When deployed in karaf the default realm should be fine.
>>
>> For authorisation see e.g the SimpleAuthorizingInterceptor.
>> http://cxf.apache.org/docs/securing-cxf-services.html
>>
>> Christian
>>
>> Am Mo., 29. Okt. 2018 um 09:42 Uhr schrieb Niehues, Christian <
>> christian.nieh...@its-digital.de>:
>>
>>> I was not able to add an interceptor by setting a service property (I
>>> used "org.apache.cxf.ws.in.interceptors").
>>>
>>>
>>> But I followed your advice and tried to use a CXF feature. I noticed
>>> that there is a ready-to-use JAASAuthenticationFeature so I registered
>>> it as a service intend. If I understand it right I can select the realm to
>>> use by setting the contextname of the feature but it is also possible to
>>> choose a specific group or user?
>>>
>>>
>>> Thanks
>>>
>>> Christian
>>>
>>>
>>> --
>>> *Von:* Christian Schneider 
>>> *Gesendet:* Freitag, 26. Oktober 2018 12:44:05
>>> *An:* user@aries.apache.org
>>> *Betreff:* Re: A

Re: Hardcoded port in fastbin provider

2018-11-15 Thread Christian Schneider
A default felix does not use the fileinstall bundle to read configuration.
So to be able to change any configurations you first need a working setup
of config admin and fileinstall.
As an example see:
https://github.com/cschneider/osgi-chat/blob/master/packaging/rsa.bndrun#L18-L23

Christian

Am Do., 15. Nov. 2018 um 15:26 Uhr schrieb "Jörn Schumann (
joern.schum...@hs-furtwangen.de)" :

> Hey Alex,
>
> yeah i tried it, maybe in a wrong way. I created the directory "etc/" in
> the root directory of my apache felix framework and added the configuration
> file with this line as content.
> Additionally i tried to set this value in the config file
> conf/config.properties, but always it uses the default port.
>
> Alex Weirig  hat am 15. November 2018 um 15:22
> geschrieben:
>
> Hi Jörn,
>
> have you tried setting the following property
>
> uri = tcp://0.0.0.0:2550
>
> in the
>
> org.apache.aries.rsa.provider.fastbin.cfg
>
> configuration file?
>
> That file shouldn't exist so you would have to create it.
>
> Hope this helps
>
>
> Mat frëndleche Gréiss,
> Mit freundlichen Grüßen,
> Meilleures salutations,
> Kind regards,Alex WeirigResponsable Technique
> Ville de Luxembourg
> Service Enseignement
> Centre Technolink
> *Tel* +352 4796 - 6127 <+35247966127>*Fax* +352 42 88 81*Email* 
> alex.wei...@technolink.luwww.vdl.lu // www.technolink.lu
>
> Centre Technolink
> 2, rue Charles de Tornaco
> L-2623 LUXEMBOURG
>
> On 15/11/2018 15:18, "Jörn Schumann ( joern.schum...@hs-furtwangen.de)"
> wrote:
>
> Hey,
>
> maybe i missunderstand it, but the port for your fastbin-provider is
> hardcoded in the Activator-Class or? So i can't get how i can change it
> dynamically in my apache felix osgi-framework.
>
> Greetings,
> Jörn
>
> --
> This email was Anti Virus checked by SOPHOS UTM
>
>
>
> Mit freundlichen Grüßen
>
> Jörn Schumann
> Fakultät Informatik/INM 2
> Matr.: 257134
>


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

Computer Scientist
http://www.adobe.com


Re: Hardcoded port in fastbin provider

2018-11-15 Thread Christian Schneider
This is where the uri is set:
https://github.com/apache/aries-rsa/blob/master/provider/fastbin/src/main/java/org/apache/aries/rsa/provider/fastbin/Activator.java#L51-L52
If your config is applied you should see the log message

> Binding Fastbin Server to tcp://0.0.0.0:2550

Does this show in your log?

Christian

Am Do., 15. Nov. 2018 um 15:42 Uhr schrieb Alex Weirig <
alex.wei...@technolink.lu>:

> Here's my config. Webconsole -> Status -> Configurations
>
> PID = org.apache.aries.rsa.provider.fastbin
>   BundleLocation = 
> mvn:org.apache.aries.rsa.provider/org.apache.aries.rsa.provider.fastbin/1.10.0
>   felix.fileinstall.filename = 
> file:/opt/apache-karaf-4.1.1/etc/org.apache.aries.rsa.provider.fastbin.cfg
>   service.pid = org.apache.aries.rsa.provider.fastbin
>   uri = tcp://0.0.0.0:2550
>
>
> Mat frëndleche Gréiss,
> Mit freundlichen Grüßen,
> Meilleures salutations,
> Kind regards,Alex WeirigResponsable Technique
> Ville de Luxembourg
> Service Enseignement
> Centre Technolink
> *Tel* +352 4796 - 6127 <+35247966127>*Fax* +352 42 88 81*Email* 
> alex.wei...@technolink.luwww.vdl.lu // www.technolink.lu
>
> Centre Technolink
> 2, rue Charles de Tornaco
> L-2623 LUXEMBOURG
>
> On 15/11/2018 15:37, "Jörn Schumann (joern.schum...@hs-furtwangen.de)"
> wrote:
>
> Config Admin is running. Maybe i use the wrong property-key. In the
> webconsole i can list all properties and there is the entry:
>
>
> org.apache.aries.rsa.provider.fastbin.cfg.uri = tcp://0.0.0.0:5000
>
>  Alex Weirig   hat
> am 15. November 2018 um 15:30 geschrieben:
>
> Hi Jörn,
>
> that's strange ... I'm using RSA with fastbin on multiple servers and this
> is what's working for me ... except I'm using Karaf not pure felix but it
> shouldn't matter other than Karaf already includes all the nice features
> that you might have to manually add in Felix.
>
> Since this is a config file, I wonder if Config Admin is installed by
> default into felix or if you have to add it.
>
>
>
>
> Mat frëndleche Gréiss,
> Mit freundlichen Grüßen,
> Meilleures salutations,
> Kind regards,Alex WeirigResponsable Technique
> Ville de Luxembourg
> Service Enseignement
> Centre Technolink
> *Tel* +352 4796 - 6127 <+35247966127>*Fax* +352 42 88 81*Email* 
> alex.wei...@technolink.luwww.vdl.lu // www.technolink.lu
>
> Centre Technolink
> 2, rue Charles de Tornaco
> L-2623 LUXEMBOURG
>
> On 15/11/2018 15:26, "Jörn Schumann ( joern.schum...@hs-furtwangen.de)"
> wrote:
>
> Hey Alex,
>
> yeah i tried it, maybe in a wrong way. I created the directory "etc/" in
> the root directory of my apache felix framework and added the configuration
> file with this line as content.
> Additionally i tried to set this value in the config file
> conf/config.properties, but always it uses the default port.
>
> Alex Weirig   hat
> am 15. November 2018 um 15:22 geschrieben:
>
> Hi Jörn,
>
> have you tried setting the following property
>
> uri = tcp://0.0.0.0:2550
>
> in the
>
> org.apache.aries.rsa.provider.fastbin.cfg
>
> configuration file?
>
> That file shouldn't exist so you would have to create it.
>
> Hope this helps
>
>
> Mat frëndleche Gréiss,
> Mit freundlichen Grüßen,
> Meilleures salutations,
> Kind regards,Alex WeirigResponsable Technique
> Ville de Luxembourg
> Service Enseignement
> Centre Technolink
> *Tel* +352 4796 - 6127 <+35247966127>*Fax* +352 42 88 81*Email* 
> alex.wei...@technolink.luwww.vdl.lu // www.technolink.lu
>
> Centre Technolink
> 2, rue Charles de Tornaco
> L-2623 LUXEMBOURG
>
> On 15/11/2018 15:18, "Jörn Schumann ( joern.schum...@hs-furtwangen.de)"
> wrote:
>
> Hey,
>
> maybe i missunderstand it, but the port for your fastbin-provider is
> hardcoded in the Activator-Class or? So i can't get how i can change it
> dynamically in my apache felix osgi-framework.
>
> Greetings,
> Jörn
>
> --
> This email was Anti Virus checked by SOPHOS UTM
>
>
>
> Mit freundlichen Grüßen
>
> Jörn Schumann
> Fakultät Informatik/INM 2
> Matr.: 257134
>
>
>
> Mit freundlichen Grüßen
>
> Jörn Schumann
> Fakultät Informatik/INM 2
> Matr.: 257134
>
>

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

Computer Scientist
http://www.adobe.com


Re: Coordination between spring JtaTransactionManager and Aries JPA

2018-12-05 Thread Christian Schneider
I also had the problem of combining jpa and camel transactions a while ago
and created an example and documentation for XA setup.
See:
https://github.com/Talend/tesb-rt-se/blob/master/examples/tesb/ebook/xa-docs.md
https://github.com/Talend/tesb-rt-se/tree/master/examples/tesb/ebook

Camel route:
https://github.com/Talend/tesb-rt-se/blob/master/examples/tesb/ebook/ebook-importer/src/main/java/org/talend/esb/examples/ebook/importer/ImportRoutes.java

The example reads from a xml file, parses each record into a jaxb bean and
sends the serialized bean to jms.
Then it reads from jms into a bean again and writes into a database using
jpa. This second flow coordinates a camel jms transaction and a jpa db
transaction using jta.

You can find the necessary jta setup in the camel context:
https://github.com/Talend/tesb-rt-se/blob/master/examples/tesb/ebook/ebook-connectionfactory/src/main/resources/OSGI-INF/blueprint/blueprint.xml

and the connection factory definition:
https://github.com/Talend/tesb-rt-se/blob/master/examples/tesb/ebook/ebook-importer/src/main/resources/OSGI-INF/blueprint/blueprint.xml

I think what is not mentioned in the example is that you have to setup an
xa ready datasource (at least I did not find it) using pax-jdbc.
See
https://ops4j1.jira.com/wiki/spaces/PAXJDBC/pages/119078914/Pooling+and+XA+support+in+1.0.0
https://ops4j1.jira.com/wiki/spaces/PAXJDBC/pages/61767716/Pooling+and+XA+support+for+DataSourceFactory

Cheers
Christian


Am Mi., 5. Dez. 2018 um 15:43 Uhr schrieb Niehues, Christian <
christian.nieh...@its-digital.de>:

> Hi,
>
> I have a server application running in karaf and I have problems to
> combine transactions defined in spring/camel and code having @Transactional
> annotation.
>
> In my blueprint.xml I have defined something like this:
>
> *interface="javax.transaction.TransactionManager" />*
> *interface="javax.transaction.UserTransaction" />*
>
> *class="org.springframework.transaction.jta.JtaTransactionManager">*
> *   *
> *   *
> *   *
>
> *class="org.apache.camel.spring.spi.SpringTransactionPolicy">*
> *   *
> *value="PROPAGATION_REQUIRES_NEW" />*
> *   *
>
> So I start a new transaction by using *PROPAGATION_REQUIRES_NEW *in a
> camel route. The camel route leads to a WebService endpoint. Anywhere in
> the underlying code where I use @Transactional and get a EntityManager
> injected I can see that the transaction is handled by a coordination from
> aries-jpa and gets committed by the uppermost @Transactional annotation.
> But I want that the underlying code uses the transaction created by the
> *PROPAGATION_REQUIRES_NEW* in the camel route so I am maybe able to
> rollback the transaction inside the camel route. How to achieve this? Do I
> have to use a TransactionManager from aries-jpa instead?
>
> Thanks in advance,
> Christian
>
>

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

Computer Scientist
http://www.adobe.com


Re: Coordination between spring JtaTransactionManager and Aries JPA

2018-12-06 Thread Christian Schneider
> I only still see some difference when using seda instead of direct in
camel routes, so there seems to be some issue when using different threads.
Yes. A transaction by default only works on the same thread.

Christian


Am Do., 6. Dez. 2018 um 14:46 Uhr schrieb Niehues, Christian <
christian.nieh...@its-digital.de>:

> Hi Christian,
>
>
> Thanks for the fast and detailed answer.
>
>
> I think I already used a XADatasource because of the properties set in my
> datasource configuration:
>
> pool=dbcp2
> xa=true
>
> Question about that: I saw you can also use pool=aries but when I try to
> use it I get no EntityManager. So do I have to change additional things?
>
>
> I think my problem was that I didn't use a pooled connectionfactory. Since
> I use XaPooledConnectionFactory like in your example it seems to work.
>
> I only still see some difference when using seda instead of direct in
> camel routes, so there seems to be some issue when using different threads.
>
> Also I need to check if it works when using cluster setup.
>
>
> Thanks
>
> Christian
>
> --
> *Von:* Christian Schneider 
> *Gesendet:* Mittwoch, 5. Dezember 2018 16:30:21
> *An:* user@aries.apache.org
> *Betreff:* Re: Coordination between spring JtaTransactionManager and
> Aries JPA
>
> I also had the problem of combining jpa and camel transactions a while ago
> and created an example and documentation for XA setup.
> See:
>
> https://github.com/Talend/tesb-rt-se/blob/master/examples/tesb/ebook/xa-docs.md
> https://github.com/Talend/tesb-rt-se/tree/master/examples/tesb/ebook
>
> Camel route:
>
> https://github.com/Talend/tesb-rt-se/blob/master/examples/tesb/ebook/ebook-importer/src/main/java/org/talend/esb/examples/ebook/importer/ImportRoutes.java
>
> The example reads from a xml file, parses each record into a jaxb bean and
> sends the serialized bean to jms.
> Then it reads from jms into a bean again and writes into a database using
> jpa. This second flow coordinates a camel jms transaction and a jpa db
> transaction using jta.
>
> You can find the necessary jta setup in the camel context:
>
> https://github.com/Talend/tesb-rt-se/blob/master/examples/tesb/ebook/ebook-connectionfactory/src/main/resources/OSGI-INF/blueprint/blueprint.xml
>
> and the connection factory definition:
>
> https://github.com/Talend/tesb-rt-se/blob/master/examples/tesb/ebook/ebook-importer/src/main/resources/OSGI-INF/blueprint/blueprint.xml
>
> I think what is not mentioned in the example is that you have to setup an
> xa ready datasource (at least I did not find it) using pax-jdbc.
> See
>
> https://ops4j1.jira.com/wiki/spaces/PAXJDBC/pages/119078914/Pooling+and+XA+support+in+1.0.0
>
> https://ops4j1.jira.com/wiki/spaces/PAXJDBC/pages/61767716/Pooling+and+XA+support+for+DataSourceFactory
>
> Cheers
> Christian
>
>
> Am Mi., 5. Dez. 2018 um 15:43 Uhr schrieb Niehues, Christian <
> christian.nieh...@its-digital.de>:
>
>> Hi,
>>
>> I have a server application running in karaf and I have problems to
>> combine transactions defined in spring/camel and code having @Transactional
>> annotation.
>>
>> In my blueprint.xml I have defined something like this:
>>
>> *   > interface="javax.transaction.TransactionManager" />*
>> *   > interface="javax.transaction.UserTransaction" />*
>>
>> *   > class="org.springframework.transaction.jta.JtaTransactionManager">*
>> *   *
>> *   *
>> *   *
>>
>> *   > class="org.apache.camel.spring.spi.SpringTransactionPolicy">*
>> *   *
>> *   > value="PROPAGATION_REQUIRES_NEW" />*
>> *   *
>>
>> So I start a new transaction by using *PROPAGATION_REQUIRES_NEW *in a
>> camel route. The camel route leads to a WebService endpoint. Anywhere in
>> the underlying code where I use @Transactional and get a EntityManager
>> injected I can see that the transaction is handled by a coordination from
>> aries-jpa and gets committed by the uppermost @Transactional annotation.
>> But I want that the underlying code uses the transaction created by the
>> *PROPAGATION_REQUIRES_NEW* in the camel route so I am maybe able to
>> rollback the transaction inside the camel route. How to achieve this? Do I
>> have to use a TransactionManager from aries-jpa instead?
>>
>> Thanks in advance,
>> Christian
>>
>>
>
> --
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Computer Scientist
> http://www.adobe.com
>
>

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

Computer Scientist
http://www.adobe.com


Re: Coordination between spring JtaTransactionManager and Aries JPA

2018-12-11 Thread Christian Schneider
I never tested doing distributed transactions but in literature the common
sense is that it sucks.

Christian

Am Di., 11. Dez. 2018 um 13:54 Uhr schrieb Niehues, Christian <
christian.nieh...@its-digital.de>:

> And what would a transaction solution look like if the work is spread over
> different nodes in a cluster?
>
>
> Christian
>
> ------
> *Von:* Christian Schneider 
> *Gesendet:* Donnerstag, 6. Dezember 2018 17:07:48
> *An:* user@aries.apache.org
> *Betreff:* Re: Coordination between spring JtaTransactionManager and
> Aries JPA
>
> > I only still see some difference when using seda instead of direct in
> camel routes, so there seems to be some issue when using different threads.
> Yes. A transaction by default only works on the same thread.
>
> Christian
>
>
> Am Do., 6. Dez. 2018 um 14:46 Uhr schrieb Niehues, Christian <
> christian.nieh...@its-digital.de>:
>
>> Hi Christian,
>>
>>
>> Thanks for the fast and detailed answer.
>>
>>
>> I think I already used a XADatasource because of the properties set in my
>> datasource configuration:
>>
>> pool=dbcp2
>> xa=true
>>
>> Question about that: I saw you can also use pool=aries but when I try to
>> use it I get no EntityManager. So do I have to change additional things?
>>
>>
>> I think my problem was that I didn't use a pooled connectionfactory.
>> Since I use XaPooledConnectionFactory like in your example it seems to
>> work.
>>
>> I only still see some difference when using seda instead of direct in
>> camel routes, so there seems to be some issue when using different threads.
>>
>> Also I need to check if it works when using cluster setup.
>>
>>
>> Thanks
>>
>> Christian
>>
>> --
>> *Von:* Christian Schneider 
>> *Gesendet:* Mittwoch, 5. Dezember 2018 16:30:21
>> *An:* user@aries.apache.org
>> *Betreff:* Re: Coordination between spring JtaTransactionManager and
>> Aries JPA
>>
>> I also had the problem of combining jpa and camel transactions a while
>> ago and created an example and documentation for XA setup.
>> See:
>>
>> https://github.com/Talend/tesb-rt-se/blob/master/examples/tesb/ebook/xa-docs.md
>> https://github.com/Talend/tesb-rt-se/tree/master/examples/tesb/ebook
>>
>> Camel route:
>>
>> https://github.com/Talend/tesb-rt-se/blob/master/examples/tesb/ebook/ebook-importer/src/main/java/org/talend/esb/examples/ebook/importer/ImportRoutes.java
>>
>> The example reads from a xml file, parses each record into a jaxb bean
>> and sends the serialized bean to jms.
>> Then it reads from jms into a bean again and writes into a database using
>> jpa. This second flow coordinates a camel jms transaction and a jpa db
>> transaction using jta.
>>
>> You can find the necessary jta setup in the camel context:
>>
>> https://github.com/Talend/tesb-rt-se/blob/master/examples/tesb/ebook/ebook-connectionfactory/src/main/resources/OSGI-INF/blueprint/blueprint.xml
>>
>> and the connection factory definition:
>>
>> https://github.com/Talend/tesb-rt-se/blob/master/examples/tesb/ebook/ebook-importer/src/main/resources/OSGI-INF/blueprint/blueprint.xml
>>
>> I think what is not mentioned in the example is that you have to setup an
>> xa ready datasource (at least I did not find it) using pax-jdbc.
>> See
>>
>> https://ops4j1.jira.com/wiki/spaces/PAXJDBC/pages/119078914/Pooling+and+XA+support+in+1.0.0
>>
>> https://ops4j1.jira.com/wiki/spaces/PAXJDBC/pages/61767716/Pooling+and+XA+support+for+DataSourceFactory
>>
>> Cheers
>> Christian
>>
>>
>> Am Mi., 5. Dez. 2018 um 15:43 Uhr schrieb Niehues, Christian <
>> christian.nieh...@its-digital.de>:
>>
>>> Hi,
>>>
>>> I have a server application running in karaf and I have problems to
>>> combine transactions defined in spring/camel and code having @Transactional
>>> annotation.
>>>
>>> In my blueprint.xml I have defined something like this:
>>>
>>> *   >> interface="javax.transaction.TransactionManager" />*
>>> *   >> interface="javax.transaction.UserTransaction" />*
>>>
>>> *   >> class="org.springframework.transaction.jta.JtaTransactionManager">*
>>> *   *
>>> *   *
>>> *   *
>>>
>>> *   >> class="org.apache.camel.spring.spi.SpringTransactionPolicy">*
>>> *   *
>>> *  

Re: Bundles waiting for JPATemplate service on Apache Karaf startup

2018-12-20 Thread Christian Schneider
I also think this might be related to deleting the bundle cache while the
system still runs. If you want a clean startup then you should delete the
karaf data dir while the system is stopped. This also deletes the installed
karaf features though. So to get your system up automatically you must
configure your features as boot features.

If you save all your configs in the etc dir then deleting the data dir will
still preserve configuration.

Christian

Am Mi., 19. Dez. 2018 um 12:44 Uhr schrieb Dheeraj Guntupalli <
reindh...@gmail.com>:

> Hello All,
>
> We are using Karaf 4.1.7, aries-jpa 2.7.0, h2 db in our application. We
> use multiple persistence units, multiple h2 db files within our
> application. We observed that when we have multiple h2 db files, and when
> we restart Karaf after deleting the bundle cache a couple or more times we
> see this issue "Waiting for JpaTemplate".
>
> We are able to reproduce this issue frequently, and when this issue
> occurs, the JPA Template services are missing in the OSGi service registry.
> We feel it is related to bundle/service startup/registration timing. Once
> the bundle cache is built and it works, it will also work on subsequent
> startups as long as the bundle cache isn’t deleted.
>
> The persistence bundle creates the JpaTemplate service by providing the
> persistence unit, but also consumes it in the DAO services. Possibly the
> required waiting time before the input data sources become available can
> trigger the issue.
>
>  Has anyone faced this issue earlier, or could give any pointers on how
> to resolve this. Please let us know if you need more info.
>
>
> Thanks & regards,
>
> Dheeraj
>


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

Computer Scientist
http://www.adobe.com


Re: Bundle startup order timing impacts JpaTemplate service registration

2019-04-03 Thread Christian Schneider
Can you provide example code for this behaviour?

Christian

Am Mi., 3. Apr. 2019 um 07:13 Uhr schrieb Dheeraj Guntupalli <
reindh...@gmail.com>:

> Hello All,
>
> This is in continuation to the previous post below, some how unable to
> reply to that post directly and created a new post.
>
>
> http://mail-archives.apache.org/mod_mbox/aries-user/201812.mbox/%3Cb2f0a69a-5e6b-d77b-6386-46aaeec5e5a5%40googlemail.com%3E
>
>
>
> We have separate databases db1 and db2, and db1 has two schemas schema1,
> schema2, and db2 has just one schema. We have separate persistent units
> (bundles) for each schema. When we deploy this for the first time we
> observed that we are not able to get JPATemplate service for db1, but for
> db2 the service is working fine. This occurs frequently i.e. if we deploy
> this for the first time, we are able to reproduce the issue 5 out of 10
> times.
>
>
>
> We observed that if component1 references this JpaTemplate service, and
> component2 references component1, and component2 activate method operation
> takes time, we see that JpaTemplate for the remaining two persistent units
> are not registered. This occurs 4 out of 10 times.
>
>
>
> When we removed this operation inside component2 activate method, we are
> able to see the JpaTemplate services registered for all three persistent
> units.
>
>
>
> So it appears that the bundle startup order/timing has an impact on
> provisioning of the JpaTemplate services – which it shouldn’t. Is this
> observed by others too? And how to resolve this?
>
>
>
> Thanks & Regards,
>
> Dheeraj
>
>

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

Computer Scientist
http://www.adobe.com


Re: Question on helloworld blueprint tutorial

2019-07-06 Thread Christian Schneider
The blueprint tutorial on the aries site is quite ancient.

You can see my tutorial here: http://liquid-reality.de/Karaf-Tutorial/01/

I also recommend to use declarative services instead of blueprint. It is
much simpler to use.
See http://liquid-reality.de/Karaf-Tutorial/10/

Christian


Am Sa., 6. Juli 2019 um 21:27 Uhr schrieb Robin Clark :

> I am following the instructions on this page:
> https://aries.apache.org/documentation/tutorials/blueprinthelloworldtutorial.html
>
> In the section "Running the code", I have started the Equinox based
> platform that contains all of the OSGi bundles by running "java -jar osgi-
> 3.5.0.v20090520.jar -console".  I get the osgi> prompt, but my output is
> slightly different when I type "ss":
>
> osgi> ss
>
> Framework is launched.
>
> id  State   Bundle
> 0   ACTIVE  org.eclipse.osgi_3.5.0.v20090520
> 1   ACTIVE  org.eclipse.equinox.cm_3.2.0.v20070116
> 2   ACTIVE  org.eclipse.osgi.services_3.1.200.v20070605
> 3   ACTIVE  org.objectweb.asm.all_3.2.0
> 4   INSTALLED   org.apache.aries.proxy_1.0.0
> 5   ACTIVE  org.apache.aries.util_1.0.0
> 6   INSTALLED   org.apache.aries.blueprint_1.0.0
> 7   RESOLVED
>  org.apache.aries.samples.blueprint.helloworld.api_1.0.1.SNAPSHOT
> 8   INSTALLED
> org.apache.aries.samples.blueprint.helloworld.server_1.0.1.SNAPSHOT
> 9   INSTALLED
> org.apache.aries.samples.blueprint.helloworld.client_1.0.1.SNAPSHOT
>
> osgi>
>
> When I type "start 6" at the osgi prompt I receive the following error
> messages:
>
> osgi> start 6
> org.osgi.framework.BundleException: The bundle could not be resolved.
> Reason: Missing Constraint: Import-Package: org.apache.aries.proxy;
> version="[1.0.0,2.0.0)"
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolverError(AbstractBundle.java:1313)
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.getResolutionFailureException(AbstractBundle.java:1297)
> at
> org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:309)
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280)
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:272)
> at
> org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start(FrameworkCommandProvider.java:253)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at
> org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:155)
> at
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:303)
> at
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.console(FrameworkConsole.java:288)
> at
> org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:224)
> at java.lang.Thread.run(Unknown Source)
>
> osgi>
>
> What do I need in order to get past this error and proceed with the
> tutorial?
>
>
>
>

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

Computer Scientist
http://www.adobe.com


Re: Transaction problem in Karaf when switching from dbcp2 connection pool to c3p0

2019-07-23 Thread Christian Schneider
How do you setup the data source? You need to provide a DataSource that
wraps a XADataSource and does auto enlistment. Do you use pax-jdbc for this?

Christian

Am Mo., 22. Juli 2019 um 15:52 Uhr schrieb Niehues, Christian <
christian.nieh...@its-digital.de>:

> Hello,
>
>
> I have deployed an application in my Karaf 4.1.5 using JMS, Camel,
> Hibernate, Aries Transaction Manager and PAX JDBC Pool.
>
>
> Everything works fine except when I process parallel requests where I
> sometimes get a SQLException from dbcp class ManagedConnection reporting 
> "Connection
> can not be used while enlisted in another transaction" and the request
> fails.
>
> After some analyses I came to the assumption that it is maybe related to
> the fact that Hibernate doesn't support a ConnectionProvider for dbcp.
>
>
> So I switch the connection pool to c3p0 which is supported by Hibernate.
> But here I face another problem just for a single request: some DB
> operations get executed before the transaction commits so I am also unable
> to rollback everything on exception. It seems that all flushes initiated by
> Hibernate directly go into the DB.
>
>
> So I assume that anything with the transaction
> synchronisation/coordination is wrong. The transactional context is defined
> by a @Transactional annotation. From debugging I can see that the
> AriesPlatformTransactionManager and the C3p0PooledDatasourceFactory is
> involved. Do you have any hint what could cause this problem or how can I
> can I do more depth analyses?
>
>
> Thanks in advice,
>
> Christian
>
>

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

Computer Scientist
http://www.adobe.com


Problem with JPA user bundle not finding EntityManagerFactory. Property org.apache.aries.jpa.proxy.factory=true missing

2012-01-13 Thread Christian Schneider

Hi all,

I have a problem with Aries JPA and OpenJPA.

My bundle uses container managed persistence. It defines a 
persistence.xml and it is picked up by the aries jpa container which 
published a service for the EntitiyManagerFactory.


I inject the EntityManager using blueprint like in the Trader example.

The problem is that the blueprint integration looks for another OSGi 
service than the container provides.


This is what the bundle searches for:

2012-01-13 09:02:21,001 | INFO  | rint Extender: 3 | 
BlueprintContainerImpl   | container.BlueprintContainerImpl  305 
| 9 - org.apache.aries.blueprint - 0.3.1 | Bundle db-examplejpa is 
waiting for dependencies [(&(&(org.apache.aries

.jpa.proxy.factory=true)(osgi.unit.name=person))(objectClass=javax.persistence.EntityManagerFactory))]


And this is what the bundle provides:
db-examplejpa (68) provides:

objectClass = javax.persistence.EntityManagerFactory
org.apache.aries.jpa.container.managed = true
org.apache.aries.jpa.default.unit.name = false
osgi.unit.name = person
osgi.unit.provider = org.apache.openjpa.persistence.PersistenceProviderImpl
osgi.unit.version = 2.1.1
service.id = 216
-

So it seem the property "org.apache.aries.jpa.proxy.factory=true" is 
missing. So the service can not be bound.


Any ideas how I can solve this?


Here is my complete project:
https://github.com/cschneider/Karaf-Tutorial/tree/master/db/examplejpa

Christian

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

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



Re: Problem with JPA user bundle not finding EntityManagerFactory. Property org.apache.aries.jpa.proxy.factory=true missing

2012-01-13 Thread Christian Schneider

Just found it.

I only had the jpa container bundle installed while I also needed the 
container.context bundle.

Now my bundle shows status created.

Btw. I think there should also be a non eba deployment of the 
ariestrader example. I would prefer a feature.


Christian


Am 13.01.2012 09:07, schrieb Christian Schneider:

Hi all,

I have a problem with Aries JPA and OpenJPA.

My bundle uses container managed persistence. It defines a 
persistence.xml and it is picked up by the aries jpa container which 
published a service for the EntitiyManagerFactory.


I inject the EntityManager using blueprint like in the Trader example.

The problem is that the blueprint integration looks for another OSGi 
service than the container provides.


This is what the bundle searches for:

2012-01-13 09:02:21,001 | INFO  | rint Extender: 3 | 
BlueprintContainerImpl   | container.BlueprintContainerImpl  
305 | 9 - org.apache.aries.blueprint - 0.3.1 | Bundle db-examplejpa is 
waiting for dependencies [(&(&(org.apache.aries
.jpa.proxy.factory=true)(osgi.unit.name=person))(objectClass=javax.persistence.EntityManagerFactory))] 




And this is what the bundle provides:
db-examplejpa (68) provides:

objectClass = javax.persistence.EntityManagerFactory
org.apache.aries.jpa.container.managed = true
org.apache.aries.jpa.default.unit.name = false
osgi.unit.name = person
osgi.unit.provider = 
org.apache.openjpa.persistence.PersistenceProviderImpl

osgi.unit.version = 2.1.1
service.id = 216
-

So it seem the property "org.apache.aries.jpa.proxy.factory=true" is 
missing. So the service can not be bound.


Any ideas how I can solve this?


Here is my complete project:
https://github.com/cschneider/Karaf-Tutorial/tree/master/db/examplejpa

Christian




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

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



Problem using the jmx whiteboard to create a MBean -- MBean class Proxyaaaf7dc3_99e0_4e6d_a856_3c442bfe30ed does not implement DynamicMBean

2012-04-03 Thread Christian Schneider

Hi All,

I started using the aries jmx whiteboard bundle to register mbeans for 
Apache Karaf.


When I register the service for the mbean the whiteboard bundle picks up 
my mbean but then the following eception occurs:


2012-04-03 16:14:23,601 | ERROR | l Console Thread | 
MBeanHolder  | aries.jmx.whiteboard.MBeanHolder   63 
| 75 - org.apache.aries.jmx.whiteboard - 0.3.0 | register: Failure 
registering MBean org.apach

e.karaf.packages.core.internal.Packages@1b6d56
javax.management.NotCompliantMBeanException: MBean class 
Proxyaaaf7dc3_99e0_4e6d_a856_3c442bfe30ed does not implement 
DynamicMBean, neither follows the Standard MBean conventions 
(javax.management.NotCompliantMBeanExcept
ion: Class Proxyaaaf7dc3_99e0_4e6d_a856_3c442bfe30ed is not a JMX 
compliant Standard MBean) nor the MXBean conventions 
(javax.management.NotCompliantMBeanException: 
Proxyaaaf7dc3_99e0_4e6d_a856_3c442bfe30ed: Class Proxya

aaf7dc3_99e0_4e6d_a856_3c442bfe30ed is not a JMX compliant MXBean)


It looks like blueprint creates a proxy of my mbean which then can not 
be registered as an mbean.

Any ideas what I can do?

Christian



So my blueprint.xml looks like this:
---


class="org.apache.karaf.packages.core.internal.PackageServiceImpl">



ref="packageService"/>


class="org.apache.karaf.packages.core.internal.Packages">




ref="packageMBean">


value="org.apache.karaf:type=package,name=${karaf.name}"/>



---



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

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



Re: Problem using the jmx whiteboard to create a MBean -- MBean class Proxyaaaf7dc3_99e0_4e6d_a856_3c442bfe30ed does not implement DynamicMBean

2012-04-03 Thread Christian Schneider

I forgot to mention my versions:

karaf@root> list -t 0 -s| grep aries
[  13] [Active] [   20] org.apache.aries.proxy.impl (0.4.1.SNAPSHOT)
[  14] [Active] [   20] org.apache.aries.blueprint.api (0.3.1)
[  15] [Active] [   20] org.apache.aries.util (0.5.0.SNAPSHOT)
[  16] [Active] [   20] org.apache.aries.proxy.api (0.4.0)
[  17] [Active] [   20] org.apache.aries.blueprint.core 
(0.4.1.SNAPSHOT) Fragments: 18
[  18] [  Resolved] [   20] 
org.apache.aries.blueprint.core.compatibility (0.4.1.SNAPSHOT) Hosts: 17

[  19] [Active] [   20] org.apache.aries.blueprint.cm (0.3.3.SNAPSHOT)
[  37] [Active] [   30] org.apache.aries.quiesce.api (0.3.0)
[  72] [Active] [   30] org.apache.aries.jmx.api (0.3.0)
[  73] [Active] [   30] org.apache.aries.jmx.core (0.3.0)
[  74] [Active] [   30] org.apache.aries.jmx.blueprint (0.3.0)
[  75] [Active] [   30] org.apache.aries.jmx.whiteboard (0.3.0)


Am 03.04.2012 16:32, schrieb Christian Schneider:

Hi All,

I started using the aries jmx whiteboard bundle to register mbeans for 
Apache Karaf.


When I register the service for the mbean the whiteboard bundle picks 
up my mbean but then the following eception occurs:


2012-04-03 16:14:23,601 | ERROR | l Console Thread | 
MBeanHolder  | aries.jmx.whiteboard.MBeanHolder   
63 | 75 - org.apache.aries.jmx.whiteboard - 0.3.0 | register: Failure 
registering MBean org.apach

e.karaf.packages.core.internal.Packages@1b6d56
javax.management.NotCompliantMBeanException: MBean class 
Proxyaaaf7dc3_99e0_4e6d_a856_3c442bfe30ed does not implement 
DynamicMBean, neither follows the Standard MBean conventions 
(javax.management.NotCompliantMBeanExcept
ion: Class Proxyaaaf7dc3_99e0_4e6d_a856_3c442bfe30ed is not a JMX 
compliant Standard MBean) nor the MXBean conventions 
(javax.management.NotCompliantMBeanException: 
Proxyaaaf7dc3_99e0_4e6d_a856_3c442bfe30ed: Class Proxya

aaf7dc3_99e0_4e6d_a856_3c442bfe30ed is not a JMX compliant MXBean)


It looks like blueprint creates a proxy of my mbean which then can not 
be registered as an mbean.

Any ideas what I can do?

Christian



So my blueprint.xml looks like this:
---


class="org.apache.karaf.packages.core.internal.PackageServiceImpl">



ref="packageService"/>


class="org.apache.karaf.packages.core.internal.Packages">




ref="packageMBean">


value="org.apache.karaf:type=package,name=${karaf.name}"/>



---






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

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



Re: Question about Blueprint Service and Bundle loading

2012-04-20 Thread Christian Schneider
I don´t think that you can influence this... and honestly I don´t think 
you should.


The clean way of loading impl classes for the service would be to offer 
two impls of a Factory interface as an OSGi service. So you could define 
the interfaces at one point and let the Factory service in Bundle1 load 
the classes from bundle 1 and the Factory service in Bundle2 load those 
in Bundle2.


Christian

Am 20.04.2012 13:43, schrieb Charles Moulliard:

Hi,

I would like to know if this is possible for a bundle to know based on 
info defined in the OSGI Service registered in the OSGI Registry that 
it must loads package by example com.mycompany.poc.service.Feedback 
from a bundle A and not bundle B when its service definition contain a 
reference to a specific filter ?


Bundle 1







Bundle 2







Bundle 3 = Client consuming service



filter="(version=1)"/>




Here is the definition of the Bundle 3 Manifest

Import-Service =
com.xtrac.poc.service.Feedback

DynamicImport-Package =
com.xtrac.poc.service

This definition tells the bundle that it has do dynamically loads 
classes but in this case, the OSGI runtime will load classes from 
maybe Bundle A or bundle B.


Regards,

Charles Moulliard

Apache Committer

Blog : http://cmoulliard.blogspot.com
Twitter : http://twitter.com/cmoulliard
Linkedin : http://www.linkedin.com/in/charlesmoulliard
Skype: cmoulliard



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

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



Re: Question about Blueprint Service and Bundle loading

2012-04-20 Thread Christian Schneider
I understand what you mean but I think dynamic import is already a bad 
thing and loading different classes depending on service impl would only 
make it more complex but not really cleaner.


So the question is if your problem could perhaps be solved cleanly with 
the current OSGi features.


Can you influence how the bundles 1 and 2 work? If yes then why let the 
service consumer create the objects? A factory implemented in bundle 1 
and bundle 2 sounds like a much better solution to me. You would then 
not even need the dynamic import. Of course I may completely 
misunderstand what you try to do.


Can you explain in more details how the bundles 1 and 2 work and what 
the client has to do?


Christian


Am 20.04.2012 16:08, schrieb Charles Moulliard:
Bundle 1 and Bundle 2 export correctly the packages. This is simply 
the client which is not able to loads the classes according to the 
interface name only as we have 2 different implementations. When the 
bundle client starts, its classloader has to load the classes from 
bundle 1 or bundle 2. As we are using DynamicImport, this is not done 
at the starting up of the bundle but when the bean is instantiated by 
blueprint. Nevertheless, we have no possibilities today to tell using 
DynamicImport that it must loads classes implemented in Bundle 1 or 
Bundle 2 depending on info provided in the filter=""/> and the filter. That should be a great improvement of OSGI 
+ Blueprint if we could have that. That will allow us to really design 
/ use OSGI as a modular platform.


On Fri, Apr 20, 2012 at 3:37 PM, Christian Schneider 
mailto:ch...@die-schneider.net>> wrote:


I don´t think that you can influence this... and honestly I don´t
think you should.

The clean way of loading impl classes for the service would be to
offer two impls of a Factory interface as an OSGi service. So you
could define the interfaces at one point and let the Factory
service in Bundle1 load the classes from bundle 1 and the Factory
service in Bundle2 load those in Bundle2.

Christian

Am 20.04.2012 13:43, schrieb Charles Moulliard:

Hi,

I would like to know if this is possible for a bundle to know
based on info defined in the OSGI Service registered in the OSGI
Registry that it must loads package by example
com.mycompany.poc.service.Feedback from a bundle A and not bundle
B when its service definition contain a reference to a specific
filter ?

Bundle 1







Bundle 2







Bundle 3 = Client consuming service







Here is the definition of the Bundle 3 Manifest

Import-Service =
com.xtrac.poc.service.Feedback

DynamicImport-Package =
com.xtrac.poc.service

This definition tells the bundle that it has do dynamically loads
classes but in this case, the OSGI runtime will load classes from
maybe Bundle A or bundle B.

Regards,

Charles Moulliard

Apache Committer

Blog : http://cmoulliard.blogspot.com
Twitter : http://twitter.com/cmoulliard
Linkedin : http://www.linkedin.com/in/charlesmoulliard
Skype: cmoulliard



    -- 
Christian Schneider

http://www.liquid-reality.de

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






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

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



Re: Blueprint service dependencies

2012-04-20 Thread Christian Schneider

I think having a
Import-Service: javax.sql.DataSource
in the Manifest. The maven bundle plugin should do this.

So blueprint will make sure the service is there.

Christian

 Am 19.04.2012 17:34, schrieb Brunner Basil:

Hi

I have two OSGi bundles The first one contains only a Blueprint data source 
definition:


http://www.osgi.org/xmlns/blueprint/v1.0.0";>

   
 
   

   
 
   
 
   




The second bundle contains a JPA persistence file and a blueprint file:


http://java.sun.com/xml/ns/persistence";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; version="1.0">

   
 org.apache.openjpa.persistence.PersistenceProviderImpl
 
osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/database)
 ch.entwine.captureagent.scheduler.RecordingEvent
 ch.entwine.captureagent.config.ConfigOption
 ch.entwine.captureagent.felix.configadmin.ConfigurationData
 true
   



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.0.0"; 
xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0";>

   
 
 
   

   



I ran into the problem that the data source is not yet registered when the JPA 
entity manager tries to get a reference to it. Error message:

2012-04-19 16:17:38 ERROR (DelayedLookupDataSource:57) No JTA datasource could 
be located using the JNDI name 
osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/database)
javax.naming.NameNotFoundException: 
osgi:service/javax.sql.DataSource/"(osgi.jndi.service.name=jdbc/database)"

I've now tried to set the 'depends-on' attribute on the SchedulerService 
definition in the blueprint file of bundle two (see above). Unfortunately I get 
the following error now:

17:19:09 ERROR (BlueprintContainerImpl:348) Unable to start blueprint container 
for bundle ch.entwine.matterhorn.core
org.osgi.service.blueprint.container.ComponentDefinitionException: Unresolved 
ref/idref to component: dataSource

So, my question is how I can make sure the data source gets registered before 
the JPA entity manager gets started?


Thanks for your help!



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

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



Re: Question about Blueprint Service and Bundle loading

2012-04-20 Thread Christian Schneider
If you reference the service with a filter then OSGi will inject the 
correct impl object. You will not even need to have a dynamic import as 
the impl is installed by the bundle1.


So this should simply work. What exception do you get?

Christian

Am 20.04.2012 17:55, schrieb Charles Moulliard:
Bundle 1 and Bundle 2 contain a different implementation of the 
interface which is exposed as OSGI service


Bundle 1









Bundle 2

class="com. mycompany.poc.service.impl.FeedbackTeamDB"/>








So the bundle C do an OSGI lookup to retrieve using as key the 
interface name "com.mycompany.poc.service.Feedback", the class 
implemented in bundle 1 or bundle 2.


What would be great is that the bundle C when the following bean is 
instantiated loads the class from the bundle 1 as the filter of the 
reference to be found corresponds to it



filter="(version=1)"/>



Intrinsically we know that the class implementing this interface 
belongs to bundle 1 as filter = 1 = OSGI service exposed by bundle 1 = 
class = com.mycompany.poc.service.impl.FeedbackTeamWS




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

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



Re: Question about Blueprint Service and Bundle loading

2012-04-20 Thread Christian Schneider
Do you perhaps have the interface HelloBean in both bundles? If yes then 
you should extract it to a separate interface bundle.


Christian

Am 20.04.2012 18:23, schrieb Charles Moulliard:


e-03-06 | Error processing exchange. Exchange[Message: [Body is 
null]]. Caused by: [java.lang.IllegalArgumentException - 
java.lang.ClassCastException@2bd040e8]

java.lang.IllegalArgumentException: java.lang.ClassCastException@2bd040e8
at sun.reflect.GeneratedMethodAccessor85.invoke(Unknown Source)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_31]

at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_31]
at org.apache.aries.proxy.impl.ProxyHandler$1.invoke(ProxyHandler.java:50)
at 
org.apache.aries.proxy.impl.DefaultWrapper.invoke(DefaultWrapper.java:31)

at org.apache.aries.proxy.impl.ProxyHandler.invoke(ProxyHandler.java:78)
at $Proxy83.sayHello(Unknown Source)
at 
com.mycompany.poc.client.HelloBean.sayHello(HelloBean.java:10)[216:route:1.0.0]


On Fri, Apr 20, 2012 at 6:17 PM, Christian Schneider 
mailto:ch...@die-schneider.net>> wrote:


If you reference the service with a filter then OSGi will inject
the correct impl object. You will not even need to have a dynamic
import as the impl is installed by the bundle1.

So this should simply work. What exception do you get?

Christian

Am 20.04.2012 17:55, schrieb Charles Moulliard:

Bundle 1 and Bundle 2 contain a different implementation of the
interface which is exposed as OSGI service

Bundle 1









Bundle 2









So the bundle C do an OSGI lookup to retrieve using as key the
interface name "com.mycompany.poc.service.Feedback", the class
implemented in bundle 1 or bundle 2.

What would be great is that the bundle C when the following bean
is instantiated loads the class from the bundle 1 as the filter
of the reference to be found corresponds to it





Intrinsically we know that the class implementing this interface
belongs to bundle 1 as filter = 1 = OSGI service exposed by
bundle 1 = class = com.mycompany.poc.service.impl.FeedbackTeamWS



-- 
Christian Schneider

http://www.liquid-reality.de

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






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

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



Re: Aries JPA with JTA Transactions

2012-04-28 Thread Christian Schneider
che.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:729)[org.apache.felix.framework-3.0.9.jar:]
   at 
org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:610)[org.apache.felix.framework-3.0.9.jar:]
   at 
org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:3761)[org.apache.felix.framework-3.0.9.jar:]
   at 
org.apache.felix.framework.Felix.access$600(Felix.java:80)[org.apache.felix.framework-3.0.9.jar:]
   at 
org.apache.felix.framework.Felix$FelixResolver.fireResolvedEvents(Felix.java:4299)[org.apache.felix.framework-3.0.9.jar:]
   at 
org.apache.felix.framework.Felix$FelixResolver.resolve(Felix.java:4065)[org.apache.felix.framework-3.0.9.jar:]
   at 
org.apache.felix.framework.Felix.resolveBundle(Felix.java:3439)[org.apache.felix.framework-3.0.9.jar:]
   at 
org.apache.felix.framework.Felix.startBundle(Felix.java:1734)[org.apache.felix.framework-3.0.9.jar:]
   at 
org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1163)[org.apache.felix.framework-3.0.9.jar:]
   at 
org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)[org.apache.felix.framework-3.0.9.jar:]



And it's crazy weird, because then my model bundle status is ACTIVE,
even though it failed to really start.
So, of course, my service won't start, b/c model bundle never finished
it's JPA stuff and it never got Aries to export an Entity Manager
Factory for it
I've actually lost track of everything I've tried.  I started out with
wanting to have a clean model bundle, not dependent on jaxb or jpa
stuff, but, that didn't seem to work.  So, I'm at the point where I
just want a JTA transaction working with Aries taking care of
transactions for me.  That would be my goal for now.  I hope its some
simple thing I missed.  Any help would be appreciated...Please

Thanks,

Diane

==
Bundle #1:  Datasource
I pretty much copied by datasource config from the main page of Aries JPA.

   
   
   
   
   
   

   
   
   
   
   
   

==
Bundle #2:  Persistence Model
java class: com/mycompany/persistencemodel/App - simple POJO
public class App {

   private Integer appId;
   private String name;
   private String status;
   private String version;
   private String description;

default constructor&  generated getter&  setter for each property
}

META-INF/persistence.xml
  
   org.hibernate.ejb.HibernatePersistence
   
osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/derbyds)
   mappings/app.hbm.xml

   
   
   
   
   
   

   
   
(and yes...META-INF/persistence.xml
in my pom.xml)

mappings/app.hbm.xml

   
   


   
   
   
   
   
   


==
Bundle #3
hibernate wrapper from
http://jaxenter.com/tutorial-using-jpa-in-an-osgi-environment-36661.html

==
Bundle #4
Persistence Service

   
   
   
   

   
   



--

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

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



Problem with blueprint 1.0.0-SNAPSHOT

2012-05-25 Thread Christian Schneider

Hi all,

I have problems building Karaf 3 from source:

[ERROR] Failed to execute goal on project org.apache.karaf.jaas.config: 
Could not resolve dependencies for project 
org.apache.karaf.jaas:org.apache.karaf.jaas.config:bundle:3.0.0-SNAPSHOT: Failed 
to c
ollect dependencies for 
[org.apache.karaf.jaas:org.apache.karaf.jaas.boot:jar:3.0.0-SNAPSHOT 
(provided), org.slf4j:slf4j-api:jar:1.6.4 (provided), 
org.apache.karaf:org.osgi.core:jar:3.0.0-SNAPSHOT (pr
ovided), org.springframework.osgi:spring-osgi-core:jar:1.2.1 (provided), 
org.apache.aries.blueprint:org.apache.aries.blueprint.api:jar:1.0.0-SNAPSHOT 
(provided), org.apache.aries.blueprint:org.apache.
aries.blueprint.core:jar:1.0.0-SNAPSHOT (provided), junit:junit:jar:4.10 
(test), org.easymock:easymock:jar:3.1 (test)]: Failed to read artifact 
descriptor for org.apache.aries.blueprint:org.apache.ari
es.blueprint.api:jar:1.0.0-SNAPSHOT: Failure to find 
org.apache.aries:default-parent:pom:1.0.0-20120524.034135-1 in 
http://repository.sonatype.org/content/groups/sonatype-public-grid was 
cached in the
 local repository, resolution will not be reattempted until the update 
interval of sonatype has elapsed or updates are forced -> [Help 1]

[ERROR]

Looks like at least the org.apache.aries:default-parent:pom is not 
available. Could this be a problem with the aries SNAPSHOT build?


Christian

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

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



Re: Problem with blueprint 1.0.0-SNAPSHOT

2012-05-25 Thread Christian Schneider
I was able to fix the build problem by building aries trunk by hand but 
it would be nicer if it just worked :-)


Christian

Am 25.05.2012 11:06, schrieb Holly Cummins:
The parent snapshot should currently be deployed to a snapshot 
repository, but it looks like maybe that's not being found in your 
case. Building the parent project first should get things working for 
you.


Holly

On 25 May 2012, at 09:37, Christian Schneider 
 wrote:



Hi all,

I have problems building Karaf 3 from source:

[ERROR] Failed to execute goal on project 
org.apache.karaf.jaas.config: Could not resolve dependencies for 
project 
org.apache.karaf.jaas:org.apache.karaf.jaas.config:bundle:3.0.0-SNAPSHOT: 
Failed to c
ollect dependencies for 
[org.apache.karaf.jaas:org.apache.karaf.jaas.boot:jar:3.0.0-SNAPSHOT 
(provided), org.slf4j:slf4j-api:jar:1.6.4 (provided), 
org.apache.karaf:org.osgi.core:jar:3.0.0-SNAPSHOT (pr
ovided), org.springframework.osgi:spring-osgi-core:jar:1.2.1 
(provided), 
org.apache.aries.blueprint:org.apache.aries.blueprint.api:jar:1.0.0-SNAPSHOT 
(provided), org.apache.aries.blueprint:org.apache.
aries.blueprint.core:jar:1.0.0-SNAPSHOT (provided), 
junit:junit:jar:4.10 (test), org.easymock:easymock:jar:3.1 (test)]: 
Failed to read artifact descriptor for 
org.apache.aries.blueprint:org.apache.ari
es.blueprint.api:jar:1.0.0-SNAPSHOT: Failure to find 
org.apache.aries:default-parent:pom:1.0.0-20120524.034135-1 in 
http://repository.sonatype.org/content/groups/sonatype-public-grid was cached 
in the
local repository, resolution will not be reattempted until the update 
interval of sonatype has elapsed or updates are forced -> [Help 1]

[ERROR]

Looks like at least the org.apache.aries:default-parent:pom is not 
available. Could this be a problem with the aries SNAPSHOT build?


Christian

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

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




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

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



Re: Problem with blueprint 1.0.0-SNAPSHOT

2012-05-25 Thread Christian Schneider
While I was able to fix my local build by building aries by hand it does 
not help the jenkins build :


https://builds.apache.org/view/G-L/view/Karaf/job/Karaf/1215/

It seems like the Aries build also fails with some rather infrastructure 
like looking exception.


Any idea how we can get this working again?

Christian


Am 25.05.2012 11:06, schrieb Holly Cummins:
The parent snapshot should currently be deployed to a snapshot 
repository, but it looks like maybe that's not being found in your 
case. Building the parent project first should get things working for 
you.


Holly



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

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



How to implement a factory that creates an object from a blueprint recipe

2012-07-02 Thread Christian Schneider

Hi all,

normally you just use dependency injection to inject an object into 
another one. This works as long as you can work with one injected instance.


There are some cases though were you want a fresh object each time that 
is created from a blueprint (or similar) definition. One such case in 
the karaf code is for the SShServer and SshServerAction. There we 
currently want to create and start a new server each time the command is 
called. So while I am not sure if this is the best example I think the 
need for it is there.


So currently we do the following to create the new object:
SshServer server = (SshServer) 
container.getComponentInstance(sshServerId);
So we inject the BlueprintContainer and the component id into the 
SshServerAction and then call a container method to create the instance.


This makes the SshServerAction class dependent on blueprint and also 
violates the dependency injection principle.


So I wonder if there would be a better way to do it.
If not I have got an idea how to achieve that:

We could create a GenericFactory interface like this:
public interface GenericFactory {
public T create();
}

So the class that wants to create the object would have a property:

private GenericFactory serverFactory;
...
SshServer server = serverFactory.create();

So we would simply have to find a way to inject an implementation of the 
GenericFactory interface into the object. We could just use a normal 
property definition
and detect that it is a factory and then create a dynamic proxy for the 
factory.



Another way would be to use an annotation:
@Inject(ref="sshServer")
private GenericFactory serverFactory;

So what do you think? Would it make sense to add this to aries? Or is it 
already possible and I just did not find it?


Christian

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

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



Re:

2012-11-12 Thread Christian Schneider
Hi Ioan,

in Apache Karaf there is one additional bundle:
org.apache.aries.blueprint.core.compatibility 1.0.0

I  guess this may be necessary to support the 1.0.0 blueprint ext namespace.

Btw. If you have the choice try to use Karaf .. It is much simpler to
setup than pure Felix.

Christian



On 11/12/2012 01:33 PM, Ioan Eugen Stan wrote:
> Hello,
>
> I'm building an OSGI app with felix and blueprint  based on
> aries-1.0.0 and I get the class cast exception which I pasted bellow.
> I searched on the mailing list and found another discussion but no
> apparent solution.
>
> I'm pretty new to OSGI, especially aries so could you please explain
> what I'm doing wrong?
>
> 12.11.2012 12:57:33.689 *INFO* [Blueprint Extender: 3]
> org.apache.aries.blueprint.container.BlueprintContainerImpl Bundle
> com.axemblr.provisionr.engine is waiting for namespace handlers
> [http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0]
> 12.11.2012 12:57:33.689 *INFO* [Blueprint Extender: 3]
> org.apache.aries.blueprint.container.BlueprintContainerImpl Bundle
> com.axemblr.provisionr.engine is waiting for namespace handlers
> [http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0]
>
> ERROR: Bundle org.apache.aries.blueprint.core [15] EventDispatcher:
> Error during dispatch. (java.lang.ClassCastException:
> org.apache.aries.blueprint.ext.impl.ExtNamespaceHandler cannot be cast
> to org.apache.aries.blueprint.NamespaceHandler)
> java.lang.ClassCastException:
> org.apache.aries.blueprint.ext.impl.ExtNamespaceHandler cannot be cast
> to org.apache.aries.blueprint.NamespaceHandler
> at 
> org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl.addingService(NamespaceHandlerRegistryImpl.java:101)
> at 
> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:980)
>
> The list of aries dependencies I load into OSGi:
>
> org.apache.aries.blueprint-1.0.0.jar
> org.apache.aries.blueprint.api-1.0.0.jar
> org.apache.aries.blueprint.core-1.0.0.jar
> org.apache.aries.proxy-1.0.0.jar
> org.apache.aries.transaction.manager-1.0.0.jar
> org.apache.aries.util-1.0.0.jar
>
> Thanks,
>



Re: Some thoughts about Blueprint and MetaType

2013-05-14 Thread Christian Schneider

I also think the metatype support could be improved.

What I observed is that I often have to repeat the same defaults in the 
metatype xml and in blueprint.


The reason to have the default values in metatype is to have them for 
e.g. webconsole.
The reason to have the default values in blueprint in the 
default-properties tag is to make sure my application works when no 
config is present.


I have added some snippets below to show how it looks like.

I wonder if we could add some more metatype features to the 
default-properties tag and then use this meta data to create metatype 
informations like Dirk suggested. So for example we could add attributes 
for required and type.


Christian




---
Config in metatype:

 
http://www.osgi.org/xmlns/metadata/v1.0.0";
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
 xsi:schemaLocation="
 http://www.osgi.org/xmlns/metadata/v1.0.0 
http://www.osgi.org/xmlns/metatype/v1.1.0/metatype.xsd
 ">
 
 
 
 
 
 




Config in blueprint:









On 14.05.2013 10:54, Rudolph, Dirk wrote:


Hi all,

currently we are migrating one of our projects from SCR to blueprint 
using Apache Aries. We defined our services using XML files and want 
to provide a proper configuration for them using Apache Felix Web 
Console. According to the OSGI specs we have to write MetaType 
information for that, what it is a little bit dirty in my eyes. Would 
it be possible to combine MetaType information and Blueprint definition?


In my eyes the following possibilities would be nice to have:

1.Having a namespace that allows the user to add MetaType information 
to the blueprint definition XML files. This information could then be 
published using a MetaTypeProvider.


2.Adding the MetaType information to the Blueprint Annotation API and 
also publishing them using a MetaTypeProvider


Additionally I had a look at the Blueprint Annotation implementation 
and mentioned that the Blueprint model is generated during runtime. 
Wouldn't it be better to generate the model during build (e.g using a 
maven plugin similar to Apache Felix SCR Plugin)?


Thanks a lot,

*Dirk Rudolph *


T-Systems Multimedia Solutions GmbH
Organisationseinheit CCS
Dirk Rudolph
Software-Entwicklung, OCJP

Hausanschrift: Riesaer Straße 5, 01129 Dresden
Postanschrift: Postfach 10 02 24, 01072 Dresden
+49 351 2820-5363   (Tel)
E-Mail:dirk.rudo...@t-systems.com <mailto:mdirk.rudo...@t-systems-mms.com>
Internet: http://www.t-systems-mms.com <http://www.t-systems-mms.de/>

T-Systems Multimedia Solutions GmbH

Aufsichtsrat: Klaus Werner (Vorsitzender)
Geschäftsführung: Peter Klingenburg, Dr. Jens Nebendahl
Handelsregister: Amtsgericht Dresden HRB 11433
Sitz der Gesellschaft: Dresden
Ust-IdNr.: DE 811 807 949




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

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



Re: Dynamic configuration of datasource

2013-05-22 Thread Christian Schneider

This is possible in two ways.

You can use the 
http://www.osgi.org/javadoc/r4v42/org/osgi/service/jdbc/DataSourceFactory.html 
sepcified in the OSGi spec if your drivers supports it.


If not then you can try this tutorial:
http://www.liquid-reality.de/x/LYBk
Basically the idea is to publish a DataSource as an OSGi service using a 
separate blueprint file and using the service in your user bundle. This
way you can have the filter to reference the OSGi service in a config of 
your user bundle. So you can switch db types.


Christian

Am 21.05.2013 17:40, schrieb FERJANI:

Hello everyone,

I'd like to configure the database type (mysql, derby,..) from an 
external configuration type. Is this possible using blueprint ?


Regards,
Khadija



--
 
Christian Schneider

http://www.liquid-reality.de

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



Re: Dynamic configuration of datasource

2013-05-22 Thread Christian Schneider
Sounds good. Did you export the DataSource as a service in the db-mysql 
bundle or how did you connect it to your persistence bundle?


The only thing you need to consider is if this works with pooling. For 
some drivers the DataSources are not poolable. In that case you could 
use the first option I described and implement the DataSourceFactory 
yourself.


Christian

Am 22.05.2013 10:08, schrieb FERJANI:

Hello Christian,

I tried something that seems working but I'd like a confirmation that 
I'm not writing a bomb-code :)


I separated my persistence bundle (META-INF/persistence.xml, Entity 
classes,..) (db-common) from the blueprint.xml file.
I created a bundle database-mysql that only contains a blueprint file 
for the mysql DB configuration (db-mysql), and I'm thinking of 
creating a similar bundle with a blueprint.xml file for a derby DB 
configuration (db-derby).
After that, I'd have to install one of those bundles (db-mysql or 
db-derby) with my initial bundle (db-common) to make it work.


Right know, I tested this with the bundles db-mysql and db-common and 
it seems working.


Is it an OSGi compliant implementation ?

Best regards,
Khadija



On 05/22/2013 08:12 AM, Christian Schneider wrote:

This is possible in two ways.

You can use the 
http://www.osgi.org/javadoc/r4v42/org/osgi/service/jdbc/DataSourceFactory.html 
sepcified in the OSGi spec if your drivers supports it.


If not then you can try this tutorial:
http://www.liquid-reality.de/x/LYBk
Basically the idea is to publish a DataSource as an OSGi service 
using a separate blueprint file and using the service in your user 
bundle. This
way you can have the filter to reference the OSGi service in a config 
of your user bundle. So you can switch db types.


Christian

Am 21.05.2013 17:40, schrieb FERJANI:

Hello everyone,

I'd like to configure the database type (mysql, derby,..) from an 
external configuration type. Is this possible using blueprint ?


Regards,
Khadija



--
  
Christian Schneider

http://www.liquid-reality.de

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





--
 
Christian Schneider

http://www.liquid-reality.de

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



Differences between blueprint core 1.1.0 binary and source in maven central

2013-05-27 Thread Christian Schneider
I would like to debug into the blueprint core code. So I use m2eclipse 
which automatically downloads the sources from maven central.


There I found that the source code for some classes in blueprint core 
1.1.0 seem to be missing.


For example in the binary there is 
"org.apache.aries.blueprint.ComponentDefinitionRegistry" and several 
other classes in this package.
While in the source jar there is only the class 
"org.apache.aries.blueprint.ExtendedBlueprintContainer".


Am I searching at the wrong location, or is the source jar broken?

Christian

--
See the source jar and binary jar in central:
http://search.maven.org/#artifactdetails|org.apache.aries.blueprint|org.apache.aries.blueprint.core|1.1.0|bundle


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

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



Re: [Blueprint] how to set logging level ?

2013-07-04 Thread Christian Schneider
Can you try to also install and configure pax logging? It should allow you
to define which logging categories are logged at what level.

Christian
Am 01.07.2013 23:22 schrieb "Cristiano Gavião" :

> Hello,
>
> When I running an application that is using Aries Blueprint inside Eclipse
> IDE I'm getting a bunch of log messages like this one in the console:
>
> 18:13:42.965 [Start Level Event Dispatcher] DEBUG
> o.a.a.b.container.BlueprintExtender - Found ProxyManager service, starting
> to process blueprint bundles
>
> Could someone please teach me how could I set this off ?
>
> thanks,
>
> Cristiano
>


Error in aries jmx when loading felix security bundle

2013-07-11 Thread Christian Schneider
Hi all,

I am trying to install the felix security bundle in karaf 2.3.1. I get an
error in aries jmx on installation. Is this a bug or am I doing something
wrong here?

Christian


karaf@root> install -s
mvn:org.apache.felix/org.apache.felix.framework.security/2.2.0
ERROR: Bundle org.apache.aries.jmx.core [27] EventDispatcher: Error during
dispatch. (java.lang.NoClassDefFoundError:
org/osgi/service/permissionadmin/Permission
Admin)
java.lang.NoClassDefFoundError:
org/osgi/service/permissionadmin/PermissionAdmin
at
org.apache.aries.jmx.permissionadmin.PermissionAdminMBeanHandler.constructInjectMBean(PermissionAdminMBeanHandler.java:53)
at
org.apache.aries.jmx.AbstractCompendiumHandler.addingService(AbstractCompendiumHandler.java:87)
at
org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:932)
at
org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)
at
org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
at
org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
at
org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:894)
at
org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
at
org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
at
org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
at
org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4260)
at org.apache.felix.framework.Felix.registerService(Felix.java:3275)
at
org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:346)
at
org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:320)
at
org.apache.felix.framework.SecurityActivator.start(SecurityActivator.java:212)
at
org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:645)
at
org.apache.felix.framework.ExtensionManager.startExtensionBundle(ExtensionManager.java:447)
at org.apache.felix.framework.Felix.installBundle(Felix.java:2817)
at
org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:165)
at
org.apache.karaf.shell.osgi.InstallBundle.doExecute(InstallBundle.java:43)
at
org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:38)
at
org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)
at
org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)
at
org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)
at
org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)
at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)
at
org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)
at
org.apache.karaf.shell.console.jline.Console.run(Console.java:174)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassNotFoundException:
org.osgi.service.permissionadmin.PermissionAdmin not found by
org.apache.aries.jmx.core [27]
at
org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1460)
at
org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)
at
org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 31 more
Bundle ID: 54


Why does aries blueprint publish a proxy instead of the real object into the service registry?

2014-02-17 Thread Christian Schneider

I am using blueprint  to publish an object to the service registry.

The problem is that instead of a service it seems to publish a proxy. So 
I can not introspect the object.
I know that blueprint needs to inject a proxy if you use  but 
why does it also create a proxy when publishing a service.
Jean Baptiste showed me some code using ProxyManager to unproxy the 
object but this is quite ugly and makes me depend on aries proxy.


So why is the proxy created and can this be turned off?

Christian


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

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



Re: Why does aries blueprint publish a proxy instead of the real object into the service registry?

2014-02-17 Thread Christian Schneider

Hi David and Chris,

I am not sure if we are talking about the same effect.
As I wrote in my original mail I am aware of the proxy that is created 
when injecting a service using blueprint. It is necessary as blueprint 
does the inject statically.
In contrast to this I am observing a proxy when I export the service. I 
import the service using a service tracker. So I did not expect to 
encounter a proxy for this case.


Guillaume mentioned the security layer as the source of the proxy. I 
think this should also not apply. The etc/system.properties contains this:

karaf.secured.services = (&(osgi.command.scope=*)(osgi.command.function=*))

So while this should match for the commands it should not match for my 
case where I simply export an Action without any properties. I will dig 
a bit more.


Christian


Am 17.02.2014 20:59, schrieb David Jencks:
The proxy is a blueprint thing and as Chris says is there to damp 
bouncing services.  I think the DS technique of binding a replacement 
service before unbinding the old one is a more appropriate solution to 
this problem, although it certainly has different effects and produces 
more bouncing.


thanks
david jencks




--
 
Christian Schneider

http://www.liquid-reality.de

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



Aries jpa and jta with annotations

2014-04-02 Thread Christian Schneider

Hi all,

I just found in the source code of aries transaction that there is 
support for annotation based transactions now. This already seems to be 
included in org.apache.aries.transaction.blueprint 1.0.1.


The example is here:
http://svn.apache.org/repos/asf/aries/trunk/transaction/transaction-blueprint/src/test/java/org/apache/aries/transaction/pojo/AnnotatedPojo.java
http://svn.apache.org/repos/asf/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/enable-annotations.xml

In the blueprint the namespace 
http://aries.apache.org/xmlns/transactions/v1.2.0 is used but I can not 
find an xsd at the normal location:

http://aries.apache.org/schemas/transaction/

Is this just missing by accident or is the namespace not to be used by 
the public already?


In the example I also do not see how to inject the EntityManager for 
jpa. Is this still done in the old way using the xml?


Christian

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

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



Re: Aries jpa and jta with annotations

2014-04-04 Thread Christian Schneider
At the moment PAX-CDI does not work with Deltaspike which you will need 
for jpa support.

The new version JB is preparing should fix that.

Not sure how deltaspike handles the classloading problem though. I hope 
it also uses aries jpa.


Christian

On 04.04.2014 16:57, Ioan Eugen Stan wrote:

This is a hot topic for me also. I'm searching for ways to inject the
entity manager in my code (declarative services) without XML.
CDI via Pax-CDI seems to be the way to go so far, but did not had time
to try it out. It's been on my todo list for quite some time.

On Wed, Apr 2, 2014 at 11:03 AM, Christian Schneider
 wrote:

Hi all,

I just found in the source code of aries transaction that there is support
for annotation based transactions now. This already seems to be included in
org.apache.aries.transaction.blueprint 1.0.1.

The example is here:
http://svn.apache.org/repos/asf/aries/trunk/transaction/transaction-blueprint/src/test/java/org/apache/aries/transaction/pojo/AnnotatedPojo.java
http://svn.apache.org/repos/asf/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/enable-annotations.xml

In the blueprint the namespace
http://aries.apache.org/xmlns/transactions/v1.2.0 is used but I can not find
an xsd at the normal location:
http://aries.apache.org/schemas/transaction/

Is this just missing by accident or is the namespace not to be used by the
public already?

In the example I also do not see how to inject the EntityManager for jpa. Is
this still done in the old way using the xml?

Christian

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

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







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

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



JPA entity persist visible before transaction commit

2014-11-26 Thread Christian Schneider

I just opened
https://issues.apache.org/jira/browse/ARIES-1278

I persist a JPA entity inside a transaction and it is already visible 
before the commit. Does anyone have an idea how this can happen?


Christian

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

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



Re: JPA entity persist visible before transaction commit

2014-11-26 Thread Christian Schneider

Hi Balázs,

I was using pax-jdbc-config with pax-jdbc-pool-dbcp2 to create the 
DataSource.


Seems I had a bug in pax-jdbc-pool-dbcp2. I did not use the correct 
classes to create the DataSource in a XA aware manner.
I now used a small extra bundle to create the DataSource. 
https://github.com/cschneider/Karaf-Tutorial/tree/master/tasklist-cdi/datasource


With this DataSource the access from the second thread to the DB table 
seems to be blocked until the commit is done. So I consider that as a 
good sign that it is working correctly now.


I will use this as an example to fix pax-jdbc-pool-dbcp2.

Many thanks for leading me on the right track that the dbcp2 setup may 
be the problem.


Christian

On 26.11.2014 16:13, Balázs Zsoldos wrote:

Hi,

Be sure that you use /org.apache.derby.jdbc.EmbeddedXADataSource/ and 
the XAResource is enlisted in the current transaction each time a 
connection is requested.


A good choice can be if you:

  * Instantiate EmbeddedXADataSource. This implements XADataSource
  * Wrap it with commons-dbcp BasicManagedDataSource. This implements
DataSource and enlists the XAResource each time a connection is
requested.
  * Register BasicManagedDataSource as an OSGi service
  * Use the registered OSGi service in persistence.xml

If you use commons-dbcp, be sure that you use at least version 2.0.1.

If you need configurable DS components, you can use:

  * https://github.com/everit-org/osgi-jdbc-dsf (Contains components
that can pick up a DataSourceFactory OSGi service and register
either XADataSource or DataSource)
  * https://github.com/everit-org/commons-dbcp-component (Contains a
configurable component that instantiates BasicManagedDataSource
and registers it as an OSGi service based on DataSource interface)


Regards,
*Balázs **Zsoldos*


On Wed, Nov 26, 2014 at 3:58 PM, Christian Schneider 
mailto:ch...@die-schneider.net>> wrote:


I just opened
https://issues.apache.org/jira/browse/ARIES-1278

I persist a JPA entity inside a transaction and it is already
visible before the commit. Does anyone have an idea how this can
happen?

Christian

-- 
Christian Schneider

http://www.liquid-reality.de

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





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

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



Re: Transaction management with annotations

2015-03-02 Thread Christian Schneider

Hi Katrin,

I am not sure if the annotation support for transations ever really 
worked. At least it did not work for me when I tried it some time ago.


In the mean time I created the blueprint-maven-plugin for aries which 
aims for a similar thing. It allows to do many parts of blueprint with 
annotations

but works by creating the blueprint xml at compile time.

Unfortunately I did not yet do any documentation on the aries web site 
but I already got an example for it:

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

Perhaps this could solve some of the things for you. If you want to try 
it and run into problems I may be able to help you directly till there 
is sufficient documenation.


Christian



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

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



Re: Aries JTA + EclipseLink

2015-03-02 Thread Christian Schneider
There is no real Aries 1.0.0. Aries consists of a set of bundles that 
are each versioned independently.

So you need to specify which exct set of bundles you used.

Honestly it is quite difficult to get the  combinations correctly. So I 
propose you try karaf 3.0.3 and install the aries modules you want from 
there. This will give you a working set of bundles.
About the eclipslink support .. We got itests for it but I personally 
never tested it manually. I heard though that the newest eclipselink 
should work without the adapter.


About 2). Yes I consider aries jpa to be production ready but you need 
to use the most current releases. The 1.0.0 version are definately not 
production ready.


Christian


On 25.09.2012 02:32, Anatoly Osiko wrote:

Hello, JPA users, and hopefully, developers.

RE: Aries 1.0.0, Aries trunk: jpa/jpa-container-eclipselink-adapter

I managed Aries 1.0.0 declarative transaction support (via blueprint 
container) to work with EclipseLink JPA only with the eclipselink 
adapter, which, the latter, was compiled by me from the trunk of 
Aries, and which doesn't appear in any "official" versioned release?


Can anyone, please, enlighten me on
1) the status of the org.apache.aries.jpa.eclipselink.adapter bundle 
specifically,

and
2) if Aries 1.0.0 is ready for the production use.

Thank you.

Anatoly.




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

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



Re: Intercept bean production and/or bean method calls in in Aries Blueprint

2015-03-16 Thread Christian Schneider
Take a look at the blueprint-authz module. It does a very similar thing 
... maybe even exactly what you want :-)

If not it should still be easy to enhance it.

See 
https://fisheye6.atlassian.com/browse/~br=trunk/aries/trunk/blueprint/blueprint-authz


I had to use a namespace and even a custom element simply to activate 
the interceptor. No idea if it can be done differently.


Christian

On 16.03.2015 17:31, Matthias Seidemann wrote:

Hello everyone,

In my application I want to intercept the calls of service-methods and 
check if the currently logged in user has permissions to do so. I 
already found the "org.apache.aries.blueprint.Interceptor" Interface 
to do that, but I don't really know how I can tell aries to call my 
Interceptor. Any ideas on how to realize that?


I think I already found a way to do this by using a custom namespace 
with a custom NamespaceHandler implementation (did not fully implement 
it yet), but I don't really want to do it in that way because I don't 
want the need to add extra attributes to the beans.


Best regards,
Matthias



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

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



Using service reference to a service created in the same blueprint context

2015-07-09 Thread Christian Schneider

I got a customer that would like to use a quite exotic construct. They want to 
export a service in a blueprint context and import it in the same context.
I do not really recommend this model but they would prefer it to keep their 
code generation simple.
They know this is not possible with mandatory services so the used optional 
ones.

In a simple case the example below works. If the init method of serviceB calls 
serviceA though then we always get a ServiceUnavailableException.

My explanation was that the blueprint context is initialized in these stages:
- create references to services, wait till mandatory ones are present
- wire each bean and call init-method
- export all services

So the reason why it does not work for mandatory services is that the 
references are checked before our own services are exported.
The reason why the init-method with call to serviceA does not work is because 
the services are exported only after all beans are injected.

So I have two questions:
1. Is my model how blueprint starts up correct?
2. Could Aries blueprint theoretically be changed to export services as soon as 
all necessary beans are injected instead of at the end? Or is the startup model 
above mandated by the spec?

Best regards

Christian



http://www.osgi.org/xmlns/blueprint/v1.0.0";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
   
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd";>






    
    

    



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

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



Inject a real blueprint service proxy using a BeanProcessor

2015-07-21 Thread Christian Schneider
In the jpa blueprint extension we are currently injecting a hand built 
proxy that works similar to a blueprint proxy.

There are some disadvantages to this approach though.

1. The code for the proxy is less well tested than the main service 
proxies blueprint uses.
2. Blueprint does not know about the hand made proxies. Ideally I would 
like blueprint to go into grace period until e.g an EntityManagerFactory 
service is present.


So is it possible to use the blueprint proxies and their definitions 
(service recipe?) for annotation based injects too?


Christian

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

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



Re: JPA: persistence unit via property placeholder

2015-07-30 Thread Christian Schneider

The functionality is not standard in custom namespaces. So it is no bug.
Unfortunately I do not know how to implement the replacement.  I already 
asked on the dev list if anyone knows how to do it.

If it is rather simple I can add it then.

Christian

Am 30.07.2015 um 10:59 schrieb Jochen Walz:

Hello,

when trying to define the persistence unit as property in blueprint, 
the property is not resolved when used in the jpa namespace:




value="default_persistenceunit" />





unitname="${persistenceunitname}" />




...

I saw some question for the same topic, but the solution was to use 
datasources. In my case, I'd like to use different persistence units 
to be able to access different databases (and some of the persistence 
unit settings are DB specific).


I'm using version 1.0.2 of the JPA container and 1.0.4 for the JPA 
Container Blueprint integration.


Is this a bug in Aries JPA, or would that be a new feature to make the 
property resolution work?


Best Regards,

Jochen




Re: Externalize the orm property from the persistence.xml

2015-09-16 Thread Christian Schneider
If you are using a data source then hibernate.connection.driver_class 
should not be necessary.

The other ones are needed. Why do you want to externalize them?

Btw. in our tests we have properties for hibernate, eclipselink and 
openjpa side by side. So we can switch the persistence provider without 
changing the persistence.xml.


For a real project the typical case is to use an embedded DB for tests 
and a bigger one for prod. There again it should not hurt to have both 
configs in the same persistence.xml.


Christian

On 16.09.2015 12:24, Delaire, Jonathan wrote:


Hi Guys!

I’m currently working on a large refactoring of a project with the 
goal of using the JPA Aries within an OSGi  container for persistence 
(rather than plain old J2EE stack).


Currently so far so good, I’m following the guidance of the tasklit 
blueprint (it is managed jpa) example from your website and everything 
works fine (I’m using felix 5, with the aries jpa 2.1 version and 
hibernate 4.3+ as orm)


I’m trying to make the solution the most configurable as possible, 
currently my persistence.xml look like this:


//

//

/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 
<http://java.sun.com/xml/ns/persistence%20http:/java.sun.com/xml/ns/persistence/persistence_1_0.xsd>//"/


/version="1.0">/

/ /

/
osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/audit)/

//

//

/value="org.apache.derby.jdbc.EmbeddedDriver"/>/


/value="org.hibernate.dialect.DerbyDialect"/>/


//

//

//

//

I have externalized the dataSource configuration using blueprint-cm 
with configAdmin so for the dataSource it is working good.


But now I’m left with these properties in red, what do you think would 
be the most elegant way of externalizing them ?


Note that my entityManager is injected like this:

//**/

/ * EntityManager, injected by blueprint jpa./

/*//

/@PersistenceContext(unitName = "Audit")/

/private EntityManager entityManager;/

//

Thanks for your support!

Jonathan

Information in this e-mail and any attachments is confidential, and 
may not be copied or used by anyone other than the addressee, nor 
disclosed to any third party without our permission. There is no 
intention to create any legally binding contract or other binding 
commitment through the use of this electronic communication unless it 
is issued in accordance with the Experian Limited standard terms and 
conditions of purchase or other express written agreement between 
Experian Limited and the recipient. Although Experian has taken 
reasonable steps to ensure that this communication and any attachments 
are free from computer viruses, you are advised to take your own steps 
to ensure that they are actually virus free.


Experian Ltd is authorised and regulated by the Financial Conduct 
Authority.
Companies Act information: Registered name: Experian Limited. 
Registered office: The Sir John Peace Building, Experian Way, NG2 
Business Park, Nottingham, NG80 1ZZ, United Kingdom. Place of 
registration: England and Wales. Registered number: 653331.



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

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



Re: Bundle set recommendations for JPA+JTA+Eclipselink Partitioning?

2015-09-22 Thread Christian Schneider

Hi Matthew,

pax-jdbc-pool-dbcp2 as well as pax-jdbc-pool-aries should both be able 
to provide XA enlisting poolable DataSources.
Aries JPA and Transaction actually use the above in their integration 
tests. So they should work together nicely.


I got two tutorials that both use XA transactions with Aries:
http://liquid-reality.de/display/liquid/2015/06/30/Apache+Karaf+Tutorial+part+10+-+Declarative+services
http://liquid-reality.de/display/liquid/2015/03/05/Apache+Karaf+Tutorial+Part+9+-+Annotation+based+blueprint+and+JPA

Btw. Do you plan to use blueprint or DS?

Christian

On 03.09.2015 22:51, matthew.w.pi...@wellsfargo.com wrote:

Ok, maybe I can answer my own questions here, but if I could get some
confirmation that would be great. I seem to have a working system running
with ops4j-pax-jdbc-pool-aries rather than dbcp2.

Digging into the code in org.apache.aries.transaction.jdbc it looks like
RecoverableDataSource is the wrapper for my XADataSources and it does indeed
appear to support passing of pooling options onto ConnectionManagerFactory
which itself appears to use the pooling capabilities that come from the
Geronimo bundles. Does all this sound correct so far?

So, it's not dbcp2, but it's pooling nonetheless and I can adjust
preferences by passing the appropriate bean options to my pax-jdbc service
with the 'pool.' prefix which will in-turn send those on to the
RecoverableDataSource instance. Sound ok still?

And finally, my eclipselink JTA datasource JNDI lookups are formatted with
filters for the 'aries.managed' property [1] to ensure that I get the aries
auto-enlisting DataSources.

So far, this is running my existing code ok with only two changes I had to
make:

1. Fixed ARIES-1171, but actually in the Tranql code as I was getting
connection errors and didn't see a logical place to fix it from an aries
class (using latest aries-transaction-jdbc from SVN). This required bringing
all the tranql source into my aries bundle and just removing the external
dependency. I didn't like doing that, but since that code hasn't changed in
a while and I'm still prototyping all this it was the path of least
resistance.

2. Changed RecoverableDataSource to not use empty strings by default for
username and password. Which seemed to be similar/related to the above and I
posted as ARIES-1376.

Thoughts and criticisms welcome. Thanks!

[1]
osgi:service/javax.sql.DataSource/(&(osgi.jndi.service.name=my-app-node1)(ar
ies.managed=true))

-Original Message-
From: matthew.w.pi...@wellsfargo.com [mailto:matthew.w.pi...@wellsfargo.com]

Sent: Thursday, September 03, 2015 10:58 AM
To: user@aries.apache.org
Subject: Bundle set recommendations for JPA+JTA+Eclipselink Partitioning?

I am in the process of refactoring an existing JPA/Eclipselink-based
application to introduce Eclipselink's partitioning support for database
sharding. My current application runs quite well with pooled jdbc
connections via boncep.

However, with the sharded model there will be a number of entity types that
are Replicated to all shards and, as such, eclipselink will be doing writes
that span multiple jdbc connections. Per the eclipselink recommendations for
paritioning I would like to introduce JTA in order to enforce integrity
across commits that hit multiple partitions.

It seems like the ops4j-pax-jdbc bundles are designed to support XA/JTA and
it seems like there is a lot of XA support in the various aries bundles
(aries.transaction. and aries.jpa.). However, I'm not sure of what
combination of these bundles+configuration will provide what I am after.
Since many of these bundles seem to be designed/documented around general
JTA usage - like performing a transaction that spans JMS and JDBC - I'm not
confident if that model works with my particular use case.

To further add to this, I would like for my JDBC connections to be pooled
for performance. ops4j-pax-jdbc-pool-dbcp2 seems like a logical choice, but
again I'm not sure if it will play nicely with the transaction management
features from aries.

I think I have a working model of this, but I'm rather new to XA/JTA
especially from OSGi so I want to make sure I'm getting this correct. So, I
guess my questions are:

1. Can ops4j-pax-jdbc-pool and it's dbcp2 sibling work with
aries-jpa/transaction to pool and auto-enlist XADataSources?

2. If not, will ops4j-pax-jdbc-pool-aries work? And if so, can its pooling
semantics be configured? E.g. minIdle, maxIdle, etc.

3. If neither of the above works, is there a recommended set of bundles to
accomplish pooled XADataSources with eclipselink+JTA?


Thanks,


Matthew Pitts
  
Developer

Security Solutions Design & Automation
  
Wells Fargo Bank | Tel 336.608.3332 | Cell 336.202.3913 | Kernersville, NC |

MAC D9693-010
matthew.w.pi...@wellsfargo.com
  




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

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



Re: Bundle set recommendations for JPA+JTA+Eclipselink Partitioning?

2015-09-22 Thread Christian Schneider
Honestly I have no idea why tranql sets the autocommit. I would not 
expect that it needs to be tweaked.


I can imagine that dbcp2 does not allow to change autocommit for XA 
transactions as the commit should
only be done when the XA transaction commits. Not sure about this either 
though.


I propose you ask this on the apache commons list or open an issue for 
dbcp2. It definitely seems to be an issue that
can also happen when just configuring dbcp2 manually and then use tranql 
on it.


Christian

Am 22.09.2015 um 20:19 schrieb matthew.w.pi...@wellsfargo.com:

[1] is a snippet from the stacktrace I get when using pax-jdbc-pool-dbcp2
instead of -aries. As you can see,
ManagedJDBCConnection#localTransactionStart appears to call setAutoCommit on
the connection class, which the DBCP2 impl short circuits at [2].

This same exact environment seems to run fine with the -aries pool bundle. I
am running this with a customized transactions-jdbc bundle checked-out from
SVN. But, the only change I made was the pull in all the tranql source to
fix issues with the two-arg form of getConnection in some of those classes.
Aside from that it's unchanged and works fine with the -aries pooling
bundle.

Any suggestions are greatly appreciated.

[1]
Caused by: javax.resource.spi.LocalTransactionException: Unable to disable
autoCommit
at
org.tranql.connector.jdbc.ManagedJDBCConnection.localTransactionStart(Manage
dJDBCConnection.java:83)
~[org.apache.aries.transaction.jdbc-2.1.2-SNAPSHOT.jar:2.1.2-SNAPSHOT]
at
org.tranql.connector.AbstractManagedConnection$LocalTransactionImpl.begin(Ab
stractManagedConnection.java:195)
~[org.apache.aries.transaction.jdbc-2.1.2-SNAPSHOT.jar:2.1.2-SNAPSHOT]
at
org.apache.geronimo.connector.outbound.LocalXAResource.start(LocalXAResource
.java:107) ~[geronimo-connector-3.1.3.jar:3.1.3]
... 76 common frames omitted
Caused by: java.sql.SQLException: Auto-commit can not be set while enrolled
in a transaction
at
org.apache.commons.dbcp2.managed.ManagedConnection.setAutoCommit(ManagedConn
ection.java:223) ~[na:na]
at
org.tranql.connector.jdbc.ManagedJDBCConnection.localTransactionStart(Manage
dJDBCConnection.java:81)
~[org.apache.aries.transaction.jdbc-2.1.2-SNAPSHOT.jar:2.1.2-SNAPSHOT]
... 78 common frames omitted

[2]
public void setAutoCommit(boolean autoCommit) throws SQLException {
 if (transactionContext != null) {
  
throw new SQLException("Auto-commit can not be set while enrolled in a trans

action");
 }
 super.setAutoCommit(autoCommit);
}


-Original Message-
From: matthew.w.pi...@wellsfargo.com [mailto:matthew.w.pi...@wellsfargo.com]

Sent: Tuesday, September 22, 2015 11:14 AM
To: user@aries.apache.org
Subject: RE: Bundle set recommendations for JPA+JTA+Eclipselink
Partitioning?

Thanks very much for the references, I will definitely be looking over them.

I was hoping the dbcp2 bundle would allow for the same XA capability, as I
would prefer dbcp2 pooling since it seems fairly analogous to my current
pooling - bonecp. However, I did some testing with dbcp2 and got exceptions
during runtime when code from base datasource wrappers (from tranql maybe)
was attempting to set the auto-commit flag and the DBCP datasource wrapper
class was throwing an exception about setting auto-commit. I can't remember
exactly the code flow but I'll try to test this again and see about getting
a stacktrace. Does any of this sound familiar? Should I be able to simply
replace pax-jdbc-pool-aries with pax-jdbc-pool-dbcp2 in my runtime? Maybe it
was something in my jndi references not getting the aries-managed datasource
services.

As for the blueprint/DS question, I will be largely using DS to inject
app-specific API that gives my code access to the JpaTemplate/EntityManager
classes. I hope to move toward blueprint, but that will be another effort.

Thanks again,
-matt

-Original Message-
From: Christian Schneider [mailto:cschneider...@gmail.com] On Behalf Of
Christian Schneider
Sent: Tuesday, September 22, 2015 10:24 AM
To: user@aries.apache.org
Subject: Re: Bundle set recommendations for JPA+JTA+Eclipselink
Partitioning?

Hi Matthew,

pax-jdbc-pool-dbcp2 as well as pax-jdbc-pool-aries should both be able
to provide XA enlisting poolable DataSources.
Aries JPA and Transaction actually use the above in their integration
tests. So they should work together nicely.

I got two tutorials that both use XA transactions with Aries:
http://liquid-reality.de/display/liquid/2015/06/30/Apache+Karaf+Tutorial+par
t+10+-+Declarative+services
http://liquid-reality.de/display/liquid/2015/03/05/Apache+Karaf+Tutorial+Par
t+9+-+Annotation+based+blueprint+and+JPA

Btw. Do you plan to use blueprint or DS?

Christian

On 03.09.2015 22:51, matthew.w.pi...@wellsfargo.com wrote:

Ok, maybe I can answer my own questions here, but if I could get some
confirmation that would be great. I seem to have a working system running
with 

Re: Bundle set recommendations for JPA+JTA+Eclipselink Partitioning?

2015-09-22 Thread Christian Schneider
Not sure why you hit the problem with dbcp2 and eclipselink. I have some 
itests running
with eclipselink and they showed no problems. Will look into what 
versions I used exactly.


I am not very familiar with the aries pooling but it should work fine.

Christian

Am 23.09.2015 um 02:48 schrieb matthew.w.pi...@wellsfargo.com:

Ok, thanks so much for the suggestions.

It is interesting to me that this isn't something someone else has seen
since I feel like I am using the pax-jdbc and aries bundles in a
straightforward way.

Do you have a recommendation of using the aries pool bundle vs. the dbcp2
one? I'm not set on either one, I just need it to work, have some
tweakability and perform well enough. I had been leaning towards dbcp2 since
it seems like a reasonable, actively developed pool implementation that I
have used elsewhere, but since it doesn't currently work for me I'm fine
using aries if it works and performs.

It seems to me that the aries pooling basically delegates back to the
Geronimo classes, which I would suspect are a decent pool implementation
themselves having originated as part of that project. But I have no
experience with them, so my confidence is low.

Obviously, I'll do some performance tests when all this comes together more,
but recommended best practices or known working bundle combinations are
always a good starting point. I'm still looking through your earlier
references and all the itest stuff to try to piece together a logical bundle
set, but it's slow for me as I am not very familiar with PaxExam.

Thanks,
-matt

-Original Message-
From: Christian Schneider [mailto:cschneider...@gmail.com] On Behalf Of
Christian Schneider
Sent: Tuesday, September 22, 2015 4:04 PM
To: user@aries.apache.org
Subject: Re: Bundle set recommendations for JPA+JTA+Eclipselink
Partitioning?

Honestly I have no idea why tranql sets the autocommit. I would not
expect that it needs to be tweaked.

I can imagine that dbcp2 does not allow to change autocommit for XA
transactions as the commit should
only be done when the XA transaction commits. Not sure about this either
though.

I propose you ask this on the apache commons list or open an issue for
dbcp2. It definitely seems to be an issue that
can also happen when just configuring dbcp2 manually and then use tranql
on it.

Christian

Am 22.09.2015 um 20:19 schrieb matthew.w.pi...@wellsfargo.com:

[1] is a snippet from the stacktrace I get when using pax-jdbc-pool-dbcp2
instead of -aries. As you can see,
ManagedJDBCConnection#localTransactionStart appears to call setAutoCommit

on

the connection class, which the DBCP2 impl short circuits at [2].

This same exact environment seems to run fine with the -aries pool bundle.

I

am running this with a customized transactions-jdbc bundle checked-out

from

SVN. But, the only change I made was the pull in all the tranql source to
fix issues with the two-arg form of getConnection in some of those

classes.

Aside from that it's unchanged and works fine with the -aries pooling
bundle.

Any suggestions are greatly appreciated.

[1]
Caused by: javax.resource.spi.LocalTransactionException: Unable to disable
autoCommit
at


org.tranql.connector.jdbc.ManagedJDBCConnection.localTransactionStart(Manage

dJDBCConnection.java:83)
~[org.apache.aries.transaction.jdbc-2.1.2-SNAPSHOT.jar:2.1.2-SNAPSHOT]
at


org.tranql.connector.AbstractManagedConnection$LocalTransactionImpl.begin(Ab

stractManagedConnection.java:195)
~[org.apache.aries.transaction.jdbc-2.1.2-SNAPSHOT.jar:2.1.2-SNAPSHOT]
at


org.apache.geronimo.connector.outbound.LocalXAResource.start(LocalXAResource

.java:107) ~[geronimo-connector-3.1.3.jar:3.1.3]
... 76 common frames omitted
Caused by: java.sql.SQLException: Auto-commit can not be set while

enrolled

in a transaction
at


org.apache.commons.dbcp2.managed.ManagedConnection.setAutoCommit(ManagedConn

ection.java:223) ~[na:na]
at


org.tranql.connector.jdbc.ManagedJDBCConnection.localTransactionStart(Manage

dJDBCConnection.java:81)
~[org.apache.aries.transaction.jdbc-2.1.2-SNAPSHOT.jar:2.1.2-SNAPSHOT]
... 78 common frames omitted

[2]
public void setAutoCommit(boolean autoCommit) throws SQLException {
  if (transactionContext != null) {
   
throw new SQLException("Auto-commit can not be set while enrolled in a

trans

action");
  }
  super.setAutoCommit(autoCommit);
}


-Original Message-
From: matthew.w.pi...@wellsfargo.com

[mailto:matthew.w.pi...@wellsfargo.com]

Sent: Tuesday, September 22, 2015 11:14 AM
To: user@aries.apache.org
Subject: RE: Bundle set recommendations for JPA+JTA+Eclipselink
Partitioning?

Thanks very much for the references, I will definitely be looking over

them.

I was hoping the dbcp2 bundle would allow for the same XA capability, as I
would prefer dbcp2 pooling since it seems fairly analogous to my current
pooling - bonecp. However, I did s

Re: JPA/JTA Error with PGXAConnection

2015-09-30 Thread Christian Schneider
; Co. KG
Dr.-Max-Ilgner-Straße 17
32339 Espelkamp

Persönlich haftende Gesellschafterin:
Gebäudereinigung Joachim Schulz
Verwaltungsgesellschaft mbH
Telefon: +49 5772 9100 0
Telefax: +49 5772 9100 11
Email: zentr...@sgbs.de <mailto:zentr...@sgbs.de>
Internet: www.sgbs.de <http://www.sgbs.de/>

Geschäftsführer: Joachim und Dirk Schulz, Norbert Kosica
Handelsregister Bad Oeynhausen: HRA 5902, HRB 8591
UST-Id-Nr.: DE 125752702




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

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



Re: Bundle set recommendations for JPA+JTA+Eclipselink Partitioning?

2015-10-06 Thread Christian Schneider
This is a complicated theme which is difficult to diagnose just from the 
outside.


I guess your problem already occurs when you have only one connection. 
Can you create a small example at github

that shows how you setup your application?

Using the non wrapped connections can work if some other layer is doing 
the enlistment (e.g. eclipselink) but I am not sure.

I am still wondering why I do not see the tranql problems in my tests.

Christian

Am 07.10.2015 um 00:15 schrieb matthew.w.pi...@wellsfargo.com:

Once again, thanks very much for the input and sorry for the late
response

Here's where I am at... I was pushing forward with just using the aries
pooling bundle, however it seemed to *not* do what I would normally expect
with connections after a query/exception problem. It would leave them in the
pool and allow for their reuse by subsequent queries. This would then lead
to 'Connection already closed' or 'communication link failure' type messages
in subsequent JPA operations unrelated to the previous problem.

With this, I tried once again to work with the PAX dbcp2 bundle and ran into
the same problems I had before with the tranql classes calling methods on
the wrapped connection that DBCP2 did not like. I went so far as to comment
some of the parts of the tranql ManagedJDBCConnection class to prevent it
calling down into the DBCP2 connection. When this happened, my
queries/transactions would continue on but then fail during another method
call (like #commit) where the DBCP2 connection would throw an exception
complaining about not being able to perform certain operations when
participating in a managed transaction. So, it seemed to me like my DBCP2
connections were already XA aware/enlisted (or whatever you call it) and
that the higher-level stuff in aries-jdbc/tranql was incompatible with them.

So, here is where it gets really interesting... thinking about this problem
I wondered if maybe I didn't even need the aries-wrapped datasources. So, I
changed my eclipselink/jpa JNDI lookups to be !(aries.managed=true), to
hopefully force eclipselink to use the DBCP2 XA datasource services
directly. Well, voila... this seems to not only work, but still provide the
xa/jta management as well. To test this I created a conflicting entity row
in only one of my three eclipselink partitions or 'nodes'. Attempting to
persist the corresponding entity in osgi via my jpa classes failed with the
expected exception indicating a conflicting row *and* inspecting the
database nodes showed that the only node with the row was the original node
where it was manually inserted for the test. So, I'm assuming this is an
indicator that the XA stuff ran as expected and prevented the insert from
propagating to other nodes because the coordinated transaction was rolled
back.

So, my question is - does this setup make sense? To have the aries
transaction manager/bundles in-place but not actually use the aries-managed
datasources? Perhaps there are facilities in the pax dbcp2 pool bundle that
does the auto-enlistment already? Perhaps I have no idea what I am talking
about?

Any guidance is greatly appreciated. Thanks.

-matt

-Original Message-
From: Christian Schneider [mailto:cschneider...@gmail.com] On Behalf Of
Christian Schneider
Sent: Wednesday, September 23, 2015 1:53 AM
To: user@aries.apache.org
Subject: Re: Bundle set recommendations for JPA+JTA+Eclipselink
Partitioning?

Not sure why you hit the problem with dbcp2 and eclipselink. I have some
itests running
with eclipselink and they showed no problems. Will look into what
versions I used exactly.

I am not very familiar with the aries pooling but it should work fine.

Christian

Am 23.09.2015 um 02:48 schrieb matthew.w.pi...@wellsfargo.com:

Ok, thanks so much for the suggestions.

It is interesting to me that this isn't something someone else has seen
since I feel like I am using the pax-jdbc and aries bundles in a
straightforward way.

Do you have a recommendation of using the aries pool bundle vs. the dbcp2
one? I'm not set on either one, I just need it to work, have some
tweakability and perform well enough. I had been leaning towards dbcp2

since

it seems like a reasonable, actively developed pool implementation that I
have used elsewhere, but since it doesn't currently work for me I'm fine
using aries if it works and performs.

It seems to me that the aries pooling basically delegates back to the
Geronimo classes, which I would suspect are a decent pool implementation
themselves having originated as part of that project. But I have no
experience with them, so my confidence is low.

Obviously, I'll do some performance tests when all this comes together

more,

but recommended best practices or known working bundle combinations are
always a good starting point. I'm still looking through your earlier
references and all the itest stuff to try to piece together a logical

bundle

Re: No currently active transaction

2015-10-08 Thread Christian Schneider
Registry.java:139)
at 
org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManagerHandler.getPersistenceContext(JTAEntityManagerHandler.java:104)
at 
org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManagerHandler.invoke(JTAEntityManagerHandler.java:182)

at com.sun.proxy.$Proxy21.persist(Unknown Source)
at sdm.txlog.TxLogService.write(TxLogService.java:218)
at sdm.txlog.TxLogParticipant$1.run(TxLogParticipant.java:28)
at sdm.txlog.TxLogParticipant.ended(TxLogParticipant.java:31)
at 
org.apache.felix.coordinator.impl.CoordinationImpl.end(CoordinationImpl.java:205)
at 
org.apache.felix.coordinator.impl.CoordinationHolder.end(CoordinationHolder.java:55)

at sdm.rs.CoordinationFilter.end(CoordinationFilter.java:144)
at sdm.rs.crm.SalesProspectResource.update(SalesProspectResource.java:187)
at sun.reflect.GeneratedMethodAccessor52.invoke(Unknown Source)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_75]

at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_75]
at 
org.apache.wink.server.internal.handlers.InvokeMethodHandler.handleRequest(InvokeMethodHandler.java:63)[133:org.amdatu.web.rest.wink:2.0.2]


I am using transaction attribute "Required".

I am running Apache Karaf 3.0.3 with Aries JTA and OpenJPA 2.2.2.

Thanx in advance for any help or hint.

Best regards

Mihael

Schulz Gebäudeservice GmbH & Co. KG
Dr.-Max-Ilgner-Straße 17
32339 Espelkamp

Persönlich haftende Gesellschafterin:
Gebäudereinigung Joachim Schulz
Verwaltungsgesellschaft mbH
Telefon: +49 5772 9100 0
Telefax: +49 5772 9100 11
Email: zentr...@sgbs.de <mailto:zentr...@sgbs.de>
Internet: www.sgbs.de <http://www.sgbs.de/>

Geschäftsführer: Joachim und Dirk Schulz, Norbert Kosica
Handelsregister Bad Oeynhausen: HRA 5902, HRB 8591
UST-Id-Nr.: DE 125752702




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

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



Re: No currently active transaction

2015-10-08 Thread Christian Schneider

Hi Mihael,

I do not see any calls to txLogService in this snippet. Is it called in 
coordinationFilter?
If yes then the question is how coordinationFilter is instantiated and 
how the txLogService is injected into it.


Christian

On 08.10.2015 13:49, Mihael Schmidt wrote:

Hi,

the coordination is handled on the same thread (as you can see in the 
log, TxLogParticipant logs on the same thread, the participant calls 
the service which persists data to the db).


REST resource:
try {
// check permission
Coordination coordination = coordinator.peek();
User user = (User) 
coordination.getVariables().get(User.class);

if (!user.getRoles().contains("xx.xx")) {
coordinationFilter.fail(new WebApplicationException(Status.UNAUTHORIZED));
throw new WebApplicationException(Status.UNAUTHORIZED);
}
try {
SalesProspect updatedPospect = service.update(prospect);
return Response.ok(updatedPospect).build();
}
catch(Exception e) {
logger.error("Fehler beim Aktualisieren des Interessenten " + 
prospect.getName(), e);

coordinationFilter.fail(e);
throw new 
WebApplicationException(Status.INTERNAL_SERVER_ERROR);

}
}
finally {
coordinationFilter.end();
}

My real question is: why isn't a new transaction created if none is 
active. The transaction attribute is "Required":






Best regards

Mihael


2015-10-08 13:14 GMT+02:00 Christian Schneider 
mailto:ch...@die-schneider.net>>:


Hi Mihael,

difficult to say without the actual source.

The problem occurs when the coordination ends. So maybe this
happens in  a different thread.
See

https://osgi.org/javadoc/r5/enterprise/org/osgi/service/coordinator/Participant.html#ended%28org.osgi.service.coordinator.Coordination%29

"Participants are required to be thread safe as notification can
be made on any thread. "

Can you paste the relevant code snippets of
SalesProspectResource.update?

It might also help to update to the new Aries JPA 2.2.0 version.
(Would be a bigger switch though).

Christian


On 08.10.2015 12:37, Mihael Schmidt wrote:

Hi,

I got a rest service where I am using multiple persistence units
and data sources to store data in different databases using
multiple transactions (I don't need all in one transaction). It
all happens on multiple threads.

I am getting an exception on the last persist where I want to
save some log in a database which happens on the same thread
where the rest service starts (qtp18495206-81) . It seems that
the EntityManager is cleared up before my call to persist. Is
that the reason for the exception?

2015-10-08 12:20:46,025 | DEBUG | qtp18495206-81   | context
 | 108 - org.apache.aries.jpa.container.context - 1.0.4 | Created

a new persistence context
org.apache.openjpa.persistence.EntityManagerImpl@1d911f for
transaction

[Xid:globalId=f2e7446501006f72672e6170616368652e61726965732e7472616e73616374696f6e,length=64,branchId=,length=64].
2015-10-08 12:20:46,183 | DEBUG | Thread-52| context
 | 108 -

org.apache.aries.jpa.container.context - 1.0.4 | Created a new
persistence context
org.apache.openjpa.persistence.EntityManagerImpl@1a615e2 for
transaction

[Xid:globalId=102e7446501006f72672e6170616368652e61726965732e7472616e73616374696f6e,length=64,branchId=,length=64].
2015-10-08 12:20:46,186 | DEBUG | Thread-52| context
 | 108 -

org.apache.aries.jpa.container.context - 1.0.4 | Clearing up
EntityManager
org.apache.openjpa.persistence.EntityManagerImpl@1a615e2 as the
transaction has completed.
2015-10-08 12:20:46,410 | DEBUG | Thread-52| context
 | 108 -

org.apache.aries.jpa.container.context - 1.0.4 | Created a new
persistence context
org.apache.openjpa.persistence.EntityManagerImpl@3fee6f for
transaction

[Xid:globalId=112e7446501006f72672e6170616368652e61726965732e7472616e73616374696f6e,length=64,branchId=,length=64].
2015-10-08 12:20:46,413 | DEBUG | Thread-52| context
 | 108 -

org.apache.aries.jpa.container.context - 1.0.4 | Clearing up
EntityManager
org.apache.openjpa.persistence.EntityManagerImpl@3fee6f as the
transaction has completed.
2015-10-08 12:20:46,491 | DEBUG | Thread-69| context
 | 108 -

org.apache.aries.jpa.container

  1   2   >