Re: NameAlreadyBoundException when deploying as EAR

2018-01-18 Thread Romain Manni-Bucau
2018-01-18 17:12 GMT+01:00 otbutz :

> That answers question number 2 but why is the rebind happening at all?
> The beans already exist and are registered within the context otherwise the
> error wouldn't be thrown. Shouldn't the webappbuilder just pick up the
> existing bean and be done with it?
>

Not, it can happen it is not the right one and we need to enforce it. Would
need to check again since we upgrade numerous tomcat versions but was
happening years ago.


>
> I just want to rule out any errors in our project setup before i invest
> time
> into upgrading everything to TomEE 7.
>

Sometimes it is faster to do the opposite so maybe give it a time-boxed try
;)


>
> Thanks so far for all the answers :)
>
>
>
> --
> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-
> f979441.html
>


Re: NameAlreadyBoundException when deploying as EAR

2018-01-18 Thread otbutz
That answers question number 2 but why is the rebind happening at all?
The beans already exist and are registered within the context otherwise the
error wouldn't be thrown. Shouldn't the webappbuilder just pick up the
existing bean and be done with it?

I just want to rule out any errors in our project setup before i invest time
into upgrading everything to TomEE 7.

Thanks so far for all the answers :)



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


Re: NameAlreadyBoundException when deploying as EAR

2018-01-18 Thread Romain Manni-Bucau
well it depends the rebind. Keep in ming this is an internal part so not
respecting the rebind API contract is fine *here*.

the idea of this code is to merge tomee and tomcat JNDI models to have the
lookups unified (EE and servlet integration if you want).


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

2018-01-18 14:01 GMT+01:00 otbutz :

> Unaltered behaviour.
>
> Checked the corresponding source of openejb-core 4.7.4:
>
> public void bindGlobals(Map bindings) throws
> NamingException
> {
> Context containerSystemContext = this.containerSystem.
> getJNDIContext();
> for (Map.Entry value : bindings.entrySet()) {
> String path = (String) value.getKey();
> if ((!path.startsWith("module/")) && (!path.startsWith("app/")) &&
> (!path.startsWith("comp/"))
> && (!path.equalsIgnoreCase("global/dummy"))) {
> Context lastContext =
> Contexts.createSubcontexts(containerSystemContext, path);
> try {
> lastContext.rebind(path.substring(path.lastIndexOf("/") +
> 1,
> path.length()), value.getValue());
> } catch (NameAlreadyBoundException nabe) {
> nabe.printStackTrace(); // the observed output in the
> console
> }
> containerSystemContext.rebind(path, value.getValue());
> }
> }
> }
>
>
> 1. Why is my webapp even trying to rebind the JNDI entry of my beans?
> 2. Shouldn't a "rebind" not fail if something is already there?
>
>
>
> --
> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-
> f979441.html
>


Re: NameAlreadyBoundException when deploying as EAR

2018-01-18 Thread otbutz
Unaltered behaviour.

Checked the corresponding source of openejb-core 4.7.4:

public void bindGlobals(Map bindings) throws NamingException
{
Context containerSystemContext = this.containerSystem.getJNDIContext();
for (Map.Entry value : bindings.entrySet()) {
String path = (String) value.getKey();
if ((!path.startsWith("module/")) && (!path.startsWith("app/")) &&
(!path.startsWith("comp/"))
&& (!path.equalsIgnoreCase("global/dummy"))) {
Context lastContext =
Contexts.createSubcontexts(containerSystemContext, path);
try {
lastContext.rebind(path.substring(path.lastIndexOf("/") + 1,
path.length()), value.getValue());
} catch (NameAlreadyBoundException nabe) {
nabe.printStackTrace(); // the observed output in the
console
}
containerSystemContext.rebind(path, value.getValue());
}
}
}


1. Why is my webapp even trying to rebind the JNDI entry of my beans?
2. Shouldn't a "rebind" not fail if something is already there?



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


Re: NameAlreadyBoundException when deploying as EAR

2018-01-17 Thread Paul Carter-Brown
Try adding this to your setenv.sh or changes system.properties accordingly:

-Dopenejb.deploymentId.format={appId}/{ejbJarId}/{ejbName}
-Dopenejb.wsAddress.format={ejbName}

That will make your deployement Id's for EJB's include the app/jar names
and won't impact any web service endpoints you may have.

On Wed, Jan 17, 2018 at 12:15 PM, otbutz  wrote:

> The EJBs lie in their own modules and are only used by the webapps through
> injection.
>
>
>
> --
> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-
> f979441.html
>


Re: NameAlreadyBoundException when deploying as EAR

2018-01-17 Thread otbutz
The EJBs lie in their own modules and are only used by the webapps through
injection.



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


Re: NameAlreadyBoundException when deploying as EAR

2018-01-17 Thread Romain Manni-Bucau
It can if multiple modules deploy the same EJB


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

2018-01-17 10:42 GMT+01:00 otbutz :

> Are you refering to the openejb.deploymentId.format property?
> We're currently using the default format. Could this be the root of our
> problem?
>
>
>
> --
> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-
> f979441.html
>


Re: NameAlreadyBoundException when deploying as EAR

2018-01-17 Thread otbutz
Are you refering to the openejb.deploymentId.format property?
We're currently using the default format. Could this be the root of our
problem?



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


Re: NameAlreadyBoundException when deploying as EAR

2018-01-17 Thread Romain Manni-Bucau
Hi

if you customized EJB deploymentId with the corresponding property to not
be ambiguous accross ear modules/webapps then it can be a bug fixed on the
7.x we never backported. This part was improved quite a lot on 7.x


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

2018-01-17 10:08 GMT+01:00 otbutz :

> Hey there,
>
> we're currently reworking our deployment and have switched to EAR with our
> project. When starting up our TomEE 1.7.4 applicationserver the deployment
> of the EJB projects works flawlessly and without any warnings but the
> webapps in the EAR cause the following exceptions in the console:
>
> e.g:
>
> javax.naming.NameAlreadyBoundException: ParsedName{path=GeoCode,
> component=GeoCode}
> at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:158)
> at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:168)
> at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:168)
> at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:175)
> at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:168)
> at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:175)
> at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:175)
> at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:175)
> at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:175)
> at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:175)
> at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:175)
> at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:175)
> at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:175)
> at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:175)
> at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:175)
> at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:175)
> at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:175)
> at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:175)
> at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:175)
> at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:175)
> at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:175)
> at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:175)
> at
> org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:175)
> at
> org.apache.openejb.core.ivm.naming.IvmContext.bind(IvmContext.java:308)
> at
> org.apache.openejb.core.ivm.naming.IvmContext.rebind(IvmContext.java:322)
> at
> org.apache.openejb.assembler.classic.Assembler.bindGlobals(
> Assembler.java:1188)
> at
> org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(
> TomcatWebAppBuilder.java:1379)
> at
> org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(
> TomcatWebAppBuilder.java:1100)
> at
> org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(
> GlobalListenerSupport.java:130)
> at
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
> LifecycleSupport.java:117)
> at
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(
> LifecycleBase.java:90)
> at
> org.apache.catalina.core.StandardContext.startInternal(
> StandardContext.java:5472)
> at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
> at
> org.apache.catalina.core.ContainerBase$StartChild.call(
> ContainerBase.java:1572)
> at
> org.apache.catalina.core.ContainerBase$StartChild.call(
> ContainerBase.java:1562)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(
> ThreadPoolExecutor.java:1142)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(
> ThreadPoolExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)
>
> Our service works without any problems but the errors are a bit annoying.
> It
> seems like the webappbuilder tries to register our EJBs again in the
> webapps
> but fails to do so.
>
> I've searched the net quite a lot and found some threads but none of those
> fit our case. I would like to submit a minimal example but i'm afraid to
> violate corporate policies. I will try my best to answer any upcoming
> questions though!
>
>
>
> --
> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-
> f979441.html
>