Why is that prefix filtered? Marius's project name seems quite valid. I think we surely need to improve that, or at least display a really loud log message.

Andy.

On 22/05/2014 07:14, Romain Manni-Bucau wrote:
tomee- prefix is filtered, just rename your app/project
Le 22 mai 2014 01:34, "Marius Kruger" <[email protected]> a écrit :

hi again

ok, I give up :S

I'm trying run this simple REST test with embedded OpenEjb but I can bang
my head against the table and it just doesn't want to pick up my
@LocalClient and rest services.
I have other projects with similar code where it works sort of but I can't
spot the difference. As you will see I tried everything :(

git clone https://github.com/amanica/tomee-embedded-trial.git

mvn clean test -Dtest=PingRSEmbeddedOpenEjbTest

org.apache.openejb.OpenEjbContainer$NoModulesFoundException: No modules
found to deploy.
1)Maybe descriptors are placed in incorrect location.
Descriptors could go under:
<base-dir>/META-INF or <base-dir>/WEB-INF
but not directly under <base-dir>
Check 'Application Discovery via the Classpath' docs page for more info
2)Maybe no modules are present in the classpath.
Is 'openejb.base' system property pointing to the intended location?
at

org.apache.openejb.util.Exceptions.newNoModulesFoundException(Exceptions.java:98)
  at

org.apache.openejb.OpenEjbContainer$Provider.load(OpenEjbContainer.java:549)
at

org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:354)
  at
javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:56)
at com.example.AOpenEjbTest.getContext(AOpenEjbTest.java:74)
  at com.example.AOpenEjbTest.inject(AOpenEjbTest.java:51)
at

org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)


$ find -iname "*.xml"
./src/main/webapp/WEB-INF/web.xml
./src/main/webapp/META-INF/context.xml
./src/main/resources/META-INF/ejb-jar.xml
./src/main/resources/META-INF/persistence.xml
./src/test/resources/META-INF/application-client.xml
./src/test/resources/META-INF/ejb-jar.xml
./target/classes/META-INF/ejb-jar.xml
./target/classes/META-INF/persistence.xml
./target/test-classes/META-INF/application-client.xml
./target/test-classes/META-INF/ejb-jar.xml

./target/m2e-wtp/web-resources/META-INF/maven/za.co.enerweb/tomee-embedded-trial/pom.xml
./target/surefire-reports/TEST-com.example.PingRSEmbeddedOpenEjbTest.xml
./pom.xml



@LocalClient
public class PingRSEmbeddedOpenEjbTest extends AOpenEjbTest {
     @EJB
     private Movies movies;

     protected void setProperties(Properties properties) {
         super.setProperties(properties);

         properties.setProperty("openejb.validation.output.level",
"VERBOSE");
         properties.setProperty("openejb.embedded.remotable", "true");
         properties.setProperty("openejb.log.factory", "slf4j");
         properties.setProperty("openejb.tempclassloader.skip",
"annotations");
         properties.setProperty(
             "openejb.deployments.classpath.require.descriptor", "NONE");
         properties.setProperty(EJBContainer.APP_NAME, "appName");
         properties.put("movieDatabase", "new://Resource?type=DataSource");
         properties.put("movieDatabase.JdbcDriver",
"org.hsqldb.jdbcDriver");
         properties.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
     }
     @Test
     public void ping() {
         final String message =
             WebClient.create("http://localhost:8080";).path(
                 // "/" + getClass().getSimpleName() +
                 "/tomee-embedded-trial/MyRestApplication" +
                 "/ping")
                 .get(String.class);
         System.out.println("got message: " + message);
         assertEquals("pong", message);
     }

}


public abstract class AOpenEjbTest {

     private Context context;

     @Before
     public final void setupAOpenEjbTest() throws Exception {
         // needed here for users of our subclasses
         setUpBeforeInjection();
         injectContext();
         setUpAfterInjection();
     }

     private void injectContext() throws Exception {
         if (context == null) {
             context = inject(this);
         }
     }

     private Context inject(final Object target)
         throws NamingException {
         Properties properties = new Properties();
         setProperties(properties);

         Context context = getContext(properties);
         try {
                     context.bind("inject", target);
         } catch (NamingException e) {
             System.out.println("Could not load context.");
             e.printStackTrace();
         }
         return context;
     }

     protected Context getContext(Properties properties) {
         return EJBContainer.createEJBContainer(properties).getContext();
     }

     protected void setProperties(Properties properties) {
         properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
             "org.apache.openejb.client.LocalInitialContextFactory");
         properties.setProperty("openejb.embedded.remotable", "true");
     }
}


Any pointers?
thanks
marius


--
  Andy Gumbrecht

  http://www.tomitribe.com
  [email protected]
  https://twitter.com/AndyGeeDe

  TomEE treibt Tomitribe! | http://tomee.apache.org

Reply via email to