Re: Classloader woes: EAR containing an RAR

2018-08-01 Thread David Jencks
Does the CDI approach support consuming a message inside a transaction? Looking 
at one of the Kafka cdi examples, I didn’t immediately see how it would. Being 
able to roll back the consumption of a message always seemed one of the main 
points of jca to me.

Thanks
David Jencks 

Sent from my iPhone

> On Jul 31, 2018, at 9:59 PM, Romain Manni-Bucau  wrote:
> 
> I am happy to help you using the rar if you can setup a reproducer project
> but for kafka gain is pretty low and being cdi based opens more doors like
> composing with decorators, getting a better error handling than EJB,
> getting rid of some useless layer for kafka etc...but we can still do the
> exercise technically :)
> 
> Le mer. 1 août 2018 02:00, ChrisOwens  a écrit :
> 
>> Romain Manni-Bucau wrote
>>> If your goal is really to interact with kafka - and you dont care of rar
>>> by
>>> themselves - i would recommand to use a cdi extension,
>>> you can find several on the net like
>>> https://github.com/bgjug/kafka-cdi-extension and
>>> https://github.com/aerogear/kafka-cdi
>> 
>> 
>> Thank you.  I was hoping to use the message-driven-bean abstraction, but I
>> will look into these cdi extensions instead.
>> 
>> 
>> 
>> 
>> --
>> Sent from:
>> http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
>> 


Re: Classloader woes: EAR containing an RAR

2018-08-01 Thread ChrisOwens
I am trying to set up a reproducer project using the tomee maven plugin. 
I am looking at the plugin's new documentation page to which you referred
me. (Might I suggest that you take down the old, obsolete documentation
page, which is the first hit for google "tomee maven plugin", or at least
put in it a link to the new page?

My first attempt to get the plugin to put the rar in tomee's apps folder was
to add the rar as a project dependency and to  put this in the configuration
block of the plugin:



This failed with the following error, apparently the plugin was looking in
the repo for a jar file rather than a rar file:


My next thought was to use a synchronizer as defined by tomee-maven-plugin
to copy the rar file into the apps directory but the only info on the
documentation page about how to use a synchronizer was this:







--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html


Re: Classloader woes: EAR containing an RAR

2018-08-01 Thread Romain Manni-Bucau
Depends the people but personally I see JCA as deprecated by CDI addition
to JavaEE 6 (tomee or any other server). Goal being to realign the
programming model on the more natural one of marking a method as a listener
rather than having this heavy process to define inbound/outbound connectors
+ the related packaging. JCA got some work on that area to have some
command oriented pattern but it stays very heavy compared to the more
widespread CDI based solution.

Romain Manni-Bucau
@rmannibucau  |  Blog
 | Old Blog
 | Github  |
LinkedIn  | Book



Le mer. 1 août 2018 à 15:50, ChrisOwens  a écrit :

> Putting aside for a moment the question of whether or not the adapter is
> packaged in a rar file, what is your opinion of JCA for a JavaEE 7
> application hosted on TomeEE +?  Use it or avoid it?
>
>
>
>
>
> --
> Sent from:
> http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
>


Re: Classloader woes: EAR containing an RAR

2018-08-01 Thread ChrisOwens
Putting aside for a moment the question of whether or not the adapter is
packaged in a rar file, what is your opinion of JCA for a JavaEE 7
application hosted on TomeEE +?  Use it or avoid it?





--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html


Re: Classloader woes: EAR containing an RAR

2018-07-31 Thread Romain Manni-Bucau
I am happy to help you using the rar if you can setup a reproducer project
but for kafka gain is pretty low and being cdi based opens more doors like
composing with decorators, getting a better error handling than EJB,
getting rid of some useless layer for kafka etc...but we can still do the
exercise technically :)

Le mer. 1 août 2018 02:00, ChrisOwens  a écrit :

> Romain Manni-Bucau wrote
> > If your goal is really to interact with kafka - and you dont care of rar
> > by
> > themselves - i would recommand to use a cdi extension,
> > you can find several on the net like
> > https://github.com/bgjug/kafka-cdi-extension and
> > https://github.com/aerogear/kafka-cdi
>
>
> Thank you.  I was hoping to use the message-driven-bean abstraction, but I
> will look into these cdi extensions instead.
>
>
>
>
> --
> Sent from:
> http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
>


Re: Classloader woes: EAR containing an RAR

2018-07-31 Thread ChrisOwens
Romain Manni-Bucau wrote
> If your goal is really to interact with kafka - and you dont care of rar
> by
> themselves - i would recommand to use a cdi extension,
> you can find several on the net like
> https://github.com/bgjug/kafka-cdi-extension and
> https://github.com/aerogear/kafka-cdi


Thank you.  I was hoping to use the message-driven-bean abstraction, but I
will look into these cdi extensions instead.




--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html


Re: Classloader woes: EAR containing an RAR

2018-07-31 Thread ChrisOwens
Romain Manni-Bucau wrote
> Rar is kind of really overkill for any new code in java 6 but if you
> already have the connector it is fine to deploy it but quite rare.

I would love to get rid of the rar file and the whole deployment mess. 

Thus far, I have tried putting the sources for the java classes that
implement the JCA connector, directly into the module that compiles to my
war file, and I get an error that implies that the container has not created
the connector.:



I don't know why the container is not picking up the connector. 
A class implements ActivationSpec is annotated with @Activation

A class implements ResourceAdapter and is annotated with @Connector

A class implements ManagedConnectionFactory and is annotated
@ConnectionDefinition 

am I missing something?




--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html


Re: Classloader woes: EAR containing an RAR

2018-07-31 Thread Romain Manni-Bucau
Le mar. 31 juil. 2018 à 17:21, ChrisOwens  a écrit :

> Romain Manni-Bucau wrote
> > 1. self contained and not used in another modules (ejb or web) -> you
> > register it in tomee.xml (in
> > 
> >  + config if needed) and that's it
>
> What does "+ config if needed" mean? I think you mean I should put some
> config information somewhere. Where? In some XML file? In some java class?
> In the RAR? Directly in tomEE.xml?
>

There are ways to override the ra.xml config through  blocks.


>
> The support forums are full of people asking "How do I deploy a RAR in
> TomEE?" and tearing out their hair because they can't get an answer.
> Somehow RAR files seem to be a blind spot in the documentation. Is it
> because nobody is using them? Should I be considering some alternative
> approach?
>

Rar is kind of really overkill for any new code in java 6 but if you
already have the connector it is fine to deploy it but quite rare.


>
> What I am trying to do is have a message-driven bean that handles Kafka
> messages.  There's a sample implementation  here
> <
> https://abhirockzz.wordpress.com/2017/05/30/consume-from-kafka-topics-using-message-driven-beans/>
>
> , that makes use of a connector RAR published by the Payara project ( here
>   ). I have
> been all over the RAR from Payara and it seems to be fully compliant with
> JavaEE 7; nothing in there that makes use of any special Payara features,
> etc.
>

If your goal is really to interact with kafka - and you dont care of rar by
themselves - i would recommand to use a cdi extension,
you can find several on the net like
https://github.com/bgjug/kafka-cdi-extension and
https://github.com/aerogear/kafka-cdi


>
> With a fresh copy of TomEE 7.0.5, I tried adding, to
> ${CATALINA_BASE}/conf/tomee.xml, a Deployments element that references the
> RAR, and then starting the server. The server failed claiming it can't find
> a class that is referred to in the connector code.   Here is the relevant
> part of the log:
>
>
Side note: this part of your mail got eaten so we (I with gmail?) don't see
the log error or the next lib listing.


>
>
> I have examined the RAR, and the class that TomEE can't find, is definitely
> there, in one of the JARs included in the RAR.
>

The libs are found scanning the rar content directly.


>
> The RAR looks like this:
>
>
> And kafka-clients-0.10.2.1.jar contained in the rar, contains this:
>
>
>
>
>
>
>
> --
> Sent from:
> http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
>


Re: Classloader woes: EAR containing an RAR

2018-07-31 Thread Romain Manni-Bucau
Le mar. 31 juil. 2018 à 17:22, ChrisOwens  a écrit :

> Romain Manni-Bucau wrote
> >  Are you able to push a reproducer on github with the tomee-maven-plugin
> > configured?
>
> I'm working on that now. I don't usually use the tomee-maven-plugin, so I
> thought I would check the documentation  here
>   . The version of the
> plugin mentioned in the documentation is four years out of date. Also,  the
> documentation contains this line:
>
>
>
> I obviously have no clue what that is supposed to mean.
>


this is because it is the old doc, if you follow the new one you end up on
http://tomee.apache.org/developer/tools/maven/tomee.html

>
>
>
>
>
>
>
>
> --
> Sent from:
> http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
>


Re: Classloader woes: EAR containing an RAR

2018-07-31 Thread ChrisOwens
Romain Manni-Bucau wrote
>  Are you able to push a reproducer on github with the tomee-maven-plugin
> configured?

I'm working on that now. I don't usually use the tomee-maven-plugin, so I
thought I would check the documentation  here
  . The version of the
plugin mentioned in the documentation is four years out of date. Also,  the
documentation contains this line:



I obviously have no clue what that is supposed to mean.








--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html


Re: Classloader woes: EAR containing an RAR

2018-07-31 Thread ChrisOwens
Romain Manni-Bucau wrote
> 1. self contained and not used in another modules (ejb or web) -> you
> register it in tomee.xml (in 
> 
>  + config if needed) and that's it

What does "+ config if needed" mean? I think you mean I should put some
config information somewhere. Where? In some XML file? In some java class? 
In the RAR? Directly in tomEE.xml?

The support forums are full of people asking "How do I deploy a RAR in
TomEE?" and tearing out their hair because they can't get an answer. 
Somehow RAR files seem to be a blind spot in the documentation. Is it
because nobody is using them? Should I be considering some alternative
approach? 

What I am trying to do is have a message-driven bean that handles Kafka
messages.  There's a sample implementation  here

 
, that makes use of a connector RAR published by the Payara project ( here
  ). I have
been all over the RAR from Payara and it seems to be fully compliant with
JavaEE 7; nothing in there that makes use of any special Payara features,
etc.   

With a fresh copy of TomEE 7.0.5, I tried adding, to
${CATALINA_BASE}/conf/tomee.xml, a Deployments element that references the
RAR, and then starting the server. The server failed claiming it can't find
a class that is referred to in the connector code.   Here is the relevant
part of the log:



I have examined the RAR, and the class that TomEE can't find, is definitely
there, in one of the JARs included in the RAR. 

The RAR looks like this:


And kafka-clients-0.10.2.1.jar contained in the rar, contains this:







--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html


Re: Classloader woes: EAR containing an RAR

2018-07-31 Thread Romain Manni-Bucau
Hi,

"it" meant the connector api

Hi level you have mainly 2 cases for rars (i ignore the webapp nested war
support here):

1. self contained and not used in another modules (ejb or web) -> you
register it in tomee.xml (in  + config if needed) and that's it
2. you use it as a connector for another part of the app -> you have to
ensure the API is shared so you put the api in tomee/lib for instance
(shared between the connector and the other module at least) and deploy both

In the case of an ear, the connector libs should be shared by ejbmodules
and webmodules (
https://github.com/apache/tomee/blob/master/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java#L2666).
means in the 2 case you dont have to use tomee/lib. In other words, it
should work smoothly out of the box. The webapps are started after the
connectors and the ejb are started (for the @Startup ones) after the
connector resources are created too so it should be fine. Are you able to
push a reproducer on github with the tomee-maven-plugin configured?

In terms of logs, you should see that some resources related to the rar are
created.

Romain Manni-Bucau
@rmannibucau  |  Blog
 | Old Blog
 | Github  |
LinkedIn  | Book



Le mar. 31 juil. 2018 à 13:25, ChrisOwens  a écrit :

>
> Let me ask what I hope is a simpler question, but 2 days of searching
> online
> lead me to believe that lots of people have this problem and there is no
> documented solution.
>
> 1) I have a RAR file that describes a JCA connector.
>
> 2) I would like to use it with TomEE.
>
> 3) What should I do?
>
>
>
>
>
> --
> Sent from:
> http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
>


Re: Classloader woes: EAR containing an RAR

2018-07-31 Thread ChrisOwens


Let me ask what I hope is a simpler question, but 2 days of searching online
lead me to believe that lots of people have this problem and there is no
documented solution. 

1) I have a RAR file that describes a JCA connector.

2) I would like to use it with TomEE. 

3) What should I do?





--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html


Re: Classloader woes: EAR containing an RAR

2018-07-31 Thread ChrisOwens
Romain Manni-Bucau wrote
> Hi
> 
> The api part of the rar should be shared so put 
*
> it 
*
> in tomee/lib (or the ear
> lib module). 

Thanks Romain 

1) "It" refers to what? The rar file? the API part of the rar, as an
ordinary jar? 

2) "tomee/lib"? That means $CATALINA_HOME/lib? 

3) "the ear lib module".   I think what you are saying is that I can put the
rar in the ear under /lib.  That failed with the same NoClassDefFound error.
Or maybe you meant  that I can put the jar that contains the classes in
/lib? 

At any rate, here's what I tried:
1) putting the rar in $CATALINA_HOME/lib. No effect
2) putting the jar files from the rar in $CATALINA_HOME/lib. Problem of
missing class defs went away, but the container has not registered the
connector in the rar
3) putting the rar file in the /lib directory of the ear file. No effect





--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html


Re: Classloader woes: EAR containing an RAR

2018-07-31 Thread ChrisOwens
Romain Manni-Bucau wrote
> The api part of the rar should be shared so put
*
>  it
*
>  in tomee/lib (or the ear
> lib module). 

Thanks Romain 

1) "It" refers to what? The rar file? the API part of the rar, as an
ordinary jar? 

2) "tomee/lib"? That means $CATALINA_HOME/lib? 

3) "the ear lib module".   I think what you are saying is that I can put the
rar in the ear under /lib.  That failed with the same NoClassDefFound error.
Or maybe you meant  that I can put the jar that contains the classes in
/lib? 

At any rte, here's what I tried:
1) putting the rar in $CATALINA_HOME/lib. No effect
2) putting the jar files from the rar in $CATALINA_HOME/lib. Problem of
missing class defs went away, but the container has not registered the
connector in the rar
3) putting the rar file in the /lib directory of the ear file. No effect




--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html


Re: Classloader woes: EAR containing an RAR

2018-07-30 Thread Romain Manni-Bucau
If there is no annotation i dont recall if the ra.xml is read. We have a
nested rar support in wars but it is really advanced and surely not desired
outside cloud hosting (where you dont have other choices).

In any case some repackaging is needed.


Le lun. 30 juil. 2018 22:08, David Jencks  a
écrit :

> I was actually thinking of putting the entire classes jar from inside the
> rar into the ear lib module, not exploding the rar.  There weren’t any
> annotations in the last rar spec I worked with…
>
> David Jencks
>
> > On Jul 30, 2018, at 12:33 PM, Romain Manni-Bucau 
> wrote:
> >
> > Hi
> >
> > The api part of the rar should be shared so put it in tomee/lib (or the
> ear
> > lib module). Worse case, David's trick of exploding the rar in the ear
> can
> > work if it uses annotations (just put it in any scanned module).
> >
> > Le lun. 30 juil. 2018 21:09, David Jencks  a
> > écrit :
> >
> >> Hopefully someone who actually knows something will speak up soon…
> >> You might try putting the rar classes in a lib jar in the ear.  I don’t
> >> recall if you have to do something with  the manifest class path in the
> ejb
> >> module and rar to get this to  work.
> >>
> >> David Jencks
> >>
> >>> On Jul 30, 2018, at 11:16 AM, ChrisOwens 
> wrote:
> >>>
> >>> I am deploying (tomEE-plus 7.0.5) an EAR file that contains two
> modules:
> >> a
> >>> JCA connector defined in a rar file, and a JAR full of ejbs. The EJBs
> >>> contain classes that depend upon classes packaged in the RAR.
> >>>
> >>> Whether or not I set "initialize-in-order" to true, I get the same
> >> behavior:
> >>> The logs show no evidence that the server has tried to deploy the RAR,
> >>> instead it begins deploying the ejb module, and fails with
> >>> NoClassDefFoundError.
> >>>
> >>> If I delete the ejb module from the ear, leaving only the rar module,
> and
> >>> deploy the ear, the server appears to deploy the rar module happily.
> >>>
> >>> Jonathan Gallimore posted something a while back that I thought was
> >> related
> >>> to this problem, something about resource adapter class loading being
> >> lazy;
> >>> I thought there was even a pull request for it, but I can't seem to
> find
> >> any
> >>> of that now.
> >>>
> >>> Is there a workaround?
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>> Sent from:
> >> http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
> >>
> >>
>
>


Re: Classloader woes: EAR containing an RAR

2018-07-30 Thread David Jencks
I was actually thinking of putting the entire classes jar from inside the rar 
into the ear lib module, not exploding the rar.  There weren’t any annotations 
in the last rar spec I worked with…

David Jencks

> On Jul 30, 2018, at 12:33 PM, Romain Manni-Bucau  
> wrote:
> 
> Hi
> 
> The api part of the rar should be shared so put it in tomee/lib (or the ear
> lib module). Worse case, David's trick of exploding the rar in the ear can
> work if it uses annotations (just put it in any scanned module).
> 
> Le lun. 30 juil. 2018 21:09, David Jencks  a
> écrit :
> 
>> Hopefully someone who actually knows something will speak up soon…
>> You might try putting the rar classes in a lib jar in the ear.  I don’t
>> recall if you have to do something with  the manifest class path in the ejb
>> module and rar to get this to  work.
>> 
>> David Jencks
>> 
>>> On Jul 30, 2018, at 11:16 AM, ChrisOwens  wrote:
>>> 
>>> I am deploying (tomEE-plus 7.0.5) an EAR file that contains two modules:
>> a
>>> JCA connector defined in a rar file, and a JAR full of ejbs. The EJBs
>>> contain classes that depend upon classes packaged in the RAR.
>>> 
>>> Whether or not I set "initialize-in-order" to true, I get the same
>> behavior:
>>> The logs show no evidence that the server has tried to deploy the RAR,
>>> instead it begins deploying the ejb module, and fails with
>>> NoClassDefFoundError.
>>> 
>>> If I delete the ejb module from the ear, leaving only the rar module, and
>>> deploy the ear, the server appears to deploy the rar module happily.
>>> 
>>> Jonathan Gallimore posted something a while back that I thought was
>> related
>>> to this problem, something about resource adapter class loading being
>> lazy;
>>> I thought there was even a pull request for it, but I can't seem to find
>> any
>>> of that now.
>>> 
>>> Is there a workaround?
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> --
>>> Sent from:
>> http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
>> 
>> 



Re: Classloader woes: EAR containing an RAR

2018-07-30 Thread Romain Manni-Bucau
Hi

The api part of the rar should be shared so put it in tomee/lib (or the ear
lib module). Worse case, David's trick of exploding the rar in the ear can
work if it uses annotations (just put it in any scanned module).

Le lun. 30 juil. 2018 21:09, David Jencks  a
écrit :

> Hopefully someone who actually knows something will speak up soon…
> You might try putting the rar classes in a lib jar in the ear.  I don’t
> recall if you have to do something with  the manifest class path in the ejb
> module and rar to get this to  work.
>
> David Jencks
>
> > On Jul 30, 2018, at 11:16 AM, ChrisOwens  wrote:
> >
> > I am deploying (tomEE-plus 7.0.5) an EAR file that contains two modules:
> a
> > JCA connector defined in a rar file, and a JAR full of ejbs. The EJBs
> > contain classes that depend upon classes packaged in the RAR.
> >
> > Whether or not I set "initialize-in-order" to true, I get the same
> behavior:
> > The logs show no evidence that the server has tried to deploy the RAR,
> > instead it begins deploying the ejb module, and fails with
> > NoClassDefFoundError.
> >
> > If I delete the ejb module from the ear, leaving only the rar module, and
> > deploy the ear, the server appears to deploy the rar module happily.
> >
> > Jonathan Gallimore posted something a while back that I thought was
> related
> > to this problem, something about resource adapter class loading being
> lazy;
> > I thought there was even a pull request for it, but I can't seem to find
> any
> > of that now.
> >
> > Is there a workaround?
> >
> >
> >
> >
> >
> >
> > --
> > Sent from:
> http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
>
>


Re: Classloader woes: EAR containing an RAR

2018-07-30 Thread David Jencks
Hopefully someone who actually knows something will speak up soon…
You might try putting the rar classes in a lib jar in the ear.  I don’t recall 
if you have to do something with  the manifest class path in the ejb module and 
rar to get this to  work.

David Jencks

> On Jul 30, 2018, at 11:16 AM, ChrisOwens  wrote:
> 
> I am deploying (tomEE-plus 7.0.5) an EAR file that contains two modules: a
> JCA connector defined in a rar file, and a JAR full of ejbs. The EJBs
> contain classes that depend upon classes packaged in the RAR. 
> 
> Whether or not I set "initialize-in-order" to true, I get the same behavior: 
> The logs show no evidence that the server has tried to deploy the RAR,
> instead it begins deploying the ejb module, and fails with
> NoClassDefFoundError. 
> 
> If I delete the ejb module from the ear, leaving only the rar module, and
> deploy the ear, the server appears to deploy the rar module happily.
> 
> Jonathan Gallimore posted something a while back that I thought was related
> to this problem, something about resource adapter class loading being lazy;
> I thought there was even a pull request for it, but I can't seem to find any
> of that now. 
> 
> Is there a workaround?
> 
> 
> 
> 
> 
> 
> --
> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html



Classloader woes: EAR containing an RAR

2018-07-30 Thread ChrisOwens
I am deploying (tomEE-plus 7.0.5) an EAR file that contains two modules: a
JCA connector defined in a rar file, and a JAR full of ejbs. The EJBs
contain classes that depend upon classes packaged in the RAR. 

Whether or not I set "initialize-in-order" to true, I get the same behavior: 
The logs show no evidence that the server has tried to deploy the RAR,
instead it begins deploying the ejb module, and fails with
NoClassDefFoundError. 

If I delete the ejb module from the ear, leaving only the rar module, and
deploy the ear, the server appears to deploy the rar module happily.

Jonathan Gallimore posted something a while back that I thought was related
to this problem, something about resource adapter class loading being lazy;
I thought there was even a pull request for it, but I can't seem to find any
of that now. 

Is there a workaround?






--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html