Discussion:
EJB Jndi binding missing after restart
Kaoklai
2017-12-21 20:19:36 UTC
Permalink
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
Romain Manni-Bucau
2017-12-21 20:36:06 UTC
Permalink
Hi

You can check what is in conf/deployments.xml just before a restart and if
it is consistent with your docker setup.
Post by Kaoklai
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?
...
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)
...
...
[ 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
Kaoklai
2017-12-21 21:55:31 UTC
Permalink
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
Romain Manni-Bucau
2017-12-22 07:25:43 UTC
Permalink
Ok

The point is the temp folder usage. IIRC you can configure it. The config
dhoukd be in DeployerEjb.java
Post by Kaoklai
Hi Romain,
Thank for your reply.
This is the content of conf/deployments.xml after deployment (before
<?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
Kaoklai
2017-12-22 17:44:09 UTC
Permalink
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
Romain Manni-Bucau
2017-12-22 20:25:37 UTC
Permalink
Le 22 déc. 2017 18:44, "Kaoklai" <***@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
Kaoklai
2017-12-23 10:59:14 UTC
Permalink
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
Romain Manni-Bucau
2017-12-23 11:11:04 UTC
Permalink
Did you check the content of the war file?
Post by Kaoklai
Hi Romain,
openejb.deployer.cache.folder = webapps
Not entirely that should be used this way...
<?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
Kaoklai
2017-12-23 11:26:15 UTC
Permalink
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
Romain Manni-Bucau
2017-12-23 11:51:05 UTC
Permalink
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.
Post by Kaoklai
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
Kaoklai
2017-12-23 11:53:16 UTC
Permalink
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
Kaoklai
2017-12-23 11:59:55 UTC
Permalink
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
Romain Manni-Bucau
2017-12-23 13:34:01 UTC
Permalink
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.
Post by Kaoklai
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
Kaoklai
2017-12-23 14:10:44 UTC
Permalink
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
Romain Manni-Bucau
2017-12-23 14:17:09 UTC
Permalink
Le 23 déc. 2017 15:10, "Kaoklai" <***@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
Kaoklai
2017-12-23 15:30:16 UTC
Permalink
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
Loading...