Adam Bien's Weblog

Sunday Nov 13, 2011

"Sniffers with type [connector] and type [ejb] should not claim…" And Solution

The error:

"java.lang.IllegalArgumentException: Sniffers with type [connector] and type [ejb] should not claim the archive at the same time. Please check the packaging of your archive"

happens, when GlassFish doesn't know how to interpret a content of a deployment archive. The error is usually caused by wrong packaging of your archive.

I usually forget to set the scope (see bold tag below) in the pom.xml of the glasssh-embedded-all (needed because of Maven / Java EE 6 trouble), what causes the deployment of the whole embedded GlassFish with the WAR and the error above.

<dependencies>
    <dependency>
        <groupId>org.glassfish.extras</groupId>
        <artifactId>glassfish-embedded-all</artifactId>
        <version>3.1.1</version>
       <scope>provided</scope>
    </dependency>
</dependencies>


I would provide a error message like: "Deployment of servers inside WARs is unusual in Java EE 6 context and may result in not portable applications :-)".


NEW: Java EE 7 Testing and Quality Workshop

A book about rethinking Java EE Patterns

Comments:

Perfect solution, thanks a lot! :)

Posted by Al on May 22, 2012 at 02:09 PM CEST #

Thank you! I had updated my pom to pull the latest version of a glassfish jar rather than use the one on my machine and of course left out the "provided". Your blog has been very useful to me as I try to catch up with what Java has been up for the last 10 years....

Posted by Greg Cooper on August 14, 2012 at 10:07 AM CEST #

Hi,
I am getting the below error :
" java.lang.IllegalArgumentException: Sniffers with type [connector] and type [web] should not claim the archive at the same time. Please check the packaging of your archive. ", while i am trying to deploy spring and Hibernate Application in Galssfish 3.1.2. My current project is not a Maven Project and its just a Java Web Application. Please help me in resolving this issue. If needed i can Post my Project.

Posted by Hemachandra on April 15, 2013 at 04:55 PM CEST #

hi
In my case wht happend is i accidently embeded glassfish-jes.jar[im wrking for embeded servers] in my lib path .Once i remove the glassfish*.jar it is wrking fine

Posted by raju on April 23, 2013 at 01:01 PM CEST #

Thanks a lot! :-)

Posted by Laura on December 12, 2013 at 05:04 PM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
realworldpatterns.com
...the last 150 posts
...the last 10 comments
Links
License