NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

EJB Maven Project: Testing

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
s.hauser



Joined: 21 Dec 2009
Posts: 4

PostPosted: Mon Dec 21, 2009 12:39 pm    Post subject: EJB Maven Project: Testing Reply with quote

Hi
I tried the new NB 6.8 with Maven and Glassfish v3.
While testing i discoverd the automatic generated test code for ejb dont seems to work within a maven project.
Following Error occours:
Absent Code attribute in method that is not native or abstract in class file 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:698)
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:315)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)

I compared it with a traditional ant project and saw that the depency for the embedded glassfish seems to be missing. So i tried to add this depency by adding the http://download.java.net/maven/glassfish/ repository and using the
glassfish-embedded-all snapshot. But this didnt help at all.

Can someone explain me what's the error here and how i can fix it?

kr

Sev
Back to top
Alexis Moussine-Pouchkine
Posted via mailing list.





PostPosted: Mon Dec 21, 2009 3:51 pm    Post subject: Re: EJB Maven Project: Testing Reply with quote

does this help: http://blogs.sun.com/alexismp/entry/testing_ejb_3_1_s ?
-Alexis

On Dec 21, 2009, at 13:39, s.hauser wrote:

Quote:
Hi
I tried the new NB 6.8 with Maven and Glassfish v3.
While testing i discoverd the automatic generated test code for ejb
dont seems to work within a maven project.
Following Error occours:
Absent Code attribute in method that is not native or abstract in
class file 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:698)
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:315)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:
330)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:
398)

I compared it with a traditional ant project and saw that the
depency for the embedded glassfish seems to be missing. So i tried
to add this depency by adding the http://download.java.net/maven/glassfish/
repository and using the
glassfish-embedded-all snapshot. But this didnt help at all.

Can someone explain me what's the error here and how i can fix it?

kr

Sev



Back to top
s.hauser



Joined: 21 Dec 2009
Posts: 4

PostPosted: Mon Dec 21, 2009 4:04 pm    Post subject: Reply with quote

As i wrote, i used the 3.1 SNAPSHOT from here:
http://download.java.net/maven/glassfish/org/glassfish/extras/glassfish-embedded-all/3.1-SNAPSHOT/glassfish-embedded-all-3.1-SNAPSHOT.pom
Didnt work for me. In the default repository http://download.java.net/maven2/ is no embedded glassfish as far i see.

kr
Back to top
alexismp



Joined: 22 Dec 2009
Posts: 9
Location: Paris, FRANCE

PostPosted: Tue Dec 22, 2009 5:45 pm    Post subject: Reply with quote

I'd suggest not using SNAPSHOT but b74.2 instead which is the v3 final version. Have you tried http://download.java.net/maven/2 (not "/maven2")?
Back to top
s.hauser



Joined: 21 Dec 2009
Posts: 4

PostPosted: Wed Dec 23, 2009 1:13 pm    Post subject: Reply with quote

I found the problem.
The javaee-api is added by netbeans as "provided".
This conflicts with my manual entry.

<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.glassfish.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>3.0-b74b</version>
<scope>test</scope>
</dependency>

If i remove the javaee-api the test runs fine and the deployment still works.
But i dont understand why. As far i know the scope "provided" should be ignored in the test run.

kr Sev

PS: I dont see a glassfish embedded version in http://download.java.net/maven/2/.
Back to top
petarj



Joined: 24 Jan 2010
Posts: 1

PostPosted: Sun Jan 24, 2010 9:57 pm    Post subject: Reply with quote

Yes that solved a problem for me too, thanks.
A small update to that, inspired by this post:

I rearranged dependencies like this:
Code:

<dependency>
  <groupId>org.glassfish.extras</groupId>
  <artifactId>glassfish-embedded-all</artifactId>
  <version>3.0-b74</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>javaee</groupId>
  <artifactId>javaee-api</artifactId>
  <version>5</version>
  <scope>provided</scope>
</dependency>

and it worked fine without having to switch javaee scope every time i needed testing.
Back to top
9802075



Joined: 07 Mar 2010
Posts: 4
Location: Finland

PostPosted: Fri Mar 19, 2010 4:23 pm    Post subject: Reply with quote

I am a bit newbie with Netbeans 6.8 and Glassfish v3, and I have the same problem with testing EJB's in embedded container with JUnit4. I get the error message saying "no EJBContainer provider available".

I am not able to modify pom.xml or pom.modify -files under glassfish-embedded-static-shell.jar in Netbeans, the pom.xml won't even open. Neither am I able to locate the glassfish-embedded-static-shell.jar -file in my computer in order to add a xml-file there. Besides, after saving the xml-file I got from http://download.java.net/maven/glassfish/org/glassfish/extras/glassfish-embedded-all/3.1-SNAPSHOT/glassfish-embedded-all-3.1-SNAPSHOT.pom I am not able to modify it with my xml-editor.
I would like to know exactly how to modify those files and where to put them in order to get testing EJB's working. Could u help me?

-M-

EDIT: I figured out the modifying part of my problem. I still need help with the proper location.
Back to top
9802075



Joined: 07 Mar 2010
Posts: 4
Location: Finland

PostPosted: Mon Mar 22, 2010 8:59 pm    Post subject: Reply with quote

I downloaded the glassfish-embedded-all.jar -file and added it to the classpath. Now I get a nerror saying "invalid signature file digest for Manifest main attributes". I tried to google a solution for it, but couldn't find anything useful. Any idea what it might be all about?
Back to top
locrianmode



Joined: 13 Apr 2010
Posts: 1

PostPosted: Tue Apr 13, 2010 2:42 am    Post subject: Invalid signature file digest for Manifest main attributes Reply with quote

9802075 wrote:
I downloaded the glassfish-embedded-all.jar -file and added it to the classpath. Now I get a nerror saying "invalid signature file digest for Manifest main attributes". I tried to google a solution for it, but couldn't find anything useful. Any idea what it might be all about?


Somehow, the newer jars are signed. I removed the META-INF/ECLIPSEF.RSA and META-INF/ECLIPSEF.SF files from the jar and there's no more error.

Apart from these, I don't have any idea what's happening Razz

You can use any zip/rar program such as WinRAR to do that or unjar/jar without those files.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo