users@glassfish.java.net

Why is my EJB Application Client throwing an exception ?

From: <glassfish_at_javadesktop.org>
Date: Wed, 02 Dec 2009 16:56:10 PST

Hello everyone,

Please tell me if I am missing something in calling a simple Stateless session bean
from an application client.

I am trying to run an application client for a simple EJB mentioned in

https://glassfish.dev.java.net/javaee5/ejb/examples/Sless.html .

I am getting following exception :

C:\arun\ejb3practice\Sless3\Sless\client\AppClient>appclient -client client.jar
Dec 2, 2009 4:30:37 PM com.sun.enterprise.appclient.MainWithModuleSupport <init>

WARNING: ACC003: Application threw an exception.
java.io.IOException: Cannot determine the Java EE module type for C:\arun\ejb3pr
actice\Sless3\Sless\client\AppClient\client.jar
        at com.sun.enterprise.deployment.archivist.PluggableArchivistsHelper.get
ArchivistForArchive(PluggableArchivistsHelper.java:140)
        at com.sun.enterprise.deployment.archivist.PluggableArchivistsHelper.get
ArchivistForArchive(PluggableArchivistsHelper.java:98)
        at com.sun.enterprise.deployment.archivist.PluggableArchivistsHelper.get
ArchivistForArchive(PluggableArchivistsHelper.java:110)
        at com.sun.enterprise.deployment.archivist.ArchivistFactory.getArchivist
ForArchive(ArchivistFactory.java:96)
        at com.sun.enterprise.appclient.AppClientInfoFactory.prepareArchivist(Ap
pClientInfoFactory.java:171)
        at com.sun.enterprise.appclient.AppClientInfoFactory.buildAppClientInfo(
AppClientInfoFactory.java:112)
        at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithMod
uleSupport.java:366)
        at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithMod
uleSupport.java:259)
        at com.sun.enterprise.appclient.Main.main(Main.java:200)
Exception in thread "main" java.lang.RuntimeException: java.io.IOException: Cann
ot determine the Java EE module type for C:\arun\ejb3practice\Sless3\Sless\clien
t\AppClient\client.jar


These are the steps I followed to manually build the application without using ant.

I have Set the classpath
set CLASSPATH=%CLASSPATH%;C:\arun\softwares\Java\Java Kingdom\GlassFish\glassfish\lib\javaee.jar;C:\arun\softwares\Java\Java Kingdom\GlassFish\glassfish\lib\appserv-rt.jar;

2. Start the server
> asadmin start-domain domain1

3. Create a deployable EJB module.

C:\arun\ejb3practice\Sless
==================Sless.java==================
package ejb30;
import javax.ejb.Remote;

@Remote
public interface Sless {
    public String hello();
}

==================SlessBean.java==================
package ejb30;

import javax.ejb.Stateless;

@Stateless
public class SlessBean implements Sless {

    public String hello() {
        return "hello, world!\n";
    }

}
==============================================


C:\arun\ejb3practice\Sless>javac -d . *.java
C:\arun\ejb3practice\Sless>jar -cvf Sless.jar ejb30

This creates a deployable jar file ie Sless.jar.


4. Deploy that EJB.
C:\arun\ejb3practice\Sless2>asadmin deploy Sless.jar
Command deploy executed successfully.

And my application client is

package ejb30;
[b]
import javax.ejb.EJB;

public class SlessAppClient {

    @EJB
    private static Sless sless;

    public static void main(String args[]) {

        System.out.println("Sless bean says : " + sless.hello());

    }

}
[/b]

META-INF/MANIFEST.MF
------------------------------------
Main-Class: ejb30.SlessAppClient

C:\arun\ejb3practice\Sless3\Sless\client\AppClient>jar -cvf client.jar ejb30 MET
A-INF
added manifest
adding: ejb30/(in = 0) (out= 0)(stored 0%)
adding: ejb30/Sless.class(in = 197) (out= 164)(deflated 16%)
adding: ejb30/SlessAppClient.class(in = 750) (out= 464)(deflated 38%)
ignoring entry META-INF/
ignoring entry META-INF/MANIFEST.MF




C:\arun\ejb3practice\Sless3\Sless\client\AppClient>appclient -client client.ja
Dec 2, 2009 4:51:10 PM com.sun.enterprise.appclient.MainWithModuleSupport <ini

WARNING: ACC003: Application threw an exception.
Caused by: java.io.IOException: Cannot determine the Java EE module type for C:\
arun\ejb3practice\Sless3\Sless\client\AppClient\client.jar
        at com.sun.enterprise.deployment.archivist.PluggableArchivistsHelper.get
ArchivistForArchive(PluggableArchivistsHelper.java:140)
        at com.sun.enterprise.deployment.archivist.PluggableArchivistsHelper.get
ArchivistForArchive(PluggableArchivistsHelper.java:98)
        at com.sun.enterprise.deployment.archivist.PluggableArchivistsHelper.get
ArchivistForArchive(PluggableArchivistsHelper.java:110)
        at com.sun.enterprise.deployment.archivist.ArchivistFactory.getArchivist
ForArchive(ArchivistFactory.java:96)
        at com.sun.enterprise.appclient.AppClientInfoFactory.prepareArchivist(Ap
pClientInfoFactory.java:171)
        at com.sun.enterprise.appclient.AppClientInfoFactory.buildAppClientInfo(
AppClientInfoFactory.java:112)
        at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithMod
uleSupport.java:366)
        ... 2 more
[Message sent by forum member 'arunkumark007' ]

http://forums.java.net/jive/thread.jspa?messageID=374401