Issue with TomEE startup

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue with TomEE startup

Dignesh
Hi,

I am using 7.0.2 version of TomEE.

I have 2 ears , a.ear and b.ear.  Below is how modified my tomee.xml to
deploy both the ear's

        <Deployments file="folder1/a.ear"/>
        <Deployments file="folder2\b.ear"/>

I have a war (b1.war) in b.ear which contains classes referencing to lib
directory in a.ear. I am seeing the classnotfound exceptions when starting
the server . The classes are actually present in the lib directory of a.ear.
Is there a way to specify the deployment dependency between a.ear and b.ear
? or is there some additional configuration to be done which i am missing
here. ?

Please help out on this issue.

Thank you



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
Reply | Threaded
Open this post in threaded view
|

Re: Issue with TomEE startup

Romain Manni-Bucau
Hi Dignesh,

Ears are isolated so if you want to use a lib of ear a in ear b you need to
ensure it is in b libs.



Le 23 janv. 2018 04:50, "Dignesh" <[hidden email]> a écrit :

Hi,

I am using 7.0.2 version of TomEE.

I have 2 ears , a.ear and b.ear.  Below is how modified my tomee.xml to
deploy both the ear's

        <Deployments file="folder1/a.ear"/>
        <Deployments file="folder2\b.ear"/>

I have a war (b1.war) in b.ear which contains classes referencing to lib
directory in a.ear. I am seeing the classnotfound exceptions when starting
the server . The classes are actually present in the lib directory of a.ear.
Is there a way to specify the deployment dependency between a.ear and b.ear
? or is there some additional configuration to be done which i am missing
here. ?

Please help out on this issue.

Thank you



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
Reply | Threaded
Open this post in threaded view
|

Re: Issue with TomEE startup

Dignesh
is there any way we can share lib between two ears ?
perhaps something like shared.loader or common.loader properties in
catalina.properties file ?



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
Reply | Threaded
Open this post in threaded view
|

Re: Issue with TomEE startup

Romain Manni-Bucau
Yes, common.loader if both dont use EE features.

Le 23 janv. 2018 07:06, "Dignesh" <[hidden email]> a écrit :

> is there any way we can share lib between two ears ?
> perhaps something like shared.loader or common.loader properties in
> catalina.properties file ?
>
>
>
> --
> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-
> f982480.html
>
Reply | Threaded
Open this post in threaded view
|

Re: Issue with TomEE startup

Dignesh
Both uses EE features. Is there any other way we can add dependency between
the ears. I dont want lib jars of one ear to be copied to the other ear. (I
feel this is redundant) . perhaps any other way ?
Thank you



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
Reply | Threaded
Open this post in threaded view
|

Re: Issue with TomEE startup

Dignesh
Hi Romain,

I copied all the jars of lib in ear a to the lib in ear b. I am seeing
classcastexceptions now. perhaps this could be due to the class loading
conflicts ?

dignesh.learning.MyPoolTest cannot be cast to dignesh.learning.MyPoolTest.

MyPoolTest class is present in lib of both ear a and b



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
Reply | Threaded
Open this post in threaded view
|

Re: Issue with TomEE startup

Romain Manni-Bucau
Do you do a global lookup of a not remote bean in the other ear? This
doesnt work.

Alternatives are to use jars.txt or the system property to scan the
container but I would recommand you to sanitize your ears to comply to the
spec.

Le 23 janv. 2018 07:43, "Dignesh" <[hidden email]> a écrit :

> Hi Romain,
>
> I copied all the jars of lib in ear a to the lib in ear b. I am seeing
> classcastexceptions now. perhaps this could be due to the class loading
> conflicts ?
>
> dignesh.learning.MyPoolTest cannot be cast to dignesh.learning.MyPoolTest.
>
> MyPoolTest class is present in lib of both ear a and b
>
>
>
> --
> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-
> f982480.html
>
Reply | Threaded
Open this post in threaded view
|

Re: Issue with TomEE startup

Dignesh
Yes , I am doing a lookup of non remote bean. I can make it remote.

I am unclear on the below statement. Can you please elaborate more ?
Alternatives are to use jars.txt or the system property to scan the
container

can you tell me how to use jars.txt - I am not aware of this. Any doc or
reference ?
the system property to scan the container - ? what does this mean ?

Thank you very much again



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
Reply | Threaded
Open this post in threaded view
|

Re: Issue with TomEE startup

Romain Manni-Bucau
2018-01-23 8:36 GMT+01:00 Dignesh <[hidden email]>:

> Yes , I am doing a lookup of non remote bean. I can make it remote.
>
> I am unclear on the below statement. Can you please elaborate more ?
> Alternatives are to use jars.txt or the system property to scan the
> container
>
> can you tell me how to use jars.txt - I am not aware of this. Any doc or
> reference ?
>

META-INF/jars.txt can contain one dependency per line either in maven style
or a plain file path


> the system property to scan the container - ? what does this mean ?
>
>
openejb.scan.webapp.container=true in conf/system.properties

and tomee/lib will be scanned as it would be part of the app


> Thank you very much again
>
>
>
> --
> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-
> f982480.html
>
Reply | Threaded
Open this post in threaded view
|

Re: Issue with TomEE startup

Dignesh
Hi Romain,

jar.txt file should be added in META-INF of ear or war.

below are the contents of my file - is the format correct ?

C:\dignesh\a.jar
C:\b\commons-logging-1.1.1.jar



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
Reply | Threaded
Open this post in threaded view
|

Re: Issue with TomEE startup

Dignesh
Hi Romain,

when i add it in the META-INF of ear it is working fine.
I added it in below format in jars.txt file

C:\dignesh\*.jar

Still i am getting the below error

dignesh.learning.MyPoolTest cannot be cast to dignesh.learning.MyPoolTest

Is it mandatory to declare the bean as Remote ?



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
Reply | Threaded
Open this post in threaded view
|

Re: Issue with TomEE startup

Romain Manni-Bucau
2018-01-23 12:50 GMT+01:00 Dignesh <[hidden email]>:

> Hi Romain,
>
> when i add it in the META-INF of ear it is working fine.
> I added it in below format in jars.txt file
>

yes ear (WEB-INF for a war not in an ear)


>
> C:\dignesh\*.jar
>
> Still i am getting the below error
>
> dignesh.learning.MyPoolTest cannot be cast to dignesh.learning.MyPoolTest
>
> Is it mandatory to declare the bean as Remote ?
>

Yes

Im tempted to say you dont want 2 ears but merge them both in a single one
from what you describe


>
>
>
> --
> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-
> f982480.html
>
Reply | Threaded
Open this post in threaded view
|

Re: Issue with TomEE startup

Dignesh
Hi Romain,

I cannot merge the 2 ears in to the single ear,reason is i want others to
deploy there own custom apps without affecting the one which i had
developed.

Also i made the change for bean in ear a to be remote and when i accessed
the bean from ear b it is throwing the classcastexception, So could this be
due to the same class loaded by 2 different class loaders ?
How can i solve this ?




--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
Reply | Threaded
Open this post in threaded view
|

Re: Issue with TomEE startup

Romain Manni-Bucau
If you put the remote API in both modules - and impl only in the ear where
it is deployed - you should be able to load it properly.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau>

2018-01-23 14:10 GMT+01:00 Dignesh <[hidden email]>:

> Hi Romain,
>
> I cannot merge the 2 ears in to the single ear,reason is i want others to
> deploy there own custom apps without affecting the one which i had
> developed.
>
> Also i made the change for bean in ear a to be remote and when i accessed
> the bean from ear b it is throwing the classcastexception, So could this be
> due to the same class loaded by 2 different class loaders ?
> How can i solve this ?
>
>
>
>
> --
> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-
> f982480.html
>
Reply | Threaded
Open this post in threaded view
|

Re: Issue with TomEE startup

Dignesh
Hi Romain,

Sorry to trouble you again!! I am not clear on what you said..Can you please
elaborate more

If you put the remote API in both modules - and impl only in the ear where
it is deployed



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
Reply | Threaded
Open this post in threaded view
|

Re: Issue with TomEE startup

Romain Manni-Bucau
a.ear
 |- remote-api.jar
 `- remote-impl.jar
b.ear
 |- remote-api.jar
 `- custom.jar

this kind of deployment should work out of the box



Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau>

2018-01-23 14:49 GMT+01:00 Dignesh <[hidden email]>:

> Hi Romain,
>
> Sorry to trouble you again!! I am not clear on what you said..Can you
> please
> elaborate more
>
> If you put the remote API in both modules - and impl only in the ear where
> it is deployed
>
>
>
> --
> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-
> f982480.html
>
Reply | Threaded
Open this post in threaded view
|

Re: Issue with TomEE startup

Dignesh
Thank you very much Romain. I had the same kind of setup in my config. I
missed to replace my jar after updating my bean to remote.

Just curious to know why the global lookup is not allowed in TomEE , - I see
classcastexceptions
I dont see this issue with JBoss app server. I am able to  do global lookup
successfully.

Any other way through which we can achieve this behavior ?



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
Reply | Threaded
Open this post in threaded view
|

Re: Issue with TomEE startup

Romain Manni-Bucau
"local"  (not remote) global lookup means you leak the classloader which
means you can break any app easily. jboss has a mode to deactivate it - at
least a few versions ago it was possible.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau>

2018-01-23 15:47 GMT+01:00 Dignesh <[hidden email]>:

> Thank you very much Romain. I had the same kind of setup in my config. I
> missed to replace my jar after updating my bean to remote.
>
> Just curious to know why the global lookup is not allowed in TomEE , - I
> see
> classcastexceptions
> I dont see this issue with JBoss app server. I am able to  do global lookup
> successfully.
>
> Any other way through which we can achieve this behavior ?
>
>
>
> --
> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-
> f982480.html
>