Beginning Java EE 6 - Chapter 6 and 6a

The key lesson from Chapter 6: don't let more than one sniffer get in your archive.
If you follow the book, you will create a jar file that can't be deployed because:

"The problem with the example as it's described in the book is that a single JAR archive contains both a main() class which the ACC could be interested in and an EJB which is clearly for the EJB Container. The message you are seeing says that GlassFish doesn't know what to do with this archive. Is it an EJB or is it for the AppClient Container? Removing the Main.class entry from the archive should let you deploy the EJB." AlexisMP

So I duplicated Chapter 6 minus the EJB as Chapter 6a, creating a seperate package for the client to avoid the following error:

C:\JavaEE6\Chapter06>asadmin deploy --force=true target\chapter06-1.0.jar
com.sun.enterprise.admin.cli.CommandException: remote failure: Exception while deploying the app : java.lang.IllegalArgumentException: 

Sniffers with type [ejb] and type [appclient] should not claim the archive at the same time. Please check
 the packaging of your archive [C:\glassfishv3\glassfish\domains\domain1\applications\chapter06-1.0]

Command deploy failed.
C:\JavaEE6\Chapter06>

Chapter 6 Deployed EJB Example
Chapter 6a Running the Client

EJBs are server-side components that encapsulate business logic and take care of transactions
and security. They also have an integrated stack for messaging, scheduling, remote access,
web service endpoints (SOAP and REST), dependency injection, component life cycle, AOP
with interceptors, and so on. In addition, EJBs seamlessly integrate with other Java SE and
Java EE technologies, such as JDBC, JavaMail, JPA, Java Transaction API (JTA), Java Messaging
Service (JMS), Java Authentication and Authorization Service (JAAS), Java Naming and
Directory Interface (JNDI), and Remote Method Invocation (RMI). This is why they are used to
build business layers to sit on top of the persistence layer and as an entry point
for presentation-tier technologies like JavaServer Faces (JSF).

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License