You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Marius Kruger <am...@gmail.com> on 2011/07/04 13:56:57 UTC

Re: NameAlreadyBoundException: ParsedName{path=openejb/client/test-classes/comp/env, component=env}

On 2 July 2011 05:44, David Blevins <da...@gmail.com> wrote:

>
> On Jul 1, 2011, at 7:51 PM, Marius Kruger wrote:
>
> > hi,
> > I keep hitting this every couple of months or weeks.
> > Basically it seems that openejb does not allow you to have multiple
> > application clients in the classpath :(
> > and gives the exception below.
> >
> > I logged a bug: https://issues.apache.org/jira/browse/OPENEJB-1366
> > and I saw that this was discussed before:
> >
> http://openejb.979440.n4.nabble.com/OpenEJB-localclient-module-name-td2238205.html
> > But there does not seem to be a workaround (I tried Apache OpenEJB
> > 3.2.0-SNAPSHOT    build: 20110630-03:56 too)
> >
> > Am I missing something?  Should I just live with the pain for now?
> > If I want to look into fixing it where do I start?
>
> Hi Marius!
>
> Very excellent if you have any time to hack on it.  An adaptation of
> something we did in trunk might work here.  We could certainly introduce
> this in 3.2 with some help.
>
> When guessing the default module id based on the file path, we now do this
> (trunk):
>
>        private String moduleName(File location) {
>            List<String> invalid = new ArrayList<String>();
>            invalid.add("classes");
>            invalid.add("test-classes");
>            invalid.add("target");
>            invalid.add("build");
>            invalid.add("dist");
>            invalid.add("bin");
>
>            while (invalid.contains(location.getName())) {
>                location = location.getParentFile();
>            }
>            return stripExtension(location.getName());
>        }
>
>        private String stripExtension(String name) {
>            String[] exts = {".jar", ".zip", ".ear", ".war", ".rar",
> ".unpacked"};
>            for (String ext : exts) {
>                if (name.endsWith(ext)) {
>                    return name.substring(0, name.length() - ext.length());
>                }
>            }
>            return name;
>        }
>
> So basically if we see "test-classes" we assume it's not valid and keep
> walking backward till we find something we hope is more unique.
>
> It was done as part of a much bigger change to get all module IDs to be a
> little more consistent and under control (OPENEJB-1442), but adding this one
> little gem to at least ClientModule.java should be pretty easy.
>
> It won't fix the issue of not being able to set the module ID explicitly,
> but probably the default will wind up being what you wanted anyway.  I can
> still give hints on that if you want.
>
>
thanks for responding David. I'm trying to give it a go since I'd really
like it fixed in 3.2 if possible, but I get the following compiler error
when looking at openejb-3.2.x in eclipse:

The method get(String, Class) is ambiguous for the type Options
JndiBuilder.java
/openejb-3.2.x_openejb-core/src/main/java/org/apache/openejb/assembler/classic
line
88

I was able to build it with maven, but for some reason eclipse does not like
it.
Am I missing a setting or compiler argument somewhere?




>
> > ==
> > 2011-07-02 04:38:55,043:ERROR Application could not be deployed:
> > classpath.ear - OpenEJB.startup
> > org.apache.openejb.OpenEJBException: Creating application failed:
> > classpath.ear: ParsedName{path=openejb/client/test-classes/comp/env,
> > component=env}
> > at
> >
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:722)
> > at
> >
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:456)
> > at
> >
> org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:374)
> > at
> org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:286)
> > at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:125)
> > at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:60)
> > at org.apache.openejb.OpenEJB.init(OpenEJB.java:271)
> > at org.apache.openejb.OpenEJB.init(OpenEJB.java:250)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> > at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > at java.lang.reflect.Method.invoke(Method.java:616)
> > at
> org.apache.openejb.loader.OpenEJBInstance.init(OpenEJBInstance.java:36)
> > at
> >
> org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:71)
> > at
> >
> org.apache.openejb.client.LocalInitialContextFactory.init(LocalInitialContextFactory.java:53)
> > at
> >
> org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:42)
> > at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
> > at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:305)
> > at javax.naming.InitialContext.init(InitialContext.java:240)
> > at javax.naming.InitialContext.<init>(InitialContext.java:214)
> > at
> >
> za.co.enerweb.ebr.oe.OrchestrationEngineFactory.getEjbContext(OrchestrationEngineFactory.java:76)
> > at
> >
> za.co.enerweb.ebr.oe.OrchestrationEngineFactory.lookupEjb(OrchestrationEngineFactory.java:165)
> > at
> >
> za.co.enerweb.ebr.oe.OrchestrationEngineFactory.open(OrchestrationEngineFactory.java:179)
> > at
> >
> za.co.enerweb.ebr.oe.OrchestrationEngineFactory.getEjbContext(OrchestrationEngineFactory.java:61)
> > at
> >
> za.co.enerweb.ebr.oe.OrchestrationEngineFactory.lookupEjb(OrchestrationEngineFactory.java:165)
> > at
> >
> za.co.enerweb.ebr.oe.OrchestrationEngineFactory.lookupEjb(OrchestrationEngineFactory.java:156)
> > at
> >
> za.co.enerweb.ebr.oe.OrchestrationEngineFactory.lookupEjb(OrchestrationEngineFactory.java:151)
> > at
> >
> za.co.enerweb.ebr.oe.OrchestrationEngineFactory.getOrchestrationEngine(OrchestrationEngineFactory.java:237)
> > at
> >
> za.co.enerweb.ebr.oe.AbstractOrchestrationEngineTest.setUpBeforeInjection(AbstractOrchestrationEngineTest.java:47)
> > at
> >
> za.co.enerweb.ebr.oe.AbstractEjbTest.setInjectResources(AbstractEjbTest.java:24)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> > at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > at java.lang.reflect.Method.invoke(Method.java:616)
> > at
> >
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
> > at
> >
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> > at
> >
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
> > at
> >
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
> > at
> >
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> > at org.junit.rules.TestWatchman$1.evaluate(TestWatchman.java:48)
> > at
> >
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
> > at
> >
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
> > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
> > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
> > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
> > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
> > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
> > at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
> > at
> >
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
> > at
> >
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> > at
> >
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
> > at
> >
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
> > at
> >
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
> > at
> >
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> > Caused by: javax.naming.NameAlreadyBoundException:
> > ParsedName{path=openejb/client/test-classes/comp/env, component=env}
> > at org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:96)
> > at org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:90)
> > at org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:90)
> > at org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:105)
> > at org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:90)
> > at org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:105)
> > at org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:105)
> > at org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:90)
> > at org.apache.openejb.core.ivm.naming.NameNode.bind(NameNode.java:105)
> > at
> org.apache.openejb.core.ivm.naming.IvmContext.bind(IvmContext.java:295)
> > at
> >
> org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:673)
> > ... 53 more
>


-- 
thanks
<>< Marius ><>

Re: NameAlreadyBoundException: ParsedName{path=openejb/client/test-classes/comp/env, component=env}

Posted by Marius Kruger <am...@gmail.com>.
On 25 July 2011 13:56, Jean-Louis MONTEIRO <je...@gmail.com> wrote:

> JIRA marked solve by you.
>
> BTW, I guess you have new snapshots to give it a try.
>

Thanks so much Jean-Louis,
yes as far as I can tell everything works now for me,
even that test project I submitted :-)

-- 
<>< Marius ><>

Re: NameAlreadyBoundException: ParsedName{path=openejb/client/test-classes/comp/env, component=env}

Posted by Jean-Louis MONTEIRO <je...@gmail.com>.
Hi Marius,

JIRA marked solve by you.
Thanks Marius.

BTW, I guess you have new snapshots to give it a try.

Jean-Louis

--
View this message in context: http://openejb.979440.n4.nabble.com/Re-NameAlreadyBoundException-ParsedName-path-openejb-client-test-classes-comp-env-component-env-tp3643459p3692510.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: NameAlreadyBoundException: ParsedName{path=openejb/client/test-classes/comp/env, component=env}

Posted by Jean-Louis MONTEIRO <je...@gmail.com>.
David, Marius,

I saw it but I had troubles with some activemq stuff so I was unable to push
new snapshots.
That's why I started to solve activemq issues first.
Then, I saw the patch file and I was ready to commit it.

Jean-Louis

2011/7/21 Marius Kruger <am...@gmail.com>

> On 21 July 2011 02:54, David Blevins <da...@gmail.com> wrote:
> ...
>
> > I applied it and checked it in.
> >
>
> thanks again. much appreciated!
>
> Thank you for both the patch and the patience!  There'll be quite a lot of
> > happy users of this functionality.
> >
>
> great. I was beginning to think it is just me who needed it.
>
>
> > Feel encouraged to keep contributing anything you think is useful.  We
> love
> > it when we get to add new committers :)
> >
> > Crazy ideas and hunches are welcome too.
> >
>
> sweet. will try to keep 'em coming.
>
> --
> <>< Marius ><>
>

Re: NameAlreadyBoundException: ParsedName{path=openejb/client/test-classes/comp/env, component=env}

Posted by Marius Kruger <am...@gmail.com>.
On 21 July 2011 02:54, David Blevins <da...@gmail.com> wrote:
...

> I applied it and checked it in.
>

thanks again. much appreciated!

Thank you for both the patch and the patience!  There'll be quite a lot of
> happy users of this functionality.
>

great. I was beginning to think it is just me who needed it.


> Feel encouraged to keep contributing anything you think is useful.  We love
> it when we get to add new committers :)
>
> Crazy ideas and hunches are welcome too.
>

sweet. will try to keep 'em coming.

-- 
<>< Marius ><>

Re: NameAlreadyBoundException: ParsedName{path=openejb/client/test-classes/comp/env, component=env}

Posted by David Blevins <da...@gmail.com>.
On Jul 20, 2011, at 3:25 PM, Marius Kruger wrote:

> On 20 July 2011 15:15, Jean-Louis MONTEIRO <je...@gmail.com> wrote:
> 
>> Okay, let's try to push new snapshots ...
>> 
> 
> Thank you so much Jean-Louis for trying to help me.
> Sadly the fix you committed does not solve my problem :'(

Probably Jean-Louis didn't notice the patch (JIRA should really put attachments above the description).

I applied it and checked it in.  Thank you for both the patch and the patience!  There'll be quite a lot of happy users of this functionality.

Feel encouraged to keep contributing anything you think is useful.  We love it when we get to add new committers :)

Crazy ideas and hunches are welcome too.


-David




Re: NameAlreadyBoundException: ParsedName{path=openejb/client/test-classes/comp/env, component=env}

Posted by Marius Kruger <am...@gmail.com>.
sorry for all the spam..

On 21 July 2011 00:49, Marius Kruger <am...@gmail.com> wrote:

> On 21 July 2011 00:25, Marius Kruger <am...@gmail.com> wrote:
>
>> If it will help, I can try to build an example that breaks in maven when
>> running tests.
>>
>
> I attached a simple maven project to the bug which exhibits the problem
> when run as `mvn test` . Basically I just added a second test-classes dir
> which includes a META-INF/application-client.xml to the classpath to the
> client injection example.
>
> https://issues.apache.org/jira/secure/attachment/12487229/multiple-clients.zip
>

ok the previous attachment does not even work with my patch because the
test-classes dirs got the same id (which is the project dir name).
I now moved the second test-classes dir into an "x" dir so that it gets an
"x" id with my patch:
https://issues.apache.org/jira/secure/attachment/12487232/reproduce-multiple-clients.zip

-- 
<>< Marius ><>

Re: NameAlreadyBoundException: ParsedName{path=openejb/client/test-classes/comp/env, component=env}

Posted by Marius Kruger <am...@gmail.com>.
On 21 July 2011 00:25, Marius Kruger <am...@gmail.com> wrote:

> If it will help, I can try to build an example that breaks in maven when
> running tests.
>

I attached a simple maven project to the bug which exhibits the problem when
run as `mvn test` . Basically I just added a second test-classes dir which
includes a META-INF/application-client.xml to the classpath to the client
injection example.
https://issues.apache.org/jira/secure/attachment/12487229/multiple-clients.zip

-- 
<>< Marius ><>

Re: NameAlreadyBoundException: ParsedName{path=openejb/client/test-classes/comp/env, component=env}

Posted by Marius Kruger <am...@gmail.com>.
On 20 July 2011 15:15, Jean-Louis MONTEIRO <je...@gmail.com> wrote:

> Okay, let's try to push new snapshots ...
>

Thank you so much Jean-Louis for trying to help me.
Sadly the fix you committed does not solve my problem :'(

I did a couple of back and forths between 3.2.x and my patched branch
doing a mvn clean install -DskipTests each.
My project works with my branch and not with yours.

If it will help, I can try to build an example that breaks in maven when
running tests.

-- 
<>< Marius ><>

Re: NameAlreadyBoundException: ParsedName{path=openejb/client/test-classes/comp/env, component=env}

Posted by Jean-Louis MONTEIRO <je...@gmail.com>.
Okay, let's try to push new snapshots ...


--
View this message in context: http://openejb.979440.n4.nabble.com/Re-NameAlreadyBoundException-ParsedName-path-openejb-client-test-classes-comp-env-component-env-tp3643459p3680703.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: NameAlreadyBoundException: ParsedName{path=openejb/client/test-classes/comp/env, component=env}

Posted by Jean-Louis MONTEIRO <je...@gmail.com>.
Hi Marius,

I can review it and commit it for you.
Then, I can fire a new build and publish new snapshots.

Thanks anyway.
Jean-Louis

--
View this message in context: http://openejb.979440.n4.nabble.com/Re-NameAlreadyBoundException-ParsedName-path-openejb-client-test-classes-comp-env-component-env-tp3643459p3680247.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: NameAlreadyBoundException: ParsedName{path=openejb/client/test-classes/comp/env, component=env}

Posted by Marius Kruger <am...@gmail.com>.
On 9 July 2011 04:51, David Blevins <da...@gmail.com> wrote:

> Excellent!  This is fantastic.  The jira number for those who weren't
> watching.
>
> https://issues.apache.org/jira/browse/OPENEJB-1366
>
> One more patch for the review/commit queue.
>

ping.
Sorry to be annoying, but it will help me a lot if this or something similar
could be merged and sent to the 3.2 snapshots, because this breaks stuff for
my colleagues
who do not have my special builds. If this doesn't happen soon (like in a
week or so),
I'll have to fix the code I wrote that depends on it - yeah I know it is my
own fault,
but I really miss this feature. Not trying to pressure you but I'd like to
have
realistic expectations.

-- 
<>< Marius ><>

Re: NameAlreadyBoundException: ParsedName{path=openejb/client/test-classes/comp/env, component=env}

Posted by Marius Kruger <am...@gmail.com>.
On 9 July 2011 04:51, David Blevins <da...@gmail.com> wrote:
>
> One more patch for the review/commit queue.
>

great, I was beginning to think that my gmail was being swallowed by the
list,
like it did for you which mentioned a while back.


> Thanks so much, Marius!
>

pleasure :-)
It is nice to be able to debug my app right into openejb from eclipse now.


I hit some more problems with duplicate client-module-ids so I added a new
patch now with the following improvements:
* AppInfoBuilder should not have its own way to figure out the client module
ids  (this needs to go into trunk too, unless I'm missing something)
* Handle the generics compiler error better so it works in eclipse and maven
   (with the help of some other messages on this mailinglist)

https://issues.apache.org/jira/secure/attachment/12485980/20110710_jira1366_multiple-clients1.patch

-- 
<>< Marius ><>

Re: NameAlreadyBoundException: ParsedName{path=openejb/client/test-classes/comp/env, component=env}

Posted by David Blevins <da...@gmail.com>.
Excellent!  This is fantastic.  The jira number for those who weren't watching.

https://issues.apache.org/jira/browse/OPENEJB-1366

One more patch for the review/commit queue.

Thanks so much, Marius!


-David

On Jul 5, 2011, at 5:04 PM, Marius Kruger wrote:

> Ok after battling with eclipse+maven quite a bit, I've got a patch now that
> fixes this bug for me.
> https://issues.apache.org/jira/secure/attachment/12485351/20110706_jira1366_multiple-clients.patch
> 
> Let me know if you need me to do anything else to get this in.
> 
> == patch notes ==
> patch against 3.2.x to fix this bug and 2 minor unrelated stuff
> * Change the one Options.get method to getClass because it is ambiguous
> otherwise which causes compiler errors.
> * copy stuff from trunk that fixes the problem (without introducing
> NamedModule)
> * Log4jLogStreamFactory.configureEmbedded used resource before checking if
> it is null. (found this while debugging)
> 
> -- 
> <>< Marius ><>


Re: NameAlreadyBoundException: ParsedName{path=openejb/client/test-classes/comp/env, component=env}

Posted by Marius Kruger <am...@gmail.com>.
Ok after battling with eclipse+maven quite a bit, I've got a patch now that
fixes this bug for me.
https://issues.apache.org/jira/secure/attachment/12485351/20110706_jira1366_multiple-clients.patch

Let me know if you need me to do anything else to get this in.

== patch notes ==
patch against 3.2.x to fix this bug and 2 minor unrelated stuff
* Change the one Options.get method to getClass because it is ambiguous
otherwise which causes compiler errors.
* copy stuff from trunk that fixes the problem (without introducing
NamedModule)
* Log4jLogStreamFactory.configureEmbedded used resource before checking if
it is null. (found this while debugging)

-- 
<>< Marius ><>