-
1. Re: Embedded JBoss and Maven
matt.nirgue Oct 23, 2008 2:12 PM (in response to silenius)I got my integration tests running using Embedded JBoss with Maven, thanks to this :
https://jira.jboss.org/jira/browse/JBSEAM-2371 (especially the project testproject-master-JBSEAM-2371)
Hopefully this will help you too... -
2. Re: Embedded JBoss and Maven
silenius Oct 25, 2008 4:53 PM (in response to silenius)Thanks Matt,
Unfortunately my problem is not related with the classpath problem present in Embedded JBoss Beta3. I use Beta3.SP2 that seems to have this bug fixed.
No more need to add:<additionalClasspathElements> <additionalClasspathElement>${project.build.testOutputDirectory}/bootstrap</additionalClasspathElement> </additionalClasspathElements>
to the maven-surefire-plugin.
This is how I start the Embedded JBoss:Bootstrap.getInstance().bootstrap(); Bootstrap.getInstance().scanClasspath("target/classes");
But it seems that is not deploying correctly, at least my EJBs:setUp(com.foo.bar.core.business.ConfigServiceTest) Time elapsed: 0.007 sec <<< FAILURE! javax.naming.NameNotFoundException: configService not bound at org.jnp.server.NamingServer.getBinding(NamingServer.java:542) at org.jnp.server.NamingServer.getBinding(NamingServer.java:550) at org.jnp.server.NamingServer.getObject(NamingServer.java:556) at org.jnp.server.NamingServer.lookup(NamingServer.java:296) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:669) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:629) at javax.naming.InitialContext.lookup(InitialContext.java:392) at com.foo.bar.core.business.ConfigServiceTest.setUp(ConfigServiceTest.java:40)
I'm I doing something wrong? Do you need me to post more info in order to help me?
Thanks -
3. Re: Embedded JBoss and Maven
matt.nirgue Oct 27, 2008 5:02 AM (in response to silenius)I have had a lot of issues trying to make Embedded JBoss work with Maven... and I did get this one! but I can't remember what I've done to solve THIS problem... :/
can you post your components.xml please? -
4. Re: Embedded JBoss and Maven
silenius Oct 27, 2008 9:05 AM (in response to silenius)Hello Matt,
I don't use Seam.
The problem is probably due to my Embedded JBoss configuration since the application runs on JBoss AS and the tests run successfully with Embeddable EJB 3.0. -
5. Re: Embedded JBoss and Maven
matt.nirgue Oct 27, 2008 10:15 AM (in response to silenius)Ok... don't know why I assumed that you used Seam oO
anyway... where/how did you configure your JNDI then? -
6. Re: Embedded JBoss and Maven
silenius Oct 27, 2008 8:46 PM (in response to silenius)Hey Matt,
This is how I configure my initial context:protected static InitialContext getInitialContext() throws NamingException { Hashtable<String, String> props = getInitialContextProperties(); return new InitialContext(props); } private static Hashtable<String, String> getInitialContextProperties() { Hashtable<String, String> props = new Hashtable<String, String>(); props.put("java.naming.factory.initial", "org.jnp.interfaces.LocalOnlyContextFactory"); props.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces"); props.put(Context.SECURITY_PRINCIPAL, "test"); props.put(Context.SECURITY_CREDENTIALS, "test"); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.security.jndi.JndiLoginInitialContextFactory"); return props; }
and this is how I get my bean:InitialContext ctx = AdvertisementServiceTest.getInitialContext(); service = (AdvertisementService) ctx.lookup("advertisementService");
This works fine with Embeddable EJB 3.0. -
7. Re: Embedded JBoss and Maven
matt.nirgue Oct 28, 2008 5:19 AM (in response to silenius)Here's what I use for the tests that use Embedded JBoss:
java.naming.factory.initial=org.jboss.naming.JBossRemotingContextFactory java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Try this out and let me know what you get when using this... -
8. Re: Embedded JBoss and Maven
silenius Oct 29, 2008 2:20 PM (in response to silenius)Thanks Matt,
I've tried to use the JBossRemotingContextFactory but I get exactly the same error.
I can't understand why my EJBs aren't deployed... -
9. Re: Embedded JBoss and Maven
matt.nirgue Oct 29, 2008 2:50 PM (in response to silenius)I don't understand why either... :/ I'll try to take a look at this tomorrow... but I'm afraid I won't be very useful cause I really don't know where the problem comes from...
-
10. Re: Embedded JBoss and Maven
skajotde Oct 30, 2008 10:07 AM (in response to silenius)"target/classes" depends on runtime. On windows System.getProperty("java.class.path") returns "C:\\XXX\target\\classes" and jboss embedded check "C:\\XXX\target\\classes".contains("target/classes") which is false.
I had the same problem, and solved after searching (nothing found) and debugging. Later I found in book Java Persistence in Hibernate Bauer errata which describes this and propose: ("target/classes".replace(File.separator)) -
11. Re: Embedded JBoss and Maven
silenius Nov 5, 2008 2:03 PM (in response to silenius)Thanks Matt and Kamil,
The problem was related with the Embedded JBoss not supporting the @LocalBinding annotation.
I've managed to get a little further.
I've created a new topic for this, maybe you can help me: http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4187075#4187075.
Thanks again. -
12. Re: Embedded JBoss and Maven
skajotde Nov 6, 2008 5:11 AM (in response to silenius)Right ! I had the same problem.
Localization of @LocalBinding had move in JBoss 5 (Jboss Embedded Beta 3 is on JBoss 5) and is diffrent with @LocalBindidng from Jboss 4.
I had tried change global strategy to jndi policy in aop*.xml with success but my project is using predicatable jndi names (full class name of bean implementation with suffixes: "/local" or "/remote").