Great. Thanks for reporting back, very appreciated. We're aiming to do a followup 3.1.2 release soon and it's good to know this will be fixed.

-David


On Jun 19, 2009, at 10:28 AM, burroinquieto wrote:


Nice job, 3.1.2-SNAPSHOT passes in both Maven and IntelliJ without the
additional prop.


David Blevins wrote:

I think I have a fix for this issue that will work without the
openejb.tempclassoader.skip workaround. New 3.1.2-SNAPSHOT jars have
been published to http://repository.apache.org/snapshots/

Can you give that version a try without the flag and see if things
work for you?

-David

On Jun 15, 2009, at 8:42 PM, burroinquieto wrote:


No problem.
http://www.nabble.com/file/p24047145/parent-pom.xml parent-pom.xml
http://www.nabble.com/file/p24047145/ejb-pom.xml ejb-pom.xml

Let me know if you need anything else...


David Blevins wrote:


On Jun 15, 2009, at 7:57 PM, burroinquieto wrote:


Adding contextProps.put("openejb.tempclassloader.skip",
"annotations") seems
to have done the trick.

Thanks for the help. By the way, I noticed in the linked docs that
you've
never had the pleasure of encountering this in IntelliJ or Maven.
Sorry to
break the bad news, but I'm able to reproduce this in both IntelliJ
8.1.2
#9852 and Maven 2.0.10 with JRE 1.5.0_16.

Really, fantastic.  We have an example in our build and it passes
fine
without this flag -- makes it hard to test workarounds. I'd love to
get my hands on a pom.xml that does fail so we could add it to the
test suite.  Is it possible you could share it?


-David





David Blevins wrote:


On Jun 11, 2009, at 8:38 AM, burroinquieto wrote:


I wasn't able to get this working with the 3.1.1 release.

I configured a simple test case as follows:

@LocalClient
public class StockEJBLocalTest extends TestCase {

private Context context;

@EJB
private StockEJBLocal stockEJBLocal;

public void setUp() throws Exception {
  initContext();
}

private void initContext() {

  Properties contextProps = new Properties();
  ResourceBundle rb = ResourceBundle.getBundle("datasource");
  Enumeration props = rb.getKeys();

  String dsName = null;
  while (props.hasMoreElements()) {

     String prop = (String)props.nextElement();
     if (dsName == null) {
        dsName = StringUtils.substringBefore(prop, ".");
     }

     contextProps.put(prop, rb.getString(prop));
  }

  contextProps.put(dsName, "new://Resource?type=DataSource");
  contextProps.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");

  try {

     context = new InitialContext(contextProps);
     context.bind("inject", this);

  } catch (Throwable th) {
     throw new RuntimeException(th);
  }
}

...
}

Resulting output and stack trace:

INFO - Jndi(name=StockEJBLocal) --> Ejb(deployment-id=StockEJB)
INFO - Created Ejb(deployment-id=StockEJB, ejb-name=StockEJB,
container=Default Stateless Container)
INFO - Deployed Application(path=classpath.ear)

java.lang.RuntimeException: javax.naming.NamingException: Unable
to
find
injection meta-data for
org.dpage.stocksloth.ejb.StockEJBLocalTest.
Ensure
that class was annotated with @org.apache.openejb.api.LocalClient
and was
successfully discovered and deployed.  See
http://openejb.apache.org/3.0/local-client-injection.html
        at
org
.dpage
.stocksloth
.ejb.StockEJBLocalTest.initContext(StockEJBLocalTest.java:
63)
        at
org
.dpage
.stocksloth.ejb.StockEJBLocalTest.setUp(StockEJBLocalTest.java:
34)
        at
com
.intellij .rt.execution.junit.JUnitStarter.main(JUnitStarter.java:
40)
Caused by: javax.naming.NamingException: Unable to find injection
meta-data
for org.dpage.stocksloth.ejb.StockEJBLocalTest. Ensure that class
was
annotated with @org.apache.openejb.api.LocalClient and was
successfully
discovered and deployed.  See
http://openejb.apache.org/3.0/local-client-injection.html
        at
org
.apache
.openejb
.client.LocalInitialContext.inject(LocalInitialContext.java:
251)
        at
org
.apache
.openejb .client.LocalInitialContext.bind(LocalInitialContext.java:
225)
        at javax.naming.InitialContext.bind(InitialContext.java:359)
        at
org
.dpage
.stocksloth
.ejb.StockEJBLocalTest.initContext(StockEJBLocalTest.java:
60)
        ... 14 more

Adding the empty META-INF/ejb-jar.xml and META-INF/application-
client.xml
files didn't seem to make any difference.  Any ideas?


Your usage looks good.  I did encounter something like this in
Eclipse
a few days post-release. It seems that in Eclipse we sometimes get
two copies of the @LocalClient annotation loaded and as a result
nothing gets discovered as we're looking for usage of the
LocalClient
from classloader one and the application is using LocalClient from classloader two. A workaround for this is to boot OpenEJB with the
flag 'openejb.tempclassloader.skip=annotations'

On a related note I just noticed the link in the error message
still
didn't exist!  Ooops!  I went ahead and drafted up that page and
included the above information.

http://cwiki.apache.org/OPENEJBx30/local-client-injection.html

It should sync to the openejb.apache.org/ section in an hour.

Definitely let us know if this does or does not work.  We
definitely
want to make sure this feature operates fine in all environments
and
is properly documented.

Thanks for reporting this!

-David




--
View this message in context:
http://www.nabble.com/MDB-Listening-on-external-ActiveMQ-broker-tp23470573p24046803.html
Sent from the OpenEJB User mailing list archive at Nabble.com.






--
View this message in context:
http://www.nabble.com/MDB-Listening-on-external-ActiveMQ-broker-tp23470573p24047145.html
Sent from the OpenEJB User mailing list archive at Nabble.com.






--
View this message in context: 
http://www.nabble.com/MDB-Listening-on-external-ActiveMQ-broker-tp23470573p24115811.html
Sent from the OpenEJB User mailing list archive at Nabble.com.



Reply via email to