You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Kaoklai <gd...@gmail.com> on 2017/12/21 20:19:36 UTC

EJB Jndi binding missing after restart

Hi there,

I've a TomEE 7.0.3-plume version running in a docker container and I'm
deploying a war file containing 2 depedencies 1) services as an ejb-jar and
2) the model with its persistence.xml in a jar) via tomee-maven-plugin.

Deployment is fine, the application is running like a charm (persitence,
injection, and so on.) I'm also able to undeploy without any problems.

Things get worse when I stop / restart docker or if I simply stop / restart
apache (bin/catalina.sh stop / start). From there it's like all the jndi
binding that was done during deployment was gone. Standard injection via
annotation still seems to be working fine though, but unaccesible via JNDI
Context Lookup. Undeployment also fails from that point. The plugin doesn't
say anything, it mentions it succeeded but there is not trace whatsoever of
the undeployment request in the catalina.out log. Also for a reason I ignore
the undeploy button from the /manager has never been able to me (not
clickable) nor before or after restart.

The application gets deployed into the temp folder, does that mean that some
part of its configuration will be missing after restart?

Example of binding during deployment:

...
21-Dec-2017 19:34:09.119 INFO [main]
org.apache.openejb.assembler.classic.JndiBuilder.bind
Jndi(name=global/wise/CategoryDao!c.e.p.c.ICategoryDao) -->
Ejb(deployment-id=CategoryDao)
21-Dec-2017 19:34:09.119 INFO [main]
org.apache.openejb.assembler.classic.JndiBuilder.bind
Jndi(name=global/wise/CategoryDao) --> Ejb(deployment-id=CategoryDao)
...

Listing manually the InitialContext confirms their registration:
...
[ LOCAL-WISE ] INFO - 21-12-2017 20:11:40 c.e.u.EJBLocator:print:141 - >
CategoryDao
[ LOCAL-WISE ] INFO - 21-12-2017 20:11:40 c.e.u.EJBLocator:print:141 - >
c.e.p.c.ICategoryDao
[ LOCAL-WISE ] INFO - 21-12-2017 20:11:40 c.e.u.EJBLocator:print:141 - >
c.e.p.c.ICategoryDao!Local
...

And after restart only the ones defined in the resource.xml (i.e DB
datasource) appears in the list but all the EJBs are gone.

Any helps would be appreciated

Gabriel



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html

Re: EJB Jndi binding missing after restart

Posted by Kaoklai <gd...@gmail.com>.
Alright, cheers Romain.

I'll manage my local / CI deployment in an other way then and will stop
using the plugin.

Merry Xmas btw :).



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html

Re: EJB Jndi binding missing after restart

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Le 23 déc. 2017 15:10, "Kaoklai" <gd...@gmail.com> a écrit :

What do you mean it doesn't use "Tomcat API". It does get deploy via HTTPS
to
a remote tomcat.


Tomcat manager has its own deployer but doesnt support ejbmodules or ears -
only wars.



Do you expect all deployments to be done "manually" by dropping the file to
the webapps folder?


It is the main way but others work.



I was willing to use tomee-maven-plugin for CI purposes and local deployment
at least... but if deploying via the api doesn't get the full set of feature
from TomEE I don't understand what it even exists?


It does and some people use it with arquillian or docker but requires some
config in general.

Side note: when created the deploy goal of the plugin it was for local
testing lore than other usages. Docker has its own way to setup an instance
which is likely better than dynamic deployment which is unsecured in
general if you dont spend time tuning it.





--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-
f979441.html

Re: EJB Jndi binding missing after restart

Posted by Kaoklai <gd...@gmail.com>.
What do you mean it doesn't use "Tomcat API". It does get deploy via HTTPS to
a remote tomcat.

Do you expect all deployments to be done "manually" by dropping the file to
the webapps folder?

I was willing to use tomee-maven-plugin for CI purposes and local deployment
at least... but if deploying via the api doesn't get the full set of feature
from TomEE I don't understand what it even exists?



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html

Re: EJB Jndi binding missing after restart

Posted by Romain Manni-Bucau <rm...@gmail.com>.
The maven plugin doesnt use tomcat api. If you end up deployed by tomcat -
webapps folder - then you get tomcat features, otherwise it is an app
tomcat doesnt manage itself but only serves.


Le 23 déc. 2017 13:00, "Kaoklai" <gd...@gmail.com> a écrit :

> And there are some subtle differences. For instance if I deploy via
> tomee-maven-plugin the "undeploy" button from the Tomcat manager is
> disabled
> (I can't click on it). On the contrary, if I drop the .war manually in the
> webapps folder the exact same button gets available.
>
> How does that deployment work over the api?
>
>
>
> --
> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-
> f979441.html
>

Re: EJB Jndi binding missing after restart

Posted by Kaoklai <gd...@gmail.com>.
And there are some subtle differences. For instance if I deploy via
tomee-maven-plugin the "undeploy" button from the Tomcat manager is disabled
(I can't click on it). On the contrary, if I drop the .war manually in the
webapps folder the exact same button gets available.

How does that deployment work over the api?



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html

Re: EJB Jndi binding missing after restart

Posted by Kaoklai <gd...@gmail.com>.
Nope I'm uploading the binaries. The .war file itself should be identical.



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html

Re: EJB Jndi binding missing after restart

Posted by Romain Manni-Bucau <rm...@gmail.com>.
The war uploaded with tomee maven plugin. I dont know your client setup but
wonder if the binary was uploaded or if you used default local file
deployment.

Le 23 déc. 2017 12:26, "Kaoklai" <gd...@gmail.com> a écrit :

> What should I check for?
>
> If I manually drop the .war file into the webapps directory it works
> perfectly. The problem occurs only when I deploy via tomee-maven-plugin.
>
>
>
> --
> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-
> f979441.html
>

Re: EJB Jndi binding missing after restart

Posted by Kaoklai <gd...@gmail.com>.
What should I check for?

If I manually drop the .war file into the webapps directory it works
perfectly. The problem occurs only when I deploy via tomee-maven-plugin.



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html

Re: EJB Jndi binding missing after restart

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Did you check the content of the war file?

Le 23 déc. 2017 11:59, "Kaoklai" <gd...@gmail.com> a écrit :

> Hi Romain,
>
> I managed to changed the dist directory using the system.properties:
>
> openejb.deployer.cache.folder = webapps
>
> Not entirely that should be used this way...
>
> Resulting deployments.xml is:
>
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <additional-deployments xmlns="http://www.openejb.org/System/Configuration
> ">
>     <deployments file="/usr/local/tomee/webapps/wise.war"
> autoDeploy="false"/>
> </additional-deployments>
>
>
> However, if I stop and restart TomEE I still end up in the same situation
> with the JDNI binding being missing.
>
>
>
> --
> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-
> f979441.html
>

Re: EJB Jndi binding missing after restart

Posted by Kaoklai <gd...@gmail.com>.
Hi Romain,

I managed to changed the dist directory using the system.properties:

openejb.deployer.cache.folder = webapps

Not entirely that should be used this way...

Resulting deployments.xml is:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<additional-deployments xmlns="http://www.openejb.org/System/Configuration">
    <deployments file="/usr/local/tomee/webapps/wise.war"
autoDeploy="false"/>
</additional-deployments>


However, if I stop and restart TomEE I still end up in the same situation
with the JDNI binding being missing.



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html

Re: EJB Jndi binding missing after restart

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Le 22 déc. 2017 18:44, "Kaoklai" <gd...@gmail.com> a écrit :

I'm not sure to understand what I'm supposed to try out here. Is the problem
of losing the binding due to the fact that the app gets deployed to the temp
directory?



Yes


DeployerEjb.java is a file from TomEE, do you suggest than I modify TomEE's
source code somehow and recompile my own version?


No, just to check how to change the deployment dir (hard from phone for me)




--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-
f979441.html

Re: EJB Jndi binding missing after restart

Posted by Kaoklai <gd...@gmail.com>.
I'm not sure to understand what I'm supposed to try out here. Is the problem
of losing the binding due to the fact that the app gets deployed to the temp
directory?

DeployerEjb.java is a file from TomEE, do you suggest than I modify TomEE's
source code somehow and recompile my own version? 



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html

Re: EJB Jndi binding missing after restart

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Ok

The point is the temp folder usage. IIRC you can configure it. The config
dhoukd be in DeployerEjb.java

Le 21 déc. 2017 22:55, "Kaoklai" <gd...@gmail.com> a écrit :

> Hi Romain,
>
> Thank for your reply.
>
> This is the content of conf/deployments.xml after deployment (before
> deployment there is none):
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <additional-deployments xmlns="http://www.openejb.org/System/Configuration
> ">
>     <deployments file="/usr/local/tomee/temp/wise.war"
> autoDeploy="false"/>
> </additional-deployments>
>
> What do you mean by consitent to my docker setup? I don't necessarily need
> to restart docker to lose the binding, restarting apache within docker is
> enough.
>
> Cheers,
>
> Gabriel
>
>
>
> --
> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-
> f979441.html
>

Re: EJB Jndi binding missing after restart

Posted by Kaoklai <gd...@gmail.com>.
Hi Romain,

Thank for your reply.

This is the content of conf/deployments.xml after deployment (before
deployment there is none):
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<additional-deployments xmlns="http://www.openejb.org/System/Configuration">
    <deployments file="/usr/local/tomee/temp/wise.war" autoDeploy="false"/>
</additional-deployments>

What do you mean by consitent to my docker setup? I don't necessarily need
to restart docker to lose the binding, restarting apache within docker is
enough.

Cheers,

Gabriel



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html

Re: EJB Jndi binding missing after restart

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

You can check what is in conf/deployments.xml just before a restart and if
it is consistent with your docker setup.


Le 21 déc. 2017 21:19, "Kaoklai" <gd...@gmail.com> a écrit :

> Hi there,
>
> I've a TomEE 7.0.3-plume version running in a docker container and I'm
> deploying a war file containing 2 depedencies 1) services as an ejb-jar and
> 2) the model with its persistence.xml in a jar) via tomee-maven-plugin.
>
> Deployment is fine, the application is running like a charm (persitence,
> injection, and so on.) I'm also able to undeploy without any problems.
>
> Things get worse when I stop / restart docker or if I simply stop / restart
> apache (bin/catalina.sh stop / start). From there it's like all the jndi
> binding that was done during deployment was gone. Standard injection via
> annotation still seems to be working fine though, but unaccesible via JNDI
> Context Lookup. Undeployment also fails from that point. The plugin doesn't
> say anything, it mentions it succeeded but there is not trace whatsoever of
> the undeployment request in the catalina.out log. Also for a reason I
> ignore
> the undeploy button from the /manager has never been able to me (not
> clickable) nor before or after restart.
>
> The application gets deployed into the temp folder, does that mean that
> some
> part of its configuration will be missing after restart?
>
> Example of binding during deployment:
>
> ...
> 21-Dec-2017 19:34:09.119 INFO [main]
> org.apache.openejb.assembler.classic.JndiBuilder.bind
> Jndi(name=global/wise/CategoryDao!c.e.p.c.ICategoryDao) -->
> Ejb(deployment-id=CategoryDao)
> 21-Dec-2017 19:34:09.119 INFO [main]
> org.apache.openejb.assembler.classic.JndiBuilder.bind
> Jndi(name=global/wise/CategoryDao) --> Ejb(deployment-id=CategoryDao)
> ...
>
> Listing manually the InitialContext confirms their registration:
> ...
> [ LOCAL-WISE ] INFO - 21-12-2017 20:11:40 c.e.u.EJBLocator:print:141 - >
> CategoryDao
> [ LOCAL-WISE ] INFO - 21-12-2017 20:11:40 c.e.u.EJBLocator:print:141 - >
> c.e.p.c.ICategoryDao
> [ LOCAL-WISE ] INFO - 21-12-2017 20:11:40 c.e.u.EJBLocator:print:141 - >
> c.e.p.c.ICategoryDao!Local
> ...
>
> And after restart only the ones defined in the resource.xml (i.e DB
> datasource) appears in the list but all the EJBs are gone.
>
> Any helps would be appreciated
>
> Gabriel
>
>
>
> --
> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-
> f979441.html
>