Tag Archives: glassfish


This is a quite old post, it was not published earlier because I wanted to investigate this topic a bit more. Hope that you will find this useful (and not very misleading).

SEVERE: Exception while deploying the app [arquillian-example] : 
  Sniffers with type [connector] and type [ejb] should not claim the archive at the same time. 
  Please check the packaging of your archive [/..../arquillian-example]

Maybe some of you’ve experienced this kind of error while working with Glassfish. I had this one when started to work with new project (Maven driven, JEE 6 app with Arquillian/JUnit and Glassfish embedded). Project structure was taken from my previous developments, I’ve added literally one class. First deployment and this quite cryptic error message stopped my work.

While looking for some hints, I’ve learned that sniffers are analyzing archive submitted to application server. If you take a look into domain.xml in your Glassfish instance you will find that applications (applications/application) can have various sniffers associated with them e.g.

 <application context-root="/test" location="${com.sun.aas.instanceRootURI}/eclipseApps/test/"
           name="test" directory-deployed="true" object-type="user">
    <property name="appLocation" value="${com.sun.aas.instanceRootURI}/eclipseApps/test/"></property>
    <property name="keepSessions" value="true"></property>
    <property name="defaultAppName" value="test"></property>
    <module name="test">
       <engine sniffer="jpa"></engine>
       <engine sniffer="security"></engine>
       <engine sniffer="web"></engine>
       <engine sniffer="weld"></engine>

This app has JPA/security/web and Weld. From the error message it seems that some sniffers cannot be assigned together with others.

To find out what is going on, I took a look at what is placed in the final WAR. I discovered that Maven is adding glassfish-emb-all.jar to WEB-INF/lib. Quick look at pom.xml and it looks that dependency to glassfish-emb was not properly scoped (lack of <scope>test</scope>). Without glassfish-emb in war everything went smoothly, app was properly deployed.

Oh, well just a stupid mistake in pom. But wait. What is especially interesting in this issue, it seems that sniffers assigment is done only once. This means that if you deploy your app with correct dependencies and afterwards you will accidentaly include glassfish-emb-all into your WAR everything will be fine. At least till the next change of application server which might happen when moving to production web server.