users@glassfish.java.net

Re: Running embedded test with multimodule project

From: Marina Vatkina <marina.vatkina_at_oracle.com>
Date: Fri, 18 Jun 2010 09:47:27 -0700

Hi Peter,

I'm glad you are making progress.

Lucky you, we've just added support to EJB Timers with the -all.jar. Try
the latest 3.1 build, but remove the name from the TimerService
@Resource: jdbc/__TimerPool is the underline datasource, not the timer
service itself.

I'm not sure what you can do in terms of testing your web-layer though
because EJB API do not cover that...

Best,
-marina

Major Péter wrote:
> Thanks Marina, you helped me a lot with this. After some fooling around
> with Maven config, I was able to run tests on my EJB module without
> further problems. But now I would like to also test the web-layer, and
> here is the tricky part:
> in my web-module I'm doing lookups for java:comp/env/UserManagerBean and
> so on, but
> * since they are not handled by the ejbcontainer these lookups fails,
> they also need to use the global naming,
> * when it succeed with the lookup by giving the global name I have
> various other problems with my TimerService in my bean:
> @Resource(name = "jdbc/__TimerPool")
> private TimerService timerService;
>
> In my logs I can see this:
> 2010.06.18. 18:26:48 com.sun.ejb.containers.EjbContainerUtilImpl
> deployEJBTimerService
> INFO: Loading EJBTimerService. Please wait.
> 2010.06.18. 18:26:48 com.sun.ejb.containers.EjbContainerUtilImpl
> deployEJBTimerService
> WARNING: Cannot deploy or load EJBTimerService: required WAR file
> (ejb-timer-service-app.war) is not installed
>
> and after that I get:
> Caused by:
> com.sun.enterprise.container.common.spi.util.InjectionException:
> Exception attempting to inject Env-Prop:
> jdbc/__TimerPool_at_Field-Injectable Resource. Class name =
> hu.sch.ejb.TimerServiceBean Field
> name=timerService_at_java.lang.String_at_jdbc/__TimerPool@@ into class
> hu.sch.ejb.TimerServiceBean
>
> So what should I do to make my TimerService work? If I throw my
> TimerService out and change to use @Schedule, will it work?
>
> Since I have to rewrite my lookups for EJB's, probably using global
> naming would be the best idea here, but how could I programmatically get
> the application name? Is there an API for that?
>
> Thanks,
> Peter
>
> 2010-06-18 01:34 keltezéssel, Marina Vatkina írta:
>
>> 3.0.1 has a problem with the manifest file (3.1 also had it until
>> today). Add 'Bundle-SymbolicName: org.glassfish.embedded.all' to the
>> manifest file of the -all.jar.
>>
>> Add module-name to the ejb-jar.xml for the ejb module(s) and java:global
>> will a) work and b) not depend on the directory name. You can continue
>> using java:comp inside your beans, but for the client code only
>> java:global is supported.
>>
>> HTH,
>> -marina
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>