quality@glassfish.java.net

Re: Unit testing EJB modules with GlassFish Embeddable

From: Wouter van Reeven <wouter_at_van.reeven.nl>
Date: Tue, 5 Jan 2010 11:01:26 +0100

Hi Richard,


Let me start stating that I did not read any of the documentation
concerning your problem. However, I do have a question. Are you sure
that the version of the glassfish-embedded-all artifact should be 3.0
and not 3.1? Apart from that, I don't have a clue.


HTH, Wouter

On Tue, Jan 05, 2010 at 11:54:21AM +0200, Richard Kolb wrote:
> Hi Cats
>
> I am still struggling down the EJB unit testing path.
>
> I've been going though the manual trying to replicate the ejb-embedded sample
> in Maven.
> Docs : http://docs.sun.com/app/docs/doc/821-1208/gjlde?l=en&a=view
> Sample : https://glassfish-samples.dev.java.net/source/browse/*checkout*/
> glassfish-samples/ws/javaee6/ejb/ejb-embedded/docs/index.html
>
> Added this maven dep :
> <dependency>
> <groupId>org.glassfish.extras</groupId>
> <artifactId>glassfish-embedded-all</artifactId>
> <version>3.0</version>
> </dependency>
>
>
> I call the following code in my JUnit test :
> Map<String, Object> p = new HashMap<String, Object>();
> p.put(EJBContainer.APP_NAME, "sample");
>
> EJBContainer c = EJBContainer.createEJBContainer(p);
>
>
> Then I get the below
>
> Please help.
> regards
> Richard
>
>
>
>
> Testsuite: za.co.enerweb.enygma.businesslogic.staging.TestCustomerCrud
> Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.15 sec
>
> Testcase: simple(za.co.enerweb.enygma.businesslogic.staging.TestCustomerCrud):
> Caused an ERROR
> Absent Code attribute in method that is not native or abstract in class file
> javax/ejb/embeddable/EJBContainer
> java.lang.ClassFormatError: Absent Code attribute in method that is not native
> or abstract in class file javax/ejb/embeddable/EJBContainer
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
> at java.security.SecureClassLoader.defineClass
> (SecureClassLoader.java:124)
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
> at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
> at za.co.enerweb.enygma.businesslogic.staging.TestCustomerCrud.simple
> (TestCustomerCrud.java:32)
>
>
> Test za.co.enerweb.enygma.businesslogic.staging.TestCustomerCrud FAILED
>
>

-- 
Ring out the bells again
Like we did when spring began
Wake me up when September ends
[Greenday - Wake Me Up When September Ends]
Skype: wvreeven
Facebook: wvreeven
Twitter: wvreeven