You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Alex Soto <as...@gmail.com> on 2015/05/27 16:41:47 UTC

EJBContainer

Hi I am writing a very simple test using EJBContainer. Code is:

EJBContainer container = EJBContainer.createEJBContainer(properties);

Context context = container.getContext();

context.bind("inject", this);


And the dependency:

<dependency>

  <groupId>org.apache.openejb</groupId>

  <artifactId>openejb-core</artifactId>

  <version>4.7.1</version>

  <scope>test</scope>

</dependency>


But when I run this simple test I get a


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:99)

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

  at
org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:272)

  at
javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:56)

  at
com.scytl.multitenant.CipherTest.shouldGetProtectedDataSource(CipherTest.java:54)

  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

  at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

  at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

  at java.lang.reflect.Method.invoke(Method.java:483)


Any idea of what dependency am I missing? It seems like there is a missing
dependency.


Thank you so much.

Re: EJBContainer

Posted by Andy Gumbrecht <ag...@tomitribe.com>.
Agree, a test needs something to test. Maybe we should change the message
to add a hint?

Andy.

On 28 May 2015 at 14:25, Romain Manni-Bucau <rm...@gmail.com> wrote:

> Well it is the way it is done. If nothing to deploy it fails.
>
> Forcing the MODULES it should work
> Le 28 mai 2015 01:58, "Alex Soto" <as...@gmail.com> a écrit :
>
> > I think I have found the problem, if you add a test without anything on
> > classpath except the test, for example
> >
> > @Test
> > public void testDb() {
> >     Properties p = new Properties();
> >     p.put("movieDatabase", "new://Resource?type=DataSource");
> >     p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
> >     p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
> >
> >     Context context = EJBContainer.createEJBContainer(p).getContext();
> > }
> >
> >
> > Then it throws the exception. But if I run the same test adding for
> example
> > a @Stateless EJB in classpath, then everything works. So it seems that
> > there is a (bug)? in EJBContainer that in case don't find any class it
> > doesn't start and stop but throws an exception.
> >
> >
> >
> > El dc., 27 maig 2015 a les 19:03, Alex Soto (<as...@gmail.com>) va
> > escriure:
> >
> > > No basically I copied the one in cipherdatabase test but for my
> algorithm
> > > El dc., 27 de maig, 2015 a les 16.53 Andy Gumbrecht <
> > > agumbrecht@tomitribe.com> va escriure:
> > >
> > > Do you have a?:
> > >>
> > >> @Module
> > >> @Classes(value = { My.class }, cdi = true)
> > >> public EjbJar app() {
> > >> return new EjbJar();
> > >> }
> > >>
> > >> On 27 May 2015 at 16:41, Alex Soto <as...@gmail.com> wrote:
> > >>
> > >> > Hi I am writing a very simple test using EJBContainer. Code is:
> > >> >
> > >> > EJBContainer container =
> EJBContainer.createEJBContainer(properties);
> > >> >
> > >> > Context context = container.getContext();
> > >> >
> > >> > context.bind("inject", this);
> > >> >
> > >> >
> > >> > And the dependency:
> > >> >
> > >> > <dependency>
> > >> >
> > >> >   <groupId>org.apache.openejb</groupId>
> > >> >
> > >> >   <artifactId>openejb-core</artifactId>
> > >> >
> > >> >   <version>4.7.1</version>
> > >> >
> > >> >   <scope>test</scope>
> > >> >
> > >> > </dependency>
> > >> >
> > >> >
> > >> > But when I run this simple test I get a
> > >> >
> > >> >
> > >> > 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:99)
> > >> >
> > >> >   at
> > >> >
> > >> >
> > >>
> >
> org.apache.openejb.OpenEjbContainer$Provider.load(OpenEjbContainer.java:483)
> > >> >
> > >> >   at
> > >> >
> > >> >
> > >>
> >
> org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:272)
> > >> >
> > >> >   at
> > >> >
> > >>
> >
> javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:56)
> > >> >
> > >> >   at
> > >> >
> > >> >
> > >>
> >
> com.scytl.multitenant.CipherTest.shouldGetProtectedDataSource(CipherTest.java:54)
> > >> >
> > >> >   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > >> >
> > >> >   at
> > >> >
> > >> >
> > >>
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> > >> >
> > >> >   at
> > >> >
> > >> >
> > >>
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > >> >
> > >> >   at java.lang.reflect.Method.invoke(Method.java:483)
> > >> >
> > >> >
> > >> > Any idea of what dependency am I missing? It seems like there is a
> > >> missing
> > >> > dependency.
> > >> >
> > >> >
> > >> > Thank you so much.
> > >> >
> > >>
> > >>
> > >>
> > >> --
> > >>   Andy Gumbrecht
> > >>   https://twitter.com/AndyGeeDe
> > >>   http://www.tomitribe.com
> > >>
> > >
> >
>



-- 
  Andy Gumbrecht
  https://twitter.com/AndyGeeDe
  http://www.tomitribe.com

Re: EJBContainer

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Well it is the way it is done. If nothing to deploy it fails.

Forcing the MODULES it should work
Le 28 mai 2015 01:58, "Alex Soto" <as...@gmail.com> a écrit :

> I think I have found the problem, if you add a test without anything on
> classpath except the test, for example
>
> @Test
> public void testDb() {
>     Properties p = new Properties();
>     p.put("movieDatabase", "new://Resource?type=DataSource");
>     p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
>     p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
>
>     Context context = EJBContainer.createEJBContainer(p).getContext();
> }
>
>
> Then it throws the exception. But if I run the same test adding for example
> a @Stateless EJB in classpath, then everything works. So it seems that
> there is a (bug)? in EJBContainer that in case don't find any class it
> doesn't start and stop but throws an exception.
>
>
>
> El dc., 27 maig 2015 a les 19:03, Alex Soto (<as...@gmail.com>) va
> escriure:
>
> > No basically I copied the one in cipherdatabase test but for my algorithm
> > El dc., 27 de maig, 2015 a les 16.53 Andy Gumbrecht <
> > agumbrecht@tomitribe.com> va escriure:
> >
> > Do you have a?:
> >>
> >> @Module
> >> @Classes(value = { My.class }, cdi = true)
> >> public EjbJar app() {
> >> return new EjbJar();
> >> }
> >>
> >> On 27 May 2015 at 16:41, Alex Soto <as...@gmail.com> wrote:
> >>
> >> > Hi I am writing a very simple test using EJBContainer. Code is:
> >> >
> >> > EJBContainer container = EJBContainer.createEJBContainer(properties);
> >> >
> >> > Context context = container.getContext();
> >> >
> >> > context.bind("inject", this);
> >> >
> >> >
> >> > And the dependency:
> >> >
> >> > <dependency>
> >> >
> >> >   <groupId>org.apache.openejb</groupId>
> >> >
> >> >   <artifactId>openejb-core</artifactId>
> >> >
> >> >   <version>4.7.1</version>
> >> >
> >> >   <scope>test</scope>
> >> >
> >> > </dependency>
> >> >
> >> >
> >> > But when I run this simple test I get a
> >> >
> >> >
> >> > 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:99)
> >> >
> >> >   at
> >> >
> >> >
> >>
> org.apache.openejb.OpenEjbContainer$Provider.load(OpenEjbContainer.java:483)
> >> >
> >> >   at
> >> >
> >> >
> >>
> org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:272)
> >> >
> >> >   at
> >> >
> >>
> javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:56)
> >> >
> >> >   at
> >> >
> >> >
> >>
> com.scytl.multitenant.CipherTest.shouldGetProtectedDataSource(CipherTest.java:54)
> >> >
> >> >   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >> >
> >> >   at
> >> >
> >> >
> >>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> >> >
> >> >   at
> >> >
> >> >
> >>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >> >
> >> >   at java.lang.reflect.Method.invoke(Method.java:483)
> >> >
> >> >
> >> > Any idea of what dependency am I missing? It seems like there is a
> >> missing
> >> > dependency.
> >> >
> >> >
> >> > Thank you so much.
> >> >
> >>
> >>
> >>
> >> --
> >>   Andy Gumbrecht
> >>   https://twitter.com/AndyGeeDe
> >>   http://www.tomitribe.com
> >>
> >
>

Re: EJBContainer

Posted by Alex Soto <as...@gmail.com>.
I think I have found the problem, if you add a test without anything on
classpath except the test, for example

@Test
public void testDb() {
    Properties p = new Properties();
    p.put("movieDatabase", "new://Resource?type=DataSource");
    p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
    p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");

    Context context = EJBContainer.createEJBContainer(p).getContext();
}


Then it throws the exception. But if I run the same test adding for example
a @Stateless EJB in classpath, then everything works. So it seems that
there is a (bug)? in EJBContainer that in case don't find any class it
doesn't start and stop but throws an exception.



El dc., 27 maig 2015 a les 19:03, Alex Soto (<as...@gmail.com>) va
escriure:

> No basically I copied the one in cipherdatabase test but for my algorithm
> El dc., 27 de maig, 2015 a les 16.53 Andy Gumbrecht <
> agumbrecht@tomitribe.com> va escriure:
>
> Do you have a?:
>>
>> @Module
>> @Classes(value = { My.class }, cdi = true)
>> public EjbJar app() {
>> return new EjbJar();
>> }
>>
>> On 27 May 2015 at 16:41, Alex Soto <as...@gmail.com> wrote:
>>
>> > Hi I am writing a very simple test using EJBContainer. Code is:
>> >
>> > EJBContainer container = EJBContainer.createEJBContainer(properties);
>> >
>> > Context context = container.getContext();
>> >
>> > context.bind("inject", this);
>> >
>> >
>> > And the dependency:
>> >
>> > <dependency>
>> >
>> >   <groupId>org.apache.openejb</groupId>
>> >
>> >   <artifactId>openejb-core</artifactId>
>> >
>> >   <version>4.7.1</version>
>> >
>> >   <scope>test</scope>
>> >
>> > </dependency>
>> >
>> >
>> > But when I run this simple test I get a
>> >
>> >
>> > 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:99)
>> >
>> >   at
>> >
>> >
>> org.apache.openejb.OpenEjbContainer$Provider.load(OpenEjbContainer.java:483)
>> >
>> >   at
>> >
>> >
>> org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:272)
>> >
>> >   at
>> >
>> javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:56)
>> >
>> >   at
>> >
>> >
>> com.scytl.multitenant.CipherTest.shouldGetProtectedDataSource(CipherTest.java:54)
>> >
>> >   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> >
>> >   at
>> >
>> >
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>> >
>> >   at
>> >
>> >
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> >
>> >   at java.lang.reflect.Method.invoke(Method.java:483)
>> >
>> >
>> > Any idea of what dependency am I missing? It seems like there is a
>> missing
>> > dependency.
>> >
>> >
>> > Thank you so much.
>> >
>>
>>
>>
>> --
>>   Andy Gumbrecht
>>   https://twitter.com/AndyGeeDe
>>   http://www.tomitribe.com
>>
>

Re: EJBContainer

Posted by Alex Soto <as...@gmail.com>.
No basically I copied the one in cipherdatabase test but for my algorithm
El dc., 27 de maig, 2015 a les 16.53 Andy Gumbrecht <
agumbrecht@tomitribe.com> va escriure:

> Do you have a?:
>
> @Module
> @Classes(value = { My.class }, cdi = true)
> public EjbJar app() {
> return new EjbJar();
> }
>
> On 27 May 2015 at 16:41, Alex Soto <as...@gmail.com> wrote:
>
> > Hi I am writing a very simple test using EJBContainer. Code is:
> >
> > EJBContainer container = EJBContainer.createEJBContainer(properties);
> >
> > Context context = container.getContext();
> >
> > context.bind("inject", this);
> >
> >
> > And the dependency:
> >
> > <dependency>
> >
> >   <groupId>org.apache.openejb</groupId>
> >
> >   <artifactId>openejb-core</artifactId>
> >
> >   <version>4.7.1</version>
> >
> >   <scope>test</scope>
> >
> > </dependency>
> >
> >
> > But when I run this simple test I get a
> >
> >
> > 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:99)
> >
> >   at
> >
> >
> org.apache.openejb.OpenEjbContainer$Provider.load(OpenEjbContainer.java:483)
> >
> >   at
> >
> >
> org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:272)
> >
> >   at
> >
> javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:56)
> >
> >   at
> >
> >
> com.scytl.multitenant.CipherTest.shouldGetProtectedDataSource(CipherTest.java:54)
> >
> >   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >
> >   at
> >
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> >
> >   at
> >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >
> >   at java.lang.reflect.Method.invoke(Method.java:483)
> >
> >
> > Any idea of what dependency am I missing? It seems like there is a
> missing
> > dependency.
> >
> >
> > Thank you so much.
> >
>
>
>
> --
>   Andy Gumbrecht
>   https://twitter.com/AndyGeeDe
>   http://www.tomitribe.com
>

Re: EJBContainer

Posted by Andy Gumbrecht <ag...@tomitribe.com>.
Do you have a?:

@Module
@Classes(value = { My.class }, cdi = true)
public EjbJar app() {
return new EjbJar();
}

On 27 May 2015 at 16:41, Alex Soto <as...@gmail.com> wrote:

> Hi I am writing a very simple test using EJBContainer. Code is:
>
> EJBContainer container = EJBContainer.createEJBContainer(properties);
>
> Context context = container.getContext();
>
> context.bind("inject", this);
>
>
> And the dependency:
>
> <dependency>
>
>   <groupId>org.apache.openejb</groupId>
>
>   <artifactId>openejb-core</artifactId>
>
>   <version>4.7.1</version>
>
>   <scope>test</scope>
>
> </dependency>
>
>
> But when I run this simple test I get a
>
>
> 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:99)
>
>   at
>
> org.apache.openejb.OpenEjbContainer$Provider.load(OpenEjbContainer.java:483)
>
>   at
>
> org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:272)
>
>   at
> javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:56)
>
>   at
>
> com.scytl.multitenant.CipherTest.shouldGetProtectedDataSource(CipherTest.java:54)
>
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
>   at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>
>   at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>
>   at java.lang.reflect.Method.invoke(Method.java:483)
>
>
> Any idea of what dependency am I missing? It seems like there is a missing
> dependency.
>
>
> Thank you so much.
>



-- 
  Andy Gumbrecht
  https://twitter.com/AndyGeeDe
  http://www.tomitribe.com

Re: EJBContainer

Posted by Romain Manni-Bucau <rm...@gmail.com>.
maybe the module name is excluded by default (is it called
'openejb-test-alex' for instance?)


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-05-27 16:41 GMT+02:00 Alex Soto <as...@gmail.com>:

> Hi I am writing a very simple test using EJBContainer. Code is:
>
> EJBContainer container = EJBContainer.createEJBContainer(properties);
>
> Context context = container.getContext();
>
> context.bind("inject", this);
>
>
> And the dependency:
>
> <dependency>
>
>   <groupId>org.apache.openejb</groupId>
>
>   <artifactId>openejb-core</artifactId>
>
>   <version>4.7.1</version>
>
>   <scope>test</scope>
>
> </dependency>
>
>
> But when I run this simple test I get a
>
>
> 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:99)
>
>   at
>
> org.apache.openejb.OpenEjbContainer$Provider.load(OpenEjbContainer.java:483)
>
>   at
>
> org.apache.openejb.OpenEjbContainer$Provider.createEJBContainer(OpenEjbContainer.java:272)
>
>   at
> javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:56)
>
>   at
>
> com.scytl.multitenant.CipherTest.shouldGetProtectedDataSource(CipherTest.java:54)
>
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
>   at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>
>   at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>
>   at java.lang.reflect.Method.invoke(Method.java:483)
>
>
> Any idea of what dependency am I missing? It seems like there is a missing
> dependency.
>
>
> Thank you so much.
>