Re: Does hibernate work in karaf 4.1 (it does in 4.0)?

2017-08-09 Thread Jean-Baptiste Onofré

Hi,

I didn't have time to validate the feature before the release. Let me take a 
look and try to reproduce.


Regards
JB

On 08/09/2017 01:32 PM, MikeNow wrote:

Karaf 4.1.2 has been released. Could you confirm or deny that
Hibernate Validator (builtin feature) does not work in Karaf?

I am haunted either by ScriptException class not found or
ExpressionFactoryImpl class not found exceptions.
I tried every possible configuration from frequently referenced:
https://github.com/hibernate/hibernate-validator/blob/5.4/osgi/integrationtest/src/test/java/org/hibernate/validator/osgi/integrationtest/OsgiIntegrationTest.java



--
View this message in context: 
http://karaf.922171.n3.nabble.com/Does-hibernate-work-in-karaf-4-1-it-does-in-4-0-tp4050737p4051197.html
Sent from the Karaf - User mailing list archive at Nabble.com.



--
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: Does hibernate work in karaf 4.1 (it does in 4.0)?

2017-08-03 Thread Jean-Baptiste Onofré

Hi,

thanks for the update.

We are preparing the 4.1.2 release. I will take a look just after.

Regards
JB

On 08/03/2017 03:51 PM, MikeNow wrote:

I can attest that this bug does in fact occur even with "vanilla" Karaf
Hibernate features.

I created a minimal test case:

https://github.com/Mike-Now/Karaf-Tutorial/tree/master/cxf/personservice-rest

Just run:

mvn clean install

and add features.xml to your karaf instance.

If, by luck, the karaf instance won't freeze while installing bundle "tut",
you will
be presented with:

"java.lang.ClassNotFoundException: com.sun.el.ExpressionFactoryImpl not
found by org.hibernate.validator".




--
View this message in context: 
http://karaf.922171.n3.nabble.com/Does-hibernate-work-in-karaf-4-1-it-does-in-4-0-tp4050737p4051153.html
Sent from the Karaf - User mailing list archive at Nabble.com.



--
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: Does hibernate work in karaf 4.1 (it does in 4.0)?

2017-06-14 Thread Achim Nierbeck
Hi tom,

I know Karaf 4.1.1 and Hibernate works, though I don't have an OSS project
at hand to prove it.
I might sound a bit grumpy, but my gut feeling tells me the root to your
issues are those bndtools generated bundles.
I fear sometimes they do provide to much "included" when run in a Karaf
env.
If you want to have a Karaf with Hibernate running, start with a vanilla
Karaf (not minimal).
Issue the following commands:
feature:install hibernate
feature:install jpa
You'll see that most of the required bundles are already available.
For example a bundle providing Expression Language.

Just as a hint, maybe it's best to start off with a vanilla Karaf and if
you know the features are working, and you know which ones are actually
required, to go down the path of building a customized karaf.

regards, Achim




2017-06-14 20:36 GMT+02:00 :

> I've been struggling to get our code that uses Hibernate to work within
> Karaf 4.1 today.
> I have created a simple test case, which is on github:
> https://github.com/tomq42/karaf-tests-hibernate. There are a variety of
> branches, each with a different combination of hibernate and karaf. The
> branches karaf_4.0.9 and hibernate_5.3.4_karaf_4.1.1 are the most
> interesting.
>
> My test is to have a bundle with an activator, where the start method just
> does:
>
> javax.validation.Validation
> .byProvider(HibernateValidator.class)
> .providerResolver(new MyProviderResolver())
> .configure()
> .buildValidatorFactory()
> .getValidator();
>
> I write the java with bndtools in Eclipse. I then run the gradle script
> provided by bndtools to publish the resulting bundle to my local maven
> repository. I then run maven to build a feature containing the bundle, and
> then use the karaf-assembly packaging to product a karaf distribution,
> including the karaf "enterprise" feature repository, and hence its
> "hibernate-validator" feature. I then run the distribution, and it either
> says "great, created a validator", or prints a nasty stack trace.
>
> If I try this with karaf 4.1.1, I can't get it to work. It fails with
>
>   javax.validation.ValidationException: HV000183: Unable to initialize
> 'javax.el.ExpressionFactory'. Check that you have the EL dependencies on
> the classpath
>...
>   Caused by: java.lang.ClassNotFoundException: 
> com.sun.el.ExpressionFactoryImpl
> not found by org.hibernate.validator
>
>
> The thing is that I try with Karaf 4.0.9, and I *can* get it to work. Same
> code, just compiled against different versions of hibernate, so that the
> requirements match the version of karaf. In both cases, I have configured
> Eclipse/bndtools to use the same version of hibernate as that version of
> Karaf ships with.
>
> Karaf 4.0 series seems to use hibernate 5.0.3, Karaf 4.1 seems to use
> hibernate 5.3.4.
>
> From within eclipse I can run OSGi using bndtools. If I compile and run
> against Hibernate 5.0, and ensure that the glassfish.javax.el bundle is
> available at runtime, I can successfully create a validator. I can then
> build the same bundle and build my Karaf 4.0 based distribution, and the
> result runs. I can use hibernate 5.2 as well, and that works within
> bndtools (I'm not sure I would know how to make karaf use a later version
> of hibernate than the one it ships with).
>
> If I build and run against hibernate 5.3 within bndtools, I get the error
> (java.lang.ClassNotFoundException: com.sun.el.ExpressionFactoryImpl), and
> I get the same if I then build the java and build my karaf 4.1 based
> distribution. Note that in both cases I have the glassfish.javax.el
> available, so the com.sun.el classes should be available.
>
> For a while I was convinced that it was a problem with boot class
> delegation, since com.sun.* is in the org.osgi.framework.bootdelegation
> setting in the config.properties file. I wondered whether because of that
> boot class delegation, it wouldn't attempt to load the classes out of the
> bundle, and instead try to load them from the boot classloader. However the
> same is true in Karaf 4.0.9, and it works fine there. So I think that was a
> red herring.
>
> So something seems to changed within hibernate to render it incompatible
> with Karaf 4.1?
>
> So I'm out of ideas. The fact that it works in 4.0.9 suggest that
> fundamentally I'm not doing anything wrong, and that something has changed
> in hibernate to cause this to now fail.
>
> I found an old thread on this list on which Christian had posted a link to
> some test cases for Hibernate, here: https://github.com/hibernate/
> hibernate-validator/blob/master/osgi/integrationtest/
> src/test/java/org/hibernate/validator/osgi/integrationtest/
> OsgiIntegrationTest.java. I have experimented with using context class
> loaders, as per the test case, in the hope that this might fix it, but it
> doesn't seem to.
>
> Can anyone confirm whether hibernate works on 4.1.1, and if so, what I'm
> doing wrong? I'm hoping