JBAS016000: Failed to setup Weld contexts: javax.naming.NameNotFoundException: BeanManager
scott.marshall.dc123 Nov 2, 2012 9:58 AMHI all
I'm new to Arquillian and JBoss, and having mixed success in getting it going. I've got one set of tests that work in one module of a multi module build, but then when I run a different module, it fails.
My test looks like
{code}
package com.dc123.resource.agent.cache.ws.client;
import java.net.MalformedURLException;
import java.net.URL;
import javax.inject.Inject;
import junit.framework.Assert;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.dc123.resource.agent.cache.util.PropertyReader;
@RunWith(Arquillian.class)
public class ServiceLocatorPropertiesTest {
private static final Logger log = LoggerFactory.getLogger(ServiceLocatorPropertiesTest.class);
private static final String expectedValue =
@Deployment
public static JavaArchive createDeployment() {
final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "ServiceLocatorPropertiesTest")
.addClasses(PropertyReader.class, ServiceLocatorProperties.class)
.addAsResource("client.properties")
.addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
if (log.isInfoEnabled()) {
log.info(jar.toString(true));
}
return jar;
}
@Inject
private ServiceLocatorProperties serviceLocatorProperties;
@Test
public void checkStringIsCorrectlyFormed() {
try {
String urlString = serviceLocatorProperties.getWSDL_URL();
log.info("UrlString is [{}]", urlString);
@SuppressWarnings("unused")
URL url = new URL(urlString);
Assert.assertTrue("URL correctly formed", Boolean.TRUE);
Assert.assertEquals("Should be the same", expectedValue, urlString);
} catch (MalformedURLException e) {
Assert.fail("URL should be correctly formed");
}
}
}
{code}
When I run it, I get
00:51:25,970 INFO [org.jboss.as.server] (management-handler-thread - 3) JBAS018559: Deployed "ServiceLocatorPropertiesTest"
00:51:26,330 ERROR [org.jboss.as.weld] (pool-4-thread-1) JBAS016000: Failed to setup Weld contexts: javax.naming.NameNotFoundException: BeanManager -- service jboss.naming.context.java.module.ServiceLocatorPropertiesTest.ServiceLocatorPropertiesTest.BeanManager
at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:178)
at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:123)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:214)
at javax.naming.InitialContext.lookup(InitialContext.java:392) [classes.jar:1.6.0_35]
POM file and full log file attached. Any help would be really appreciated.
I'm using @Inject to get the object under test (ServiceLocatorProperties), should I be using Resource(lookup = ....) instead ? I've used @Inject on the other module.
Thanks very much
Scott
-
weld_error.log.zip 5.2 KB
-
pom.xml 9.1 KB