-
15. Re: Weld and Glassfish v3
ludoch Nov 9, 2009 11:57 PM (in response to andygibson.contact.andygibson.net)For netbeans:
http://bits.netbeans.org/download/trunk/nightly/latest/
and for Eclipse:
http://download.java.net/glassfish/eclipse/1.1.5/
(very soon at http://download.java.net/glassfish/eclipse/1.1.6 )
Ludo
-
16. Re: Weld and Glassfish v3
andygibson.contact.andygibson.net Nov 10, 2009 4:55 PM (in response to andygibson.contact.andygibson.net)Thanks Ludovich, yes, I'm using 6.8 Beta so I probably am using the wrong version. I'll check out a nightly build and give it a whirl.
Also, I tried to update my eclipse plugins over the last couple of weeks (through Eclipse) and got errors so I am probably using an older version there too. However, I just updated it and it works just fine,
Thanks for taking the time to come and post a response.
Cheers,
Andy Gibson
-
17. Re: Weld and Glassfish v3
ludoch Nov 11, 2009 5:04 PM (in response to andygibson.contact.andygibson.net)Good to see it is working now. More testing is always weclome, especially in the last days/weeks of a major release like Java EE 6.
Eclipse bundle 1.1.6 is being pushed now...(with better Facelet/JSF support and latest v3 promoted build)
Also, I hope you will notice that Both NetBeans and our Eclipse bundle, have 100% of the Java EE 6 JavaDoc in the Java editor...No other IDEs have that (IntelliJ, JDeveloper, Aptana, all other Eclipse distros...).
You can learn Weld from the editor:-)Send bugs to eiher Netbeans forums or GlassFish forums.
Thanks
Ludo -
18. Re: Weld and Glassfish v3
icordoba Dec 17, 2009 7:04 PM (in response to andygibson.contact.andygibson.net)Hello,
I hope the couple of hours I've spend trying to figure out what happens with Glassfish v3 and Weld helps someone...
I had to include weld-servlet.jar y /WEB-INF/lib dir of my webapp. I ask my self... why? Glassfish docs state it includes weld cdi reference implementation. Shouldn't weld be supported on the fly?
Moreover, not only this... I had to include the following references in web.xml treating Glassfish as if it was just a JSP container (Tomcat, ...):
`<listener>
<listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
</listener>
<resource-env-ref>
<description>Object factory for the CDI Bean Manager</description>
<resource-env-ref-name>BeanManager</resource-env-ref-name>
<resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type>
</resource-env-ref>
`
Now I get some sort of weld support in a test xhtml file I've created. I say this because I am trying to inject a Singleton EJB but weld doesn't treat it as a singleton. It creates a new instance. I get the following warning for the class annotated @Singleton:
`SEVERE|glassfish|global|_ThreadID=13;_ThreadName=Thread-1;|The annotation symbol defined in super-class is not compatible with Session ejb CervatOH2HardwareInterfaceBean.
symbol: TYPE location: class com.cervatoh2.elaphus.ejb.CervatOH2HardwareInterfaceBean
`
I know the @Singleton is fine as I am using that same class with a Struts2 JNDI injection and it really is already in the JVM as a EJB instance. Not for Glassfish+weld :-( -
19. Re: Weld and Glassfish v3
dan.j.allen Dec 17, 2009 7:59 PM (in response to andygibson.contact.andygibson.net)You don't have to modify GlassFish V3 final in any way to use CDI. If for some reason your project is not working properly, consider starting with our Maven 2 archetypes, which should set you on the right path.
http://tinyurl.com/weld-archetypes
Choose the jee-minimal project to get started.
Because of a bug (presumably) in GlassFish, you do have to create the following empty file:
src/main/webapp/WEB-INF/beans.xml
For some reason in GlassFish, it does not detect beans.xml in this legal location:
/src/main/webapp/WEB-INF/classes/META-INF/beans.xml
You can then import the project into NetBeans 6.8, right click and choose
Run
. -
20. Re: Weld and Glassfish v3
dan.j.allen Dec 17, 2009 8:02 PM (in response to andygibson.contact.andygibson.net)
You don't have to modify GlassFish V3 final in any way to use CDI....meaning you shouldn't be adding weld-servlet.jar or listeners to your application.
-
21. Re: Weld and Glassfish v3
matt.drees Dec 17, 2009 9:17 PM (in response to andygibson.contact.andygibson.net)
Dan Allen wrote on Dec 17, 2009 19:59:
For some reason in GlassFish, it does not detect beans.xml in this legal location:/src/main/webapp/WEB-INF/classes/META-INF/beans.xml
Dan, I don't think that's a legal location. The spec (as I understand it) requires the beans.xml file to be located in /WEB-INF for war deployments (see Section 12.1).
-
22. Re: Weld and Glassfish v3
dan.j.allen Dec 17, 2009 10:34 PM (in response to andygibson.contact.andygibson.net)Matt, thanks for pointing that out. You are correct, technically that isn't a legal location. I was mislead because it does happen to work on JBoss AS 6.
But the fact that this location is not permitted seems really inconvenient because it is the one classpath that doesn't allow use of the META-INF directory for declaring a bean archive :( Personally, I don't think beans.xml has any business being in WEB-INF. I filed an issue on this in Weld and GlassFish. Perhaps it will be rejected.
So the lesson to be learned from this thread is that you can't put beans.xml in WEB-INF/classes/META-INF and expect it to be portable ;)