users@glassfish.java.net

Re: Running embedded test with multimodule project

From: Marina Vatkina <marina.vatkina_at_oracle.com>
Date: Thu, 17 Jun 2010 13:57:14 -0700

Uh-oh...

There is no ear support in EJB embeddable API, only a bunch of entries
on your classpath. When there is more than 1 EJB module found, a temp
exploded ear is created. Those parts that are not ejb modules, are
considered "libraries" and copied over to the lib/ subdirectory of that
ear, *and if such parts are directories" they are renamed to have ".jar"
at the end (this is how our deployment back end wants it to be).

This explains test-classes to test-classes.jar transformation. What I
don't understand is the fact that the code that processed test-classes
first recognized it to be a library, but deployment didn't. Do you have
an application.xml anywhere on the classpath?

thanks,
-marina

Major Péter wrote:
> Hmm, good guess. I don't have a test-classes.jar but I do have a
> test-classes folder in ejb/target which contains my test classes...
> The question is how could I say to maven to deploy the EAR or EJB for
> testing?
>
> Thanks,
> Peter
>
> 2010-06-17 22:38 keltezéssel, Marina Vatkina írta:
>
>> what's there in test-classes.jar?
>>
>> thanks,
>> -marina
>>
>> Major Péter wrote:
>>
>>> Same result :(
>>>
>>> -------------------------------------------------------
>>> T E S T S
>>> -------------------------------------------------------
>>> Running hu.sch.ejb.UserManagerTest
>>> 2010.06.17. 22:31:21 com.sun.logging.LogDomains$1 log
>>> SEVERE: ejb.embedded.location_not_exists
>>> 2010.06.17. 22:31:21 com.sun.enterprise.util.EarlyLogger add
>>> INFO: Total time to parse domain.xml: 201 milliseconds
>>> 2010.06.17. 22:31:22 com.sun.logging.LogDomains$1 log
>>> INFO: GlassFish3.1-SNAPSHOT (aldaris-private) startup time :
>>> Embedded(742ms) startup services(435ms) total(1177ms)
>>> 2010.06.17. 22:31:22 com.sun.logging.LogDomains$1 log
>>> INFO: enterprise_used_delegate_name
>>> 2010.06.17. 22:31:22 com.sun.logging.LogDomains$1 log
>>> INFO: JMXStartupService: JMXConnector system is disabled, skipping.
>>> 2010.06.17. 22:31:23 AppServerStartup run
>>> INFO: [Thread[GlassFish Kernel Main Thread,5,main]] started
>>> ... skipping... glassfish-embedded-all-3.1-SNAPSHOT.jar
>>> 2010.06.17. 22:31:24 com.sun.logging.LogDomains$1 log
>>> INFO: [EJBContainerImpl] Deploying app: /tmp/ejb-app4150263082025648217
>>> 2010.06.17. 22:31:32 com.sun.logging.LogDomains$1 log
>>> SEVERE: Exception while deploying the app
>>> java.lang.IllegalArgumentException: Invalid ejb jar [test-classes.jar]:
>>> it contains zero ejb.
>>> ...
>>>
>>> //with a freshly build GlassFish trunk
>>>
>>> Thanks,
>>> Peter
>>>
>>> 2010-06-17 20:30 keltezéssel, Marina Vatkina írta:
>>>
>>>
>>>> OK. It's EJB embeddable API. With 3.0.1 there is no support for
>>>> "libraries" in the classpath - they are ignored.
>>>>
>>>> If an ejb in an ejb jar fails to load because of unresolved dependencies
>>>> (or any other issues), the jar becomes a non-ejb jar :( and you get this
>>>> famous zero ejb message.
>>>>
>>>> Can you try with the latest trunk (but either add 'Bundle-SymbolicName:
>>>> org.glassfish.embedded.all' to its manifest or wait until tomorrow when
>>>> the fix is available in the nightly build)? The only missing feature for
>>>> separate entity jar currently is dropping tables in case of more than 1
>>>> ejb jar in the classpath.
>>>>
>>>> Best,
>>>> -marina
>>>>
>>>> Major Péter wrote:
>>>>
>>>>
>>>>> public class UserManagerTest {
>>>>>
>>>>> private static UserManagerLocal userManager;
>>>>>
>>>>> @BeforeClass
>>>>> public static void initialize() {
>>>>> try {
>>>>> EJBContainer ejb = EJBContainer.createEJBContainer();
>>>>> Context ic = ejb.getContext();
>>>>> userManager = (UserManagerLocal)
>>>>> ic.lookup("UserManagerBean");
>>>>> } catch (Throwable t) {
>>>>> t.printStackTrace();
>>>>> }
>>>>> }
>>>>>
>>>>> @Test
>>>>> public void doSomething() {
>>>>> assertTrue(userManager != null);
>>>>> }
>>>>> }
>>>>>
>>>>> Here the createEJBContainer() fails, the embedded glassfish should
>>>>> notice the domain.xml AFAIK at
>>>>> test/resources/org/glassfish/embed/domain.xml.
>>>>> What am I missing?
>>>>>
>>>>> Thanks,
>>>>> Peter
>>>>>
>>>>> 2010-06-17 20:19 keltezéssel, Marina Vatkina írta:
>>>>>
>>>>>
>>>>>
>>>>>> How does your test code look like?
>>>>>>
>>>>>> thanks,
>>>>>> -marina
>>>>>>
>>>>>> Major Péter wrote:
>>>>>>
>>>>>>
>>>>>>> I'm trying to use exactly this:
>>>>>>> <dependency>
>>>>>>> <groupId>org.glassfish.extras</groupId>
>>>>>>> <artifactId>glassfish-embedded-all</artifactId>
>>>>>>> <version>3.0.1</version>
>>>>>>> <scope>test</scope>
>>>>>>> </dependency>
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Peter
>>>>>>>
>>>>>>> 2010-06-17 20:12 keltezéssel, Marina Vatkina írta:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Are you using EJB embeddable API or embedded GF API?
>>>>>>>>
>>>>>>>> Best,
>>>>>>>> -marina
>>>>>>>>
>>>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>>>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>>>>
>>>>>
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>>>
>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>