开发者

java.lang.IllegalArgumentException: Sniffers with type [ejb] and type [appclient] should not claim the archive at the same time

开发者 https://www.devze.com 2023-01-24 04:27 出处:网络
Environment: GlassFish 3.0.1, NetBeans 6.9, JDK 6u21 Also tested with GlassFish 3.0.1, NetBeans 6.9.1, JDK 6u22, but results are the same.

Environment: GlassFish 3.0.1, NetBeans 6.9, JDK 6u21

Also tested with GlassFish 3.0.1, NetBeans 6.9.1, JDK 6u22, but results are the same.

Problem: Unable to run app-client in an enterprise application (app-client, ejb, war).

The EJB jar has only Local interfaces and contains no main methods.

GlassFish Message

SEVERE: 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:\Users\myUser\.netbeans\6.9\config\GF3\domain1\applications\fabench-app-client]
    at com.sun.enterprise.v3.server.SnifferManagerImpl.validateSniffers(SnifferManagerImpl.java:221)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:426)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:262)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1224)
    at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365)
    at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204)
    at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
    at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
    at java.lang.Thread.run(Thread.java:619)

NetBeans run message

Building jar: F:\NetBeansProjects\fabench\fabench-app-client\dist\fabench-app-client.jar
dist:
pre-run-deploy:
Distributing F:\NetBeansProjects\fabench\fabench-app-client\dist\fabench-app-clie开发者_Go百科nt.jar to [GlassFish Server 3]
deploy?path=F:\NetBeansProjects\fabench\fabench-app-client\dist\fabench-app-client.jar&name=fabench-app-client&force=true failed on GlassFish Server 3
F:\NetBeansProjects\fabench\fabench-app-client\nbproject\build-impl.xml:716: The module has not been deployed.
BUILD FAILED (total time: 0 seconds)

application-client.xml

This contains only the <display-name> tag filled, but <ejb-ref> can also be specified with a <remote> interface. There is no <local> tag, so I guess app-client is only able to work with Remote interfaces. Is this true?

What could be the problem here?

Any help or ideas would be appreciated! Thanks in advance, wheelie


Not a Glassfish expert, but it sounds like the jar is being seen as both an ejb jar and an app client jar. If that's the case, it is not a valid app. First thing I'd check is to ensure your app client jar does not have either:

  1. A META-INF/ejb-jar.xml
  2. Any classes annotated with @Stateless, @Singleton, @Stateful or @MessageDriven

On the other question, right, application clients are remote clients and by definition cannot talk to beans using their @Local interface.


  • App-client accesses EJBs via Remote interfaces
  • Since GlassFish v3, Remote interfaces has to be packed inside a Java Class Library, so interfaces are distributable.
  • App-client has to be inside an enterprise application EAR (but not strictly the same EAR with EJB and WAR).

The tutorial under http://netbeans.org/kb/docs/javaee/entappclient.html explains how to create an app-client, however it doesn't work for me; there is also a question for that matter: Unable to run app-client that is accessing an EJB on GlassFish v3.

0

精彩评论

暂无评论...
验证码 换一张
取 消