I have exactly the same problem and questions as you have.
Hello Nimo and Susanne,
To answer your question about the WAR vs EAR, Since EJB 3.1 in Java EE 6 works within wars as well as ears, we chose to have the application deploy as a war. I greatly prefer using wars as it builds much faster and can be run very easily from an embedded container, like Glassfish Embedded. Certainly, if there is demand from the community, we can accommodate ears as well.
I am one of the volunteers on the archetypes project and I apologize you got this error. If I read your message correctly, you got the error just by building and deploying. If that's the case, I can vouch that the latest batch does work in JBoss AS 6 M3. You can use it, right now, simply by adding one extra variable to your archetype:generate command:
Here's the command to build the latest:
mvn archetype:generate -DarchetypeArtifactId=jboss-javaee6-webapp -DarchetypeGroupId=org.jboss.weld.archetypes -DarchetypeVersion=1.0.1.Beta1 -DarchetypeRepository=https://oss.sonatype.org/content/repositories/orgjbossweld-187
There's one extra step that's described in detail in the readme.txt and that is to deploy a datasource. If you run:
mvn clean package jboss:hard-deploy
...everything will be automatically taken care of. The newest version has a small CDI and JPA example which requires deploying a datasource (the config is supplied and it's an embedded Hypersonic Database, so it doesn't require an install or any further action on your part).
The new release is greatly improved as it is contains all the specifications, as maintained by the JBoss server team. If you build it, you'll see a much cleaner POM. It's a nice improvement.
We'll get the release out very soon, so in a week or two, you won't have to specify a URL. I'll post an update to this thread when a new version is ready.
Hello Nimo and Susanne,
I apologize, but upon further examination, I see I missed a step in that command. Unfortunately, Maven 2.2 didn't feel like pointing out my stupid mistake and telling me my archetypeRepository URL is invalid (unless you edit your setting.xml first). Rather than update that post and put a temporary procedure up which won't be needed in a few days, I'll update this forum posting with a link to the correct procedure. Expect something in a few days.
I apologize again for the confusion and I promise we'll get something worth up that's worth the wait in a few days!
The problem is that CDI doesn't work with EJBs without a @local interface, so for the EJB, you need to extract the methods to an interface, implement the interface in the class, and then mark the interface with the EJB @Local annotation. It's like without the Local interface its an anonymous EJB that CDI can't find.
Alternatively, I released a set of Java EE 6 Maven Archetypes called Knappsack which were based on the Weld Archetypes that fixes the problems and includes a full Java EE 6 demo application using JSF, JPA and CDI that works with JBoss 6 M3 at least (I haven't tested it on M4 yet) and Glassfish v3.0.1.
Viewless EJBs should be working in M4 (has been since around JBW)
Thanks! I got it working by adding a @local interface.
I would really like to have an EAR archetype. One common use case, I guess, is when you want to have one WAR for the standard web site and one WAR for your mobile web site and point them to different domains e.g. example.com and mobile.example.com.
Yes, it would be really nice to have an EAR-Archetype. EAR is still needed and has its sense in the ejb-world.
I like the knappsack-archetypes and it would be fine to support these archetypes within org.jboss.weld.archetypes.