J2ee sdk client calling ejb

Folks,
For looking up an ejb what shud the Context.PROVIDER_URL prperty be set to.
and what shud be the port number in particular..
the ejbservice port, the httpservice port (i guess not) or the naming and directory port..???
TIA

Hi,
Before running the client application you need to set the "APPCPATH" environment variable to the path of the client jar file, and the "VMARGS" environment variable to the following value:
-Dorg.omg.CORBA.ORBInitialHost=<server_name>
Where <server_name> is the dns or ip of the server.
Do this in the script that starts the application client, i.e. just before calling "runclient".
I don't think you need to specify the port unless you are using a non-default value.
Hope I've been of some assistance.
Ben New
[email protected]
Leftclick Software Development
http://www.leftclick.com.au/

Similar Messages

  • Client calling EJB + No object bound eror

    Hi,
    I am a newbie to oc4j. I have tried to get a client to call a stateless ejb using a bat file outside the server, with no luck. I get NamingException: No object bound for java:comp/env/EmployeeBean when doing a jndi lookup. I have read the doc's, tried the answers in the forum and I even used the example code provided from oracle, but I still get the same error message every time.
    Has anyone come across this issue when calling an ejb from a client??
    Any help would be greatly appreciated. It’s driving me crazy.
    Thanks
    David

    Hi,
    I will check out the link, thank you. I am a newbie to java and oracle, so any help would be great. i wasnt sure which bits of code would be really helpfull, so i just put most of it in, sorry if it is too much info.
    i am using oracle9ias release 1.0.2.2a (i dont know if this would make any difference). I deploy all my ears using the enterprise manager. The client-jar is within the ear. i use a bat to run the Client code.
    I can get a servlet to call the same ejbs and that works fine.
    #batfile
    ========
    i set the classpath which including refernces to oc4j.jar and oc4jclient.jar and my ejb-jar
    and then i use
    set BigD=-Dorg.omg.CORBA.ORBInitialHost=localhost -Duser.timezone=ECT
    java.exe %BigD% -classpath "%classpath%" com.test.client.Client
    //Client Code
    =============
    public class Client {
         public static void main(String[] args) {
              System.out.println("Client started again...");
              try {
                   Context context = new InitialContext();
                   System.out.println("got context");
                   Object homeObject = context.lookup("java:comp/env/ejb/ConsumerRequestSession");
                   ConsumerRequestSessionHome home = (ConsumerRequestSessionHome) PortableRemoteObject.narrow(homeObject, ConsumerRequestSessionHome.class);
                   System.out.println("got home");
                   ConsumerRequestSession remote = (ConsumerRequestSession) PortableRemoteObject.narrow(home.create(), ConsumerRequestSession.class);
                   System.out.println("got remote");
                   String retValue = remote.getString();
                   System.out.println("The retValue from client is : " + retValue);
              }catch(Exception e) {
                   e.printStackTrace();
                   System.out.println("ERROR in try block of client when creating jndi :" + e.getMessage());
    #jndi
    ====
    java.naming.factory.initial=com.evermind.server.ApplicationClientInitialContextFactory
    java.naming.provider.url=ormi://localhost/test
    java.naming.security.principal=admin     
    java.naming.security.credentials=welcome
    #application-client.xml
    =======================
    <application-client>
    <display-name>ejb/ConsumerRequestSession</display-name>
         <ejb-ref>
              <ejb-ref-name>ejb/ConsumerRequestSession</ejb-ref-name>
              <ejb-ref-type>Session</ejb-ref-type>
              <home>com.test.ejb.ConsumerRequestSessionHome</home>
              <remote>com.test.ejb.ConsumerRequestSession</remote>
         </ejb-ref>
    <!--          <display-name>EmployeeBean</display-name>
         <ejb-ref>
              <ejb-ref-name>EmployeeBean</ejb-ref-name>
              <ejb-ref-type>Session</ejb-ref-type>
              <home>employee.EmployeeHome</home>
              <remote>employee.Employee</remote>
         </ejb-ref>
         -->
    </application-client>
    #orion-application-client.xml
    =============================
    <orion-application-client>
         <ejb-ref-mapping location="com/test/ejb/ConsumerRequestSession" name="ejb/ConsumerRequestSession"/>
         <!--<ejb-ref-mapping name="EmployeeBean" location="employee/EmployeeBean" />
              <ejb-ref-mapping name="EmployeeBean" location="employee/EmployeeBean" />-->
    </orion-application-client>
    #ejb-jar.xml
    <ejb-jar>
         <enterprise-beans>
              <session>
                   <ejb-name>ejb/ConsumerRequestSession</ejb-name>
                   <home>com.test.ejb.ConsumerRequestSessionHome</home>
                   <remote>com.test.ejb.ConsumerRequestSession</remote>
                   <ejb-class>com.test.ejb.ConsumerRequestSessionEJB</ejb-class>
                   <session-type>Stateless</session-type>
                   <transaction-type>Container</transaction-type>
              </session>
         </enterprise-beans>
         <assembly-descriptor>
              <container-transaction>
                   <method>
                        <ejb-name>ejb/ConsumerRequestSession</ejb-name>
                        <method-name>*</method-name>
                   </method>
                   <trans-attribute>Required</trans-attribute>
              </container-transaction>
         </assembly-descriptor>
    </ejb-jar>
    #orion-ejb-jar.xml
    ==================
    <orion-ejb-jar>
         <enterprise-beans>
              <session-deployment location="com/test/ejb/ConsumerRequestSession" name="ejb/ConsumerRequestSession"/>
         </enterprise-beans>
         <assembly-descriptor>
              <default-method-access>
                   <security-role-mapping name="<default-ejb-caller-role>" impliesAll="true"/>
              </default-method-access>
         </assembly-descriptor>     
    </orion-ejb-jar>
    thank you for your help
    david.

  • C client calls EJB weblogic 6.1 - Do I need to purchase ORB

    My client is in C.
    The clint calls beans in weblogic 6.1 through IDL corba.
    Does weblogic 6.1 gives all the tools / software needed while developing ?
    while running ?
    Do I need to buy except of the weblogic also an ORB ?
    Thanks,
    Dalia

    Hi,
    You dont need to buy anothere orb untill it meets your requirements. Most of the app server supports rmi-iiop sementics. You should check this with Weblogic instead for more accurate info.
    Cheers
    Ashwani Kalra
    http://www.geocities.com/ashwani_kalra/
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  • J2EE SDK client-server on my PC

    dear friends, I need your help, please.
    First I studied J2SE as client on my PC.
    Now I should like to study J2EE client-server, but I own only one PC.
    Is it possible to simulate a J2EE client-server situation inside a single PC? And how?
    many many thanks for your attention!

    these 2 steps are done; the 3? step below, I don't
    understand:
    "start the client on your local machine and
    connect to the server."
    You've started the server - that's good. Have you written and deployed an application on it? A servlet or a JSP that you can contact if you start up a browser and type that URL into it? That's the step you've missed. The app server offers you little more than the console until you write and deploy an app on it.
    you are right, my PC doesn't support this. Anything of lighter?I don't know which J2EE app server you've downloaded, but it's likely that you don't need more than a servlet/JSP engine. If that's true, I'd recommend Tomcat: http://tomcat.apache.org
    %

  • J2EE Application Client

    I used Sun Java Studio Enterprise to create a stateful session bean (Cart as in the J2ee Tutorial) and deployed it to Sun Application Server (v7). Then in the same application, I creaed a New EJB Test Application (web based test application) called Cart_TestApp by highlighting the Cart (EJB) node and clicking "Create New EJB Test Application" . Everything is perfect and I could use this Cart_TestApp (once again it is web based test app) to test each function defined in the CartHome, Cart. After that, I created another application client to test this Cart bean. The way I did is that I created another J2EE Application Client called CartTestClient by using Templates-->J2EE--->Application Client. Then in the property sheet of this Application Client, I specified two properties:
    1. Application Server----- Server1 (localhost:8080)
    2. EJB Reference----
    2.1 Reference Name---- ejb/Cart
    2.2 Reference EJB Name----Cart
    2.3 Type---Session
    2.4 Home Interface ----CartHome
    2.5 Remote Interface ---Cart
    After that, I built this Application Client and executed the Application Client, but Studio prompts the following error message:
    You must either set a target application, or provide a client stub jar path in the Sun Java System AS tab on the client property sheet!
    In this case, I clicked ellipse for the "Target Application" on the property sheet, which finally only allows me to specify "Cart_TestApp" , note not Cart(EJB), as the Target Application. And I did it. Finally it works just fine for the Application Test.
    Now my questions are:
    1. How to get the EJB client stub jar in the studio for this Cart (EJB)?
    2. Why does the Application Client work just fine after I specified the "Target Application" item in the property sheet as "Cart_TestApp" since "Cart_TestApp" is only a web based test application for the Cart (EJB)? It seems to me that the EJB Application Client has nothing to do with "Cart_TestApp" since both of them are just test clients (one is web based, another standalone java client). Any insights??
    Thanks.
    Yang

    I have figured it out now and actually Cart_TestApp is just an enterprise application generated by Studio with Cart(EJB) inside. Got confused it with SJSAS v8.

  • Calling EJB from other EJB on other J2EE Server

    Can I call EJB from other EJB on other J2EE Server
    Servers - Websphere 5.0
    Do i require home & remote interface of that ejb on client side also
    Help me, please

    the problem is actually i require that is specific to websphere
    for example i want to call a method ion that ejb
    say my ejb name is myejb
    so the normal way i should call is
    InitialContext initialContext = new InitialContext();     
    Object homeObject = initialContext.lookup("ejb/MyEjbHome");
    MyEJBHome myEJBHome =(MYEjbHome )javax.rmi.PortableRemoteObject.narrow(homeObjectMYEjbHome.class);
              myEJB = lSHome.create();
    myEJB.someMethod();
    but here i am having class for home and remote available
    now if other app server i am not having this classes then what to do

  • Calling EJB from from a client app

    Hi all,
    I am trying to call an EJB component from portal. The example EJB I have taken is from SDN Bonus Calculator example - Application Server/Web Dynpro/Samples and Tutorials/Using EJBs (20)
    I deployed the EAR file - no issue
    I wrote the following code in a client app and trying to connect to the EJB remotely.
              try {
                   java.util.Properties properties = new Properties();
                   properties.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
                   properties.put(Context.PROVIDER_URL, "ux0800:55304");
                   InitialContext ctx = new InitialContext(properties);
                   //InitialContext ctx = new InitialContext();
                   // get ejb home
                   home =
                        (BonusCalculatorLocalHome) ctx.lookup(
                             "localejbs/MySessionBean");
                   theCalculator = home.create();
              } catch (Exception namingException) {
                   namingException.printStackTrace();
    I get the following error
    javax.naming.NoInitialContextException: Cannot instantiate class: com.sap.engine.services.jndi.InitialContextFactoryImpl [Root exception is java.lang.ClassNotFoundException: com.sap.engine.services.jndi.InitialContextFactoryImpl]
         at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
         at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
         at javax.naming.InitialContext.init(Unknown Source)
         at javax.naming.InitialContext.<init>(Unknown Source)
         at com.sap.bonus.calculation.sessionBean.MyCommandBean.<init>(MyCommandBean.java:27)
         at com.sap.bonus.calculation.sessionBean.MyCommandBean.main(MyCommandBean.java:68)
    Caused by: java.lang.ClassNotFoundException: com.sap.engine.services.jndi.InitialContextFactoryImpl
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Unknown Source)
         at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
    Any clue will be appreciated.
    thnx

    Hi Sabbir,
    Following code works for me in calling EJB from normal java application. Did you added the jar files to your application?. see the required jar files in end of code.
    Create simple java applcation do the following steps:
    Give JNDI name to the EJB(HelloJNDI)->Add the HelloEJB to HelloEAR ->deploy
    Proxy Program to call ejb:
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import com.sample.Hello;
    import com.sample.HelloHome;
    public class HelloTest {
         public static void main(String[] args) {
                       Hello remote = null;
                      try {
                        Context ctx = new InitialContext();
                        HelloHome home = (HelloHome) ctx.lookup("HelloJNDI");
                        remote = home.create();
                        String result = remote.hello();
                        System.out.print("Result:" + result);
                         } catch (Exception e) {
                                System.out.println("Exception:" + e.getLocalizedMessage());
    1. Go To  Run > Java Application ->New->select your project and select your main class(java program from which your going to call EJB)
    2. Click  next tab ->(x)=Arguments
    paste the following code in VM Arguments
    -Djava.naming.factory.initial=com.sap.engine.services.jndi.InitialContextFactoryImpl -Djava.naming.provider.url=localhost:50104
    replace the server IP address with your server IP address where your ejbs are running.
    Under Class path settings for the program put the following jar files.
    You can search for them from net weaver soruce folders
    or copy from D:\usr\sap\J2E\JC01\j2ee\j2eeclient
    ejb20.jar
    logging.jar
    exception.jar
    sapj2eeclient.jar
    Add Corresponding ejb.jar
    and RUN >>>
    this makes testing of your client programs easier, you can find the error trace on which line and saves lot of time.
    Regards, Suresh

  • Calling EJB over HTTP from thick client

    Hi,
    But, if I want to use a thick client then how I can make calls through HTTP.
    I know about j2ee client container. But in addition to it, I may have to write some code on client as well on server. Any inputs/guidelines will be helpful for me.
    Thanks,
    Plad

    Hi,
    Thanks. I checked weblogic's documentation for application client but could not find what servlet can be configured.
    In SUN documentation at http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Overview2.html say that- Application clients directly access enterprise beans running in the business tier. However, if application requirements warrant it, a J2EE application client can open an HTTP connection to establish communication with a servlet running in the Web tier.
    Any app. server doc providing details on how servlet needs to be used, what coding is required?How j2ee client container will send HTTP request to server.
    Thanks.

  • How to create and run J2EE application client for Hello World EJB

    Hi
    I am new to NWDS EJB deployment.I have created a "Hello World" bean. But how to deploy it and run using a J2EE application client step by step.
    Also please help in the steps of the deploy tool.
    Thanks in Advance

    Hi Ananda
    Check this link,
    http://help.sap.com/saphelp_nw04/helpdata/en/55/600e64a6793d419b82a3b7d59512a5/content.htm
    cheers
    Sameer

  • Calling EJBs from other EJBs in other J2EE Server?

    How can I call one EJB on one J2EE Server from other
    EJB on other J2EE Server?
    Help me, please.
    Dmitry Tumanov

    Basically call the beans as if you were calling them in the same server through their remote interfaces. Get a InitialContext into the other appserver and then get the home object, narrow it and create a remote reference. You can follow the standard implementation just make sure that the InitialContext you create has the right properties, ie. context factory, urls, etc to the OTHER appserver.

  • Calling EJB from app client

    Hello, everybody,
    I'm very new at EJB and I'm trying to learn it.
    I have created Enterprise Application using Netbeans IDE, I have EJB and APP client. What I want is to connect to my MySql database and get some info from table.
    For e.g. Login and Password.
    How can I call EJB from my client app which connects to my database and gets information I need?

    What server you are using?
    if you use jboss AS ,here is a simple Main class how to connect EJB and access ejb methods:
    package com.david.ejb.client;
    import java.util.Properties;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.rmi.PortableRemoteObject;
    import com.david.ejb.domain.Person;
    import com.david.ejb.domain.PersonRemote;
    public class Main {
         public static void main(String[] args) {
              try {
                   Context ctx = getInitialContext();
                   Object obj = ctx.lookup("PersonSessionRemote/remote");
                PersonRemote pr=(PersonRemote)PortableRemoteObject.narrow(obj, PersonRemote.class);
                Person p=new Person();
                p.setName("david");
                pr.addPerson(p);
                pr.findPerson(1);
                   // System.out.print(br.find(pk).getAuthor_name());
              } catch (Exception ex) {
                   ex.printStackTrace();
         private static Context getInitialContext() throws NamingException {
              Properties p = new Properties();
              p.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.NamingContextFactory");
              p.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
              p.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
              return new InitialContext(p);
    }Person is ant @Entity and PersonRemote is remote interfaces, to connect database you have to make datasource file at jboss-4.2.3.GA\server\default\deploy
    simle mysql-ds.xml looks like this:
    datasources>
       <local-tx-datasource>
          <jndi-name>some name</jndi-name>
          <connection-url>jdbc:mysql://localhost:3306/dbname</connection-url>
          <driver-class>com.mysql.jdbc.Driver</driver-class>
          <user-name>root</user-name>
          <password>root password</password>
          <min-pool-size>5</min-pool-size>
          <max-pool-size>100</max-pool-size>
          <idle-timeout-minutes>15</idle-timeout-minutes>
          <exception-sorter-class-name>com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter</exception-sorter-class-name>
          <valid-connection-checker-class-name>com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker</valid-connection-checker-class-name>
       </local-tx-datasource>
    </datasources>also at resources/META-INF directory you must have persistence.xml like this
    <persistence>
         <persistence-unit name="SimpleEjb">
              <jta-data-source>java:/some name</jta-data-source>
              <properties>
                   <property name="hibernate.hbm2ddl.auto" value="update" />
                   <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
                   <property name="hibernate.show_sql" value="true"/>
                   <property name="hibernate.format_sql" value="true"/>
              </properties>
         </persistence-unit>
    </persistence>

  • How to set jndi context to call EJB?

    Hello!
    install the j2ee sdk 1.4 on a server that has the ip address 211.83.144.48.
    then I deploy a EJB ,but I want to call the method from another pc.
    The problem is that how I initialize the jndi context? How can get the url for "Context.PROVIDER_URL"?
    thks.

    Hi there, I am having what appears to be a very similar problem.
    the code I am using for gaining the initial context is as follows:
    properties.put("java.naming.factory.initial",JNDI_FACT_CLASS_NAME);
    properties.put("java.naming.provider.url", s);
    return new InitialContext(properties);
    where these instantiated variables when pulled out of the hash are :
    java.naming.factory.initial : com.sun.appserv.naming.S1ASCtxFactory
    java.naming.provider.url : iiop://lich.ecs.soton.ac.uk:3700
    this works absolutely fine on the localhost machine, running both client and server, however when
    running on seperate machines I get the same ORB_COMM error as previously stated:
    WARNING: ORBUTIL.connectFailure
    org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:1739) com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:1757)
    ..etc..
    apparently this is caused by :
    java.net.ConnectException: Connection refused
    at sun.nio.ch.Net.connect(Native Method)
    at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:460)
    at java.nio.channels.SocketChannel.open(SocketChannel.java:146)
    ...etc...
    the server is definately up and running, and can provide all other services to the remote client, using both the IP and the DNS resolved name, and JVT seems to work fine, just not corba look up's of a queue.
    I am using the Sun Application Platform Server 8 and the standard j2EE RI versions of corba , JNDI e.t.c
    if you could suggest any further reason why the localhost may be resolvable, but the remote may not I would drastically appreciate the help, as I have been scouring forums for 2 days now, and exhaused all
    other potential solutions.
    thanks
    Tim

  • Simple Client to EJB application

    Hi,
    I'm new to EJB.
    I have J2EE SDK 1.4 beta installed on a windows 2000 pc.
    I have several books with simple examples of clients accessintg simple EJB servers, but none show an example calling an EJB deployed in the application server in the J2EE sdk (Weblogic and Jboss are used in the examples)
    Also, there does not seem to be an example of this in the j2ee 1.4 tutorial that I downloaded from sun.
    The problems arise trying to make contact with the EJB (what JNDI settings etc are required for the sun 1.4 beta application server?)
    My questions are:
    Is there a simple example of this available anywhere. Detailing the settings for accessing the EJB on the sun j2ee 1.4 beta application server.
    Is there good information on what settings are required in deploytool to perform this.
    Is there a good description/explanation of what deplotool actually does under the covers. And whether it is possible to perfor these tasks manually.
    Can I just run the client code, or do I need to run it in some for of client container (ie appclient.bat).
    Thank you
    Colin

    The J2EE 1.4 Tutorial currently posted is a beta version and is incomplete. For EJB,
    it only covers the deltas between 1.3 and 1.4. The complete tutorial, including a
    chapter with a CMP example, will be posted on our web site at the end of this
    month. The tutorial explains how to create apps with the deploytool because it's
    almost impossible to create a correct EJB deployment descriptor (DD) by hand.
    The DD for the tutorial's trivial CMPRoster EJB JAR, for example, is over
    1,000 lines long.
    Dale Green
    Sun Microsystems, Inc.

  • J2EE SDK Security Options?

    I hope someone can advise here. Even better, I hope someone can point to some sample code. Fundamentally, all I want to do is log in to my web application.
    The kicker is that I want the person that logs in to be propagated back to the application tier.
    Simply put, Servlet containers have a security layer, and I can do this:
    Principal p = httpServletRequest.getUserPrincipal();
    and
    if (httpServletRequest.isUserInRole("MYROLE") { ... }
    On the EJB side I can do this in, say, a Session Bean:
    Principal p = sessionContext.getCallerPrincipal();
    and
    if (sessionContext.isCallerInRole("MYROLE") { ... }
    So, what do I need to do to enable Container managed security in a WAR so that both my Servlets and SessionBeans will get the same Principals when they call their respective methods?
    On the surface you'd like to think this would be easy being all part of the happy integrated J2EE family, but it doesn't seem that way.
    I'm looking specifically for the J2EE SDK, SJAS 8.2, as this appears very platform dependent.

    There are 2 other ways you can login to Sun Java System Application Server
    1) using system properties j2eelogin.name and j2eelogin.password
    System.setProperty("j2eelogin.name", usr);
         System.setProperty("j2eelogin.password", pwd);
    2) sun-acc.xml (if you are running application client)
    see the following URL for more details
    http://docs.sun.com/source/817-6087/dgacc.html#wp1010634
    I`m using the Sun Java System Application Server
    Platform Edition 8 to develop some ejb. I`m connecting
    from a remote client. I`ts all working just fine but
    my client needs to be able to login an logout from the
    server. One way to do this seems to be using
    programmatic login as described here
    http://docs.sun.com/source/817-6087/dgsecure.html#wp257
    0 , but it doesnt seems to be an elegant solution.
    Is there someone who can tell me how to get a
    handle to the JAAS login context?
    The security manager doesnt allow to instantiate one
    (i`ve looked in the policy file). And if i use the
    JAAS in the normal way I only get to implement the
    CallbackHandler. It would have been all so nice if i
    would just create a logincontext!

  • Sun J2EE SDK 1.3_01, java.lang.ClassCastException thrown during deployment

    I encountered a bug while using the deploytool to deploy
    an EAR file to the Sun J2EE 1.3_01 server.
    I submitted a bug report to Sun via the Sun Java Developer Connection.
    (Sorry, it has not been assigned a BugID yet)
    Question:
    Does anybody know if the web container in Sun's
    J2EE 1.3_01 server supports access to local enterprise beans?
    Screenshots of the bug are available at
    http://sync4j.sourceforge.net/deploymentbug/
    Full details below....
    -Sean
    category: j2ee
    subcategory: deployment
    release: 1.3_01
    hardware: x86
    OSversion: windows_2000
    synopsis: java.lang.ClassCastException thrown during deployment of Session bean
    java -version
    java version "1.3.1_01"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
    Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)
    C:\j2sdkee1.3\bin>j2ee -version
    Java 2 Enterprise Edition version 1.3_01, build 1.3_01-b01
    I built a EJB 2.0 compliant stateful session bean.
    The session bean has a remote interface (ISyncRemote),
    a remote home interface (ISyncHomeRemote),
    a local interface (ISyncLocal),
    and a local home interface (ISyncHomeLocal).
    I built an HTTP Servlet that is supposed to access
    the Stateful Session Bean using ISyncHomeLocal and
    ISyncLocal
    I run "deploytool.bat" in GUI mode to perform the deployment.
    During deployment, the deploytool GUI displays a message
    box which states:
    "There was a deployment error.
    java.rmi.ServerException: RemoteException occurred in server thread;
    nested exception is:
    java.rmi.RemoteException: An error was encountered while loading
    a web component.
    Please refer to
    <J2EE_HOME>/logs/<machine-name>/j2ee//j2ee/error.log
    for more information. Please verify your Application with the
    Verifier tool."
    The "error.log" file did not contain any useful information.
    I ran the J2EE "verifier.bat" tool to verify that my EAR archive is OK.
    The Sun J2EE server output this error string:
    "java.lang.ClassCastException:
    com.sun.enterprise.deployment.EjbExternalDescriptor"
    Here is the full output from the Sun J2EE server:
    C:\j2sdkee1.3\bin>j2ee -verbose
    J2EE server listen port: 1050
    Naming service started:1050
    Binding DataSource, name = jdbc/EstoreDB, url =
    jdbc:cloudscape:rmi:CloudscapeDB;create=true
    Binding DataSource, name = jdbc/Cloudscape, url =
    jdbc:cloudscape:rmi:CloudscapeDB;create=true
    Binding DataSource, name = jdbc/DB1, url =
    jdbc:cloudscape:rmi:CloudscapeDB;create=true
    Binding DataSource, name = jdbc/DB2, url =
    jdbc:cloudscape:rmi:CloudscapeDB;create=true
    Binding DataSource, name = jdbc/InventoryDB, url =
    jdbc:cloudscape:rmi:CloudscapeDB;create=true
    Binding DataSource, name = jdbc/XACloudscape, url = jdbc/XACloudscape__xa
    Binding DataSource, name = jdbc/XACloudscape__xa, dataSource =
    COM.cloudscape.core.RemoteXaDataSourc
    e@245536
    Starting JMS service...
    Initialization complete - waiting for client requests
    Binding: < JMS Destination : jms/Queue , javax.jms.Queue >
    Binding: < JMS Destination : jms/Topic , javax.jms.Topic >
    Binding: < JMS Cnx Factory : TopicConnectionFactory , Topic , No properties >
    Binding: < JMS Cnx Factory : jms/TopicConnectionFactory , Topic , No properties
    >
    Binding: < JMS Cnx Factory : QueueConnectionFactory , Queue , No properties >
    Binding: < JMS Cnx Factory : jms/QueueConnectionFactory , Queue , No properties
    >
    Starting web service at port: 8000
    Starting secure web service at port: 7000
    J2EE SDK/1.3
    Starting web service at port: 9191
    J2EE SDK/1.3
    J2EE server startup complete.
    Compiling c:\j2sdkee1.3\repository\rbi\gnrtrTMP\Sync4j Server enterprise
    application\sync4j\server\s
    yncbean\SyncBean_LocalHomeImpl.java ....
    Compiling c:\j2sdkee1.3\repository\rbi\gnrtrTMP\Sync4j Server enterprise
    application\sync4j\server\s
    yncbean\SyncBean_EJBLocalObjectImpl.java ....
    Compiling c:\j2sdkee1.3\repository\rbi\gnrtrTMP\Sync4j Server enterprise
    application\sync4j\server\s
    yncbean\SyncBean_RemoteHomeImpl.java ....
    Compiling c:\j2sdkee1.3\repository\rbi\gnrtrTMP\Sync4j Server enterprise
    application\sync4j\server\s
    yncbean\SyncBean_EJBObjectImpl.java ....
    rmic sync4j.server.syncbean.SyncBean_RemoteHomeImpl...
    rmic sync4j.server.syncbean.SyncBean_EJBObjectImpl...
    c:\j2sdkee1.3\repository\rbi\applications\Sync4j Server enterprise
    application1004172068449Server.ja
    r
    Binding name:`java:comp/env/ejb/ISyncHomeRemote`
    Binding name:`java:comp/env/ejb/ISyncHomeLocal`
    java.lang.ClassCastException:
    com.sun.enterprise.deployment.EjbExternalDescriptor
    at com.sun.enterprise.deployment.EjbReferenceDescriptor.getValue
    (EjbReferenceDescriptor.java
    :202)
    at com.sun.enterprise.naming.NamingManagerImpl.bindObjects
    (NamingManagerImpl.java:394)
    at com.sun.web.server.WebService.addContext(WebService.java:148)
    at com.sun.web.server.ServletDeployerImpl.loadWebComponents
    (ServletDeployerImpl.java:214)
    at
    com.sun.enterprise.tools.deployment.backend.JarInstallerImpl.deployWebComponent
    s
    (JarInsta
    llerImpl.java:791)
    at
    com.sun.enterprise.tools.deployment.backend.JarInstallerImpl.deployApplication
    (JarInstall
    erImpl.java:219)
    at
    org.omg.stub.com.sun.enterprise.tools.deployment.backend._JarInstallerImpl_Tie.
    invoke(Un
    known Source)
    at com.sun.corba.ee.internal.corba.ServerDelegate.dispatch
    (ServerDelegate.java:355)
    at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:273)
    at com.sun.corba.ee.internal.iiop.RequestProcessor.process
    (RequestProcessor.java:84)
    at com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThread.run
    (ThreadPool.java:99)
    Does the Sun J2EE server implementation support the invocation
    of Session EJB's via a Local interface?
    Does the Sun J2EE server implementation allow a Servlet to invoke
    Session EJB's via the bean's Local interface?
    While researching this issue, I read the J2EE 1.3 final specification.
    The spec says:
    "The EJB container is required to access to local enterprise beans.
    We recommend that the web container also support access to local
    enterprise beans."
    Does the web container in Sun's J2EE server support access to local enterprise beans?

    I'm pretty much sure that you cannot access a
    local Session bean from outside the EJB container.Please read the J2EE 1.3 specification before posting messages about EJB and J2EE.
    According to the J2EE 1.3 specification:
    "The EJB container is required to support access to local enterprise beans. We recommend that the web container also support access to local enterprise beans.
    No support is provided for access to local enterprise beans from the application client container or the applet container."
    If you use local interfaces for your session bean,
    than your client must be local too. A local client is
    a client that is collocated in the same JVM with the
    session/entity that provides the local view and which
    can be tightly coupled to the bean.My client is running in the same JVM as my EJB. The client is a servlet. The servlet is running in the same JVM as the EJB.
    For what its worth, the error that I observed occurs during deployment. I haven't figured out why deployment is failing.

Maybe you are looking for