Packaging EJBs

Hi
I'm learning EJB technology just from books, so please forgive me if this question doesn't make sense or answer is simple :)
I'm developing web application that uses EJB. I've about 25-30 entity beans, each in separate jar file. I've recently read that they should be organized into 'packs' of beans that work together.
I undestand, that when I've for example beans Currency and Account, they should be in one jar, as account contains currency code field (and I should create relationship?).
But the thing is more difficult to me in this situation. I have bean: AdminUser which contains data of admins. In most of my beans I've a fields where I should enter admin id - the one made change or created new object of given ejb type. So let's say: Category, Language, Item, Account. All of them are responsilble for something different and I see no reason for putting them into one jar. But each of them needs AdminUser bean. Putting AdminUser bean into each jar probably will produce an JNDI error when deploying. And even if this would be possible, when I'd like to make changes in AdminUser I'd have to change it in all jars.
Could anyone give me advice how should it look like? I don't have anyone who can help me and in books I can't find any complex enough projects.
Thanks in advance,
Michal

There is no rule as such that related classes has to be in a single jar file.
There is no rule that related Classes when has a seperate jar file cannot work
There are options
1)PAckage all the beans in the single jar
2)Package all the beans seperately in each jar file
The bean in a seperate jar file will be used by the container as it considers the classpath and so do not worry
You can use bothe the options to achieve your task
Bye for now
CSJakharia

Similar Messages

  • Packaging EJB client

    Hopefully this will be a simple question for someone out there. I'm trying to package a very simple EJB test application in a jar and distribute it among test clients. The application works great if I run from the command line with out packaging the files, but that's not what i want to do. Here's my configuration:
    JBoss2.4.4 + Tomcat 4.0.1
    test-client.jar
    - jboss-client.jar
    - jboss-j2ee.jar
    - jndi.jar
    - jndi.properties
    - jnp-client.jar
    - myApplication class files
    - meta-inf/manifest.mf
    manifest.mf
    Manifest-Version: 1.0
    Main-Class: bpc.mcs.test.MainProgram
    Created-By: Ant 1.4.1
    Class-Path: jnp-client.jar jboss-j2ee.jar jboss-client.jar
    jndi.properties
    java.naming.factory.initial="org.jnp.interfaces.NamingContextFactory"
    java.naming.provider.url="localhost:1099"
    java.naming.factory.url.pkgs="org.jboss.naming"
    using, java -jar test-client.jar I get the following exception:
    Exception in thread "main" javax.naming.NoInitialContextException:
    Cannot instantiate class: "org.jnp.interfaces.NamingContextFactory". 
    Root exception is java.lang.ClassNotFoundException: "org/jnp/interfaces/NamingContextFactory"
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Unknown Source)
            at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
            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 bpc.mcs.test.EmployeeEJBTest.<init>(EmployeeEJBTest.java:37)
            at bpc.mcs.test.MainProgram.main(MainProgram.java:32)my question is why does this work when i don't have the application packaged up?

    Wow, thank all of you for the feedback!
    ok, I've taken the suggestions and tried them out. After trying all of the suggestions for about an hour, I found the error that was a major roadblock! it had to do with my jndi.properties file. I always that that the name value pairs had to be quoted, but obviously not! On some crazy whim, i tried the following change, and i'm getting past some of the errors! (note the quote difference)
    old jndi.properties
    java.naming.factory.initial="org.jnp.interfaces.NamingContextFactory"
    java.naming.provider.url="localhost:1099"
    java.naming.factory.url.pkgs="org.jboss.naming"
    new jndi.properties
    java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
    java.naming.provider.url=localhost:1099
    java.naming.factory.url.pkgs=org.jboss.naming
    Now, after making this change to the jndi.properties file, i've tried running the application again, but i'm not having any more luck with the jar files. morbidpig's suggestion of unpackaging the jboss jars and repackaging the entire application up with only the class files DOES work, and the application runs very well, and now i'm wondering how to get it running with the jar file? I'm still getting the following error when i jar the application together:
    javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory
    [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
    Cannot instantiate class: org.jnp.interfaces.NamingContextFactory
    current manifest.mf
    Manifest-Version: 1.0
    Main-Class: bpc.mcs.test.MainProgram
    Created-By: Ant 1.4.1
    Class-Path: bpc.jar jnp-client.jar jboss-j2ee.jar jboss-client.jar jboss.jar jndi.jar jnpserver.jar
    is there any reason that it couldn't find these jar files? i might try out setting them in a lib directory in the jar file and see if that makes any difference.
    Thanks for the help so far.

  • Packaging EJB's in J2EE Tutorial...

    There is a discrepancy between the docs in the J2EE tutorial and the DeployTool interface that is making it hard for me to figure out how to get the sample converter EJB successfully deployed.
    The docs in the new SDK v. 1.3.2 references single Home and Remote Interface combo boxes that need to populated for the bean but the dialogue box in the tool has two combo boxes for each interface, namely a "Local Interface" and a "Local Home Interface" and a "Remote Interface" and "Remote Home Interface".
    I have had trouble translating the instructions to figure out which of these boxes I need to populate to make this work. One combination resulted in a deploytime error on the bean and another gave me a runtime error on the servlet.
    Has anybody else run into this and if so, how did you get past it?
    Thanks
    John

    If your used the older deploytool then use the bottom two 'remote' boxes and leave the top two 'local' boxes empty.
    Basically Local means within the container
    and
    remote means outside the container.
    If you want to change yours to be local I think you need to subclass differently. I have not done it yet!
    EricLemle

  • Dependency Injection Problem in EJB 3.0

    Hello.
    I've been trying to get an example of java dependency injection working in JBoss 4.0.5.GA. I've installed it with EJB 3.0 support.
    The problem is that if I try to use the injected resource, I get a null pointer exception.
    The example I'm trying is a very short and simple one. Shouldn't be hard to figure out what is going wrong. Here it goes:
    [root]\src\hello\MessageServlet.java:
    package hello;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.List;
    import java.util.ListIterator;
    import javax.naming.InitialContext;
    import javax.annotation.*;
    public class MessageServlet extends HttpServlet {
         @Resource (mappedName="java:/DefaultDS")
         javax.sql.DataSource ejb30DB;
         public void init () throws ServletException {
         public void service(HttpServletRequest request, HttpServletResponse response)
                   throws IOException, ServletException {
              boolean injectedLookingGood = false;
              boolean notInjectedLookingGood = false;
              try {
                   java.sql.Connection conn = ejb30DB.getConnection();
                   conn.close();
                   injectedLookingGood = true;
              } catch(Exception e) {
                   e.printStackTrace();
              try {
                   InitialContext ic = new InitialContext();
                   javax.sql.DataSource ds = (javax.sql.DataSource)ic.lookup("java:/DefaultDS");
                   java.sql.Connection conn = ds.getConnection();
                   conn.close();
                   notInjectedLookingGood = true;
              } catch(Exception e) {
                   e.printStackTrace();
              response.setContentType("text/html");
              ServletOutputStream out = response.getOutputStream();
              out.println("<html>");
              out.println("<head><title>Hello World</title></head>");
              out.println("<body>");
              out.println("<h1>Hello World</h1>");
              out.println("<form action=\"HelloWorld\" method=\"get\">");
              out.print("Injected DataSource is looking ");
              if(injectedLookingGood) {
                   out.println("good <br>");
              else {
                   out.println("bad <br>");
              out.print("Not-Injected DataSource is looking ");
              if(notInjectedLookingGood) {
                   out.println("good <br/>");
              else {
                   out.println("bad <br/>");
              out.println("<input type=\"submit\" value=\"Test Some More\">");
              out.println("</form>");
              out.println("</body>");
              out.println("</html>");
    [root]\etc\META-INF\web.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
    <display-name>HelloWorldWAR</display-name>
    <servlet>
    <display-name>HelloWorld</display-name>
    <servlet-name>HelloWorldServlet</servlet-name>
    <servlet-class>hello.MessageServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>HelloWorldServlet</servlet-name>
    <url-pattern>/servlet/HelloWorld</url-pattern>
    </servlet-mapping>
    </web-app>
    [root]\etc\META-INF\application.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <application xmlns="http://java.sun.com/xml/ns/j2ee" version="1.4"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com /xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
    <display-name>HelloWorld</display-name>
    <description>Application description</description>
    <module>
    <web>
    <web-uri>web-ejb3.war</web-uri>
    <context-root>HelloWorld</context-root>
    </web>
    </module>
    </application>
    [root]\build.xml:
    <project name="HelloWorld" default="all" basedir=".">
    <!-- Name of project and version -->
    <property name="proj.name" value="HelloWorld"/>
    <property name="proj.version" value="1.0"/>
    <!-- Global properties for thid build -->
    <property name="src.dir" value="${basedir}/src"/>
    <property name="build.dir" value="${basedir}/bin"/>
    <property name="lib.dir" value="${basedir}/lib"/>
    <property name="build.classes.dir" value="${build.dir}/classes"/>
    <property name="build.jar.dir" value="${build.dir}/jar"/>
    <property name="src.etc.dir" value="${basedir}/etc"/>
    <property name="meta-inf.dir" value="${src.etc.dir}/META-INF"/>
    <!-- The build classpath -->
    <path id="build.classpath">
    <fileset dir="${lib.dir}">
    <include name="**/*.jar"/>
    <include name="**/*.zip"/>
    </fileset>
    </path>
    <!-- Useful shortcuts -->
    <patternset id="meta.files">
    <include name="**/*.xml" />
    <include name="**/*.properties"/>
    </patternset>
    <target name="prepare">
    <mkdir dir="${build.dir}"/>
    <mkdir dir="${build.classes.dir}"/>
    <mkdir dir="${build.jar.dir}"/>
    </target>
    <target name="compile" depends="prepare">
    <javac destdir="${build.classes.dir}"
    classpathref="build.classpath"
    debug="on">
    <src path="${src.dir}"/>
    </javac>
    </target>
    <target name="package-web" depends="compile">
    <war warfile="${build.dir}/jar/web-ejb3.war"
    webxml="${meta-inf.dir}/web.xml">
    <classes dir="${build.dir}/classes">
    <include name="**/*Servlet.class"/>
    </classes>
    </war>
    </target>
    <!-- Creates an ear file containing the web client war. -->
    <target name="assemble-app">
    <ear destfile="${build.jar.dir}/HelloWorld.ear" appxml="${meta-inf.dir}/application.xml">
    <fileset dir="${build.dir}/jar"
    includes="*.war"/>
    </ear>
    </target>
    <target name="clean">
    <delete dir="${build.dir}" />
    </target>
    <target name="all">
    <antcall target="clean" />
    <antcall target="package-web" />
    <antcall target="assemble-app" />
    </target>
    </project>
    Any help would be apreciated.
    Thanks in advance,
    Hugo Oliveira
    [email protected]

    Hello Ken.
    I gess dependency injection is unnavailable in servlets as of this moment. I conducted another test using a session bean that injects and tests the DataSource and a servlet calling the session bean via a refference obtained from InitialContext. It worked OK.
    Here's the code:
    [root]/src/hello/MessageHandler.java:
    package hello;
    public interface MessageHandler {
         public boolean testInjection();
    [root]/src/hello/MessageHandlerBean.java:
    package hello;
    import javax.ejb.Stateless;
    import javax.persistence.*;
    import java.util.List;
    import javax.annotation.*;
    @Stateless
    public class MessageHandlerBean implements MessageHandler {
         @Resource (mappedName="java:/DefaultDS")
         private javax.sql.DataSource ds;     
         public boolean testInjection() {
              try {
                   java.sql.Connection conn = ds.getConnection();
                   conn.close();
                   return true;
              } catch(Exception e) {
                   e.printStackTrace();
              return false;
    [root]/src/hello/MessageServlet.java:
    package hello;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.List;
    import java.util.ListIterator;
    import javax.naming.InitialContext;
    import javax.annotation.*;
    public class MessageServlet extends HttpServlet {
         public void init () throws ServletException {
         public void service(HttpServletRequest request, HttpServletResponse response)
                   throws IOException, ServletException {
              boolean injectedLookingGood = false;
              try {
                   InitialContext ic = new InitialContext();
                   MessageHandler mh = (MessageHandler)ic.lookup("HelloWorld/MessageHandlerBean/local");
                   injectedLookingGood = mh.testInjection();
              } catch(Exception e) {
                   e.printStackTrace();
              response.setContentType("text/html");
              ServletOutputStream out = response.getOutputStream();
              out.println("<html>");
              out.println("<head><title>Hello World</title></head>");
              out.println("<body>");
              out.println("<h1>Hello World</h1>");
              out.println("<form action=\"HelloWorld\" method=\"get\">");
              out.print("Injected DataSource is looking ");
              if(injectedLookingGood) {
                   out.println("good <br>");
              else {
                   out.println("bad <br>");
              out.println("<input type=\"submit\" value=\"Test Some More\">");
              out.println("</form>");
              out.println("</body>");
              out.println("</html>");
    [root]/etc/META-INF/application.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <application xmlns="http://java.sun.com/xml/ns/j2ee" version="1.4"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com /xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
    <display-name>HelloWorld</display-name>
    <description>Application description</description>
    <module>
    <ejb>HelloWorld.ejb3</ejb>
    </module>
    <module>
    <web>
    <web-uri>web-ejb3.war</web-uri>
    <context-root>HelloWorld</context-root>
    </web>
    </module>
    </application>
    [root]/etc/META-INF/web.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <display-name>HelloWorldWAR</display-name>
    <servlet>
    <display-name>HelloWorld</display-name>
    <servlet-name>HelloWorldServlet</servlet-name>
    <servlet-class>hello.MessageServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>HelloWorldServlet</servlet-name>
    <url-pattern>/servlet/HelloWorld</url-pattern>
    </servlet-mapping>
    </web-app>
    [root]/build.xml:
    <project name="HelloWorld" default="all" basedir=".">
    <!-- Name of project and version -->
    <property name="proj.name" value="HelloWorld"/>
    <property name="proj.version" value="1.0"/>
    <!-- Global properties for thid build -->
    <property name="src.dir" value="${basedir}/src"/>
    <property name="build.dir" value="${basedir}/bin"/>
    <property name="lib.dir" value="${basedir}/lib"/>
    <property name="build.classes.dir" value="${build.dir}/classes"/>
    <property name="build.jar.dir" value="${build.dir}/jar"/>
    <property name="src.etc.dir" value="${basedir}/etc"/>
    <property name="meta-inf.dir" value="${src.etc.dir}/META-INF"/>
    <!-- The build classpath -->
    <path id="build.classpath">
    <fileset dir="${lib.dir}">
    <include name="**/*.jar"/>
    <include name="**/*.zip"/>
    </fileset>
    </path>
    <!-- Useful shortcuts -->
    <patternset id="meta.files">
    <include name="**/*.xml" />
    <include name="**/*.properties"/>
    </patternset>
    <target name="prepare">
    <mkdir dir="${build.dir}"/>
    <mkdir dir="${build.classes.dir}"/>
    <mkdir dir="${build.jar.dir}"/>
    </target>
    <target name="compile" depends="prepare">
    <javac destdir="${build.classes.dir}"
    classpathref="build.classpath"
    debug="on">
    <src path="${src.dir}"/>
    </javac>
    </target>
    <target name="package-ejb" depends="compile">
    <jar jarfile="${build.jar.dir}/HelloWorld.ejb3">
    <fileset dir="${build.classes.dir}">
    <include name="**/*.class"/>
    </fileset>
    <!--
         <metainf dir="${meta-inf.dir}">
    <include name="persistence.xml"/>
    </metainf>
    -->
    </jar>
    </target>
    <target name="package-web" depends="compile">
    <war warfile="${build.dir}/jar/web-ejb3.war"
    webxml="${meta-inf.dir}/web.xml">
    <!--
    <fileset dir="web">
    <include name="**/*"/>
    </fileset>
    -->
    <!--
    <webinf dir="dd/web">
    <include name="jboss-web.xml"/>
    </webinf>
    -->
    <classes dir="${build.dir}/classes">
    <include name="**/*Servlet.class"/>
    </classes>
    </war>
    </target>
    <!-- Creates an ear file containing the ejb jars and the web client war. -->
    <target name="assemble-app">
    <ear destfile="${build.jar.dir}/HelloWorld.ear" appxml="${meta-inf.dir}/application.xml">
    <fileset dir="${build.dir}/jar"
    includes="*.ejb3,*.war"/>
    </ear>
    <!-- <delete file="${build.dir}/jar/web-ejb3.war"/>
    <delete dir="${build.dir}/classes"/> -->
    </target>
    <target name="clean">
    <delete dir="${build.dir}" />
    </target>
    <target name="all">
    <antcall target="clean" />
    <antcall target="package-ejb" />
    <antcall target="package-web" />
    <antcall target="assemble-app" />
    </target>
    </project>
    Thanks,
    Hugo Oliveira
    [email protected]

  • EJB 3.0 NullPointerException

    Hi,
    I'm a new to JavaEE, especially to ejb3.
    I'm trying to develop a client that call a method against a facade method.
    This's the "session bean for entity class" (automatically written by NeatBeans) equipped to Remote Interface.
    package ejb;
    import java.util.List;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    @Stateless
    public class NewsEntityFacade implements NewsEntityFacadeRemote {
        @PersistenceContext
        private EntityManager em;
        /** Creates a new instance of NewsEntityFacade */
        public NewsEntityFacade() {
        public void create(NewsEntity newsEntity) {
            em.persist(newsEntity);
        public void edit(NewsEntity newsEntity) {
            em.merge(newsEntity);
        public void destroy(NewsEntity newsEntity) {
            em.merge(newsEntity);
            em.remove(newsEntity);
        public NewsEntity find(Object pk) {
            return (NewsEntity) em.find(NewsEntity.class, pk);
        public List findAll() {
            return em.createQuery("select object(o) from NewsEntity as o").getResultList();
    }And the client's Main.
    package newsappclient;
    import ejb.NewsEntityFacadeRemote;
    import java.util.List;
    import javax.ejb.EJB;
    public class Main {
        @EJB
        private static NewsEntityFacadeRemote newsEntityFacade;
        /** Creates a new instance of Main */
        public Main() {
         * @param args the command line arguments
        public static void main(String[] args) {
            // TODO code application logic here
            List EntityList=newsEntityFacade.findAll();
            for(...
                ...etc...
    }I get the following Exception:
    12-set-2007 11.08.48 com.sun.enterprise.appclient.MainWithModuleSupport <init>
    AVVERTENZA: ACC003: Application threw an exception.
    java.lang.NullPointerException
    at newsappclient.Main.main(Main.java:33)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:232)
    at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:329)
    at com.sun.enterprise.appclient.Main.main(Main.java:180)
    Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:340)
    at com.sun.enterprise.appclient.Main.main(Main.java:180)
    Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:232)
    at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:329)
    ... 1 more
    Caused by: java.lang.NullPointerException
    at newsappclient.Main.main(Main.java:33)
    ... 7 more
    Java Result: 1
    run-jar:
    run-display-browser:
    run:
    Could some one tell me what I'm doing wrong ?
    Thanks in advance.
    s1a2

    Me is facing the same problem
    Code of sample application is here
    in Netbeans 5.5 sun application server
    @Remote
    public interface Hello {     
         public String hello();
    @Stateless
    @Remote
    public class HelloBean implements Hello{     
         public String hello(){
              return "Hello World";
    public class HelloClient {
         @EJB
    private static Hello hello;     
         /** Creates a new instance of Client */
         public HelloClient () {
         * @param args
         public static void main(String[] args) throws Exception{          
              if(hello!= null)
                   System.out.println( hello.hello()) ;
              else
                   System.out.println("hello object is null ..........");
    }

  • EJB 3.0 with NetBeans 5.5 help required

    Hi
    I created a simple HelloUser application in NetBeans 5.5 with the following steps. Build is successful with out any exceptions....but not able to get the lines given for testing* in the Hello application...Please help me how to get the lines which I gave for testing in the Hello application:
    1) New Project---> Choose 'Enterprise application' from 'Enterprise' category---->Project Name--Hello, unchecked the Web Application module and checked the client application module--->Finish.
    2)Right click on Hello-ejb -->New file -->In the 'Enterprise' category selected 'Session Bean'---> Gave Ejb Name as HelloUserBean, checked only stateless and Remote--> finish
    // *** Start of HelloUserBean ***//
    package ejb;
    import javax.ejb.Stateless;
    * @author neelima
    @Stateless
    public class HelloUserBean implements ejb.HelloUserRemote {
    /** Creates a new instance of HelloUserBean */
    public HelloUserBean() {
    public void sayHello(String name) {
    System.out.println("Hello " + name + " welcome to EJB 3 In Action!");
    // *** End of HelloUserBean ***//
    // *** Start of HelloUserRemote ***//
    package ejb;
    import javax.ejb.Remote;
    * This is the business interface for HelloUser enterprise bean.
    @Remote
    public interface HelloUserRemote {
    public void sayHello(String name);
    // *** End of HelloUserRemote ***//
    3) Right click on Hello-app-client----> New File---->From 'Java Classes' category selected 'Java Main class' --> Finish
    // *** Start of HelloUserClient.java ****///
    package ejb;
    import javax.ejb.EJB;
    * @author neelima
    public class HelloUserClient {
    @EJB
    private static HelloUserRemote helloUserBean;
    /** Creates a new instance of HelloUserClient */
    public HelloUserClient() {
    * @param args the command line arguments
    public static void main(String[] args) {
    // TODO code application logic here
    helloUserBean.sayHello("Curious George");
    System.out.println("Invoked EJB successfully .. see server console for output");
    // *** End of HelloUserClient.java ****///
    4) Run the Hello-app-client
    The build is successful with out any exceptions....but not able to get the lines given for testing in the Hello application...Please let me know how to get the lines which I gave for testing in the Hello application
    Please find below the Hello-app-client(run)
    init:
    deps-jar:
    Created dir: C:\NetBeans_projects\Hello\Hello-ejb\build\jar
    Created dir: C:\NetBeans_projects\Hello\Hello-ejb\build\ear-module
    Copying 2 files to C:\NetBeans_projects\Hello\Hello-ejb\build\jar\META-INF
    Compiling 2 source files to C:\NetBeans_projects\Hello\Hello-ejb\build\jar
    compile:
    library-inclusion-in-archive:
    Created dir: C:\NetBeans_projects\Hello\Hello-ejb\dist
    Building jar: C:\NetBeans_projects\Hello\Hello-ejb\dist\Hello-ejb.jar
    dist:
    deps-jar:
    Created dir: C:\NetBeans_projects\Hello\Hello-app-client\build\jar
    Copying 2 files to C:\NetBeans_projects\Hello\Hello-app-client\build\jar\META-INF
    Compiling 2 source files to C:\NetBeans_projects\Hello\Hello-app-client\build\jar
    compile:
    Created dir: C:\NetBeans_projects\Hello\Hello-app-client\dist
    Building jar: C:\NetBeans_projects\Hello\Hello-app-client\dist\Hello-app-client.jar
    dist:
    Distributing C:\NetBeans_projects\Hello\Hello-app-client\dist\Hello-app-client.jar to [localhost:4848_server]
    Start registering the project's server resources
    Finished registering server resources
    deployment started : 0%
    deployment finished : 100%
    Deploying application in domain completed successfully
    Trying to create reference for application in target server completed successfully
    Trying to start application in target server completed successfully
    Deployment of application Hello-app-client completed successfully
    Target module started
    run-deploy:
    Copying 1 file to C:\NetBeans_projects\Hello\Hello-app-client\dist
    run-tool:
    run-jar:
    run-display-browser:
    run:
    BUILD SUCCESSFUL (total time: 13 seconds)
    Edited by: Neil_k on Nov 27, 2007 7:10 AM
    Edited by: Neil_k on Nov 27, 2007 7:20 AM
    Edited by: Neil_k on Nov 27, 2007 7:35 AM

    i think the line would not appear in client console but in server console,please check the server console. make sure you have deploy the ejb

  • EJB problem (Seam 2.1.2 + WLS 10.3)

    Hi,
    I'm having some problems getting the EJB version of the booking example in Seam 2.1.2 working with WebLogic 10.3, and I'm hoping that someone here might have some advice. I followed the instructions in Chapter 39 of the Seam documentation for building the application on WebLogic 10.3 (http://docs.jboss.org/seam/2.1.2/reference/en-US/html/weblogic.html), worked through a few dependency issues, and got the application to the point where it deployed cleanly into WLS. When I go to http://localhost:7001/seam-booking, though, I get lots of exceptions, each of whose root cause is this:
    Caused by: javax.naming.NameNotFoundException: While trying to lookup 'jboss-seam-booking.EjbSynchronizations/local' didn't find subcontext 'jboss-seam-booking'. Resolved ''; remaining name 'jboss-seam-booking/EjbSynchronizations/local'
    at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
    at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:247)
    at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)
    at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
    at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:380)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at org.jboss.seam.Component.instantiateSessionBean(Component.java:1400)
    at org.jboss.seam.Component.instantiate(Component.java:1364)
    at org.jboss.seam.Component.newInstance(Component.java:2122)
    ... 48 more
    On the "Deployments" tab of the admin console, I can expand the deployed EAR and see the packaged EJB jars inside of there, and they're identified as EJBs, but I don't see anything in the JNDI tree for that server.
    I am able to get beyond this error by commenting out the "<transaction:ejb-transaction/>" line in components.xml, which gets me to the booking application's home page in the browser, but trying to do anything else (log in, for example), hits the same kinds of error, just with different beans (like the AuthenticatorAction bean).
    Thanks in advance for any suggestions!
    Mark

    I worked out the solution to this one, and have documented it at http://seamframework.org/Community/Weblogic103SetupWithEjbBookingExample#comment106254 for future reference.

  • Error in starting an EAR containing EJBs : Unable to prepare EJB

    I am using ANT build script to create and deploy EAR on WAS server.
    This EAR file packages EJB jar file inside it.
    I am using WAS 5.1.1 Test Environment from IBM RAD 6.0.
    When deployment is done, the application is not in Started status.
    If I try to start it from web-based admin console, I get error given below.
    I examined the missing classes.
    Error CNTR0075E could not find: EJSStatelessSurveyManagerHomeBean_a1e88e5e
    Error WSVR0209E could not find: EJSStatelessSurveyManagerHomeBean_00693296
    When I checked the deployed EAR file, I could locate EJSStatelessSurveyManagerHomeBean_a1e88e5e in the EJB jar file inside the EAR file. I carefully checked the full qualified name. It is there.
    But the other one (classname ending with 00693296) is not there.
    What are these numbers? Are these any ref ids in some xml file (web.xml, ejb-jar.xml, etc)?
    When I searched web based forums for these error codes, I tried varius solutions [e.g. Generate Deploy Code and RMIC, etc] but nothing seems to work :-(
    Is there any solution to it?
    Thanking in advance.
    Error details:
    [8/14/06 14:23:54:017 IST] 6d8b5f3e BeanMetaData E CNTR0075E: The user-provided class "com.queplix.jd.survey.ejb.EJSStatelessSurveyManagerHomeBean_a1e88e5e" needed by the EnterpriseBean could not be found or loaded.
    [8/14/06 14:23:54:017 IST] 6d8b5f3e EJBContainerI E WSVR0209E: Unable to prepare EJB jar DTAC-ejb.jar [class com.ibm.ws.runtime.component.DeployedModuleImpl], enterprise bean com.ibm.etools.ejb.impl.SessionImpl(SurveyManager) (transactionType: Container, sessionType: Stateless)
    java.lang.ClassNotFoundException: com.queplix.jd.survey.ejb.EJSStatelessSurveyManagerHomeBean_00693296
         at com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java(Compiled Code))
         at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java(Compiled Code))
         at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
         at com.ibm.ejs.container.BeanMetaData.loadExistedClass(BeanMetaData.java:2644)
         at com.ibm.ejs.container.BeanMetaData.<init>(BeanMetaData.java:887)
         at com.ibm.ws.runtime.component.EJBContainerImpl.createBeanMetaData(EJBContainerImpl.java:1038)
         at com.ibm.ws.runtime.component.EJBContainerImpl.createModuleMetaData(EJBContainerImpl.java:830)
         at com.ibm.ws.runtime.component.EJBContainerImpl.createMetaData(EJBContainerImpl.java:1575)
         at com.ibm.ws.runtime.component.MetaDataMgrImpl.createFactoryMetaData(MetaDataMgrImpl.java:115)
         at com.ibm.ws.runtime.component.MetaDataMgrImpl.createMetaData(MetaDataMgrImpl.java:159)
         at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:350)
         at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:578)
         at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:311)
         at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:588)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
         at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
         at com.tivoli.jmx.modelmbean.MMBInvoker.invoke(MMBInvoker.java:46)
         at com.tivoli.jmx.modelmbean.MMBInvoker.invokeOperation(MMBInvoker.java:115)
         at com.tivoli.jmx.modelmbean.DynamicModelMBeanSupport.invoke(DynamicModelMBeanSupport.java:409)
         at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:323)
         at com.tivoli.jmx.GenericMBeanSupport.invoke(GenericMBeanSupport.java:178)
         at com.tivoli.jmx.MBeanAccess.invoke(MBeanAccess.java:113)
         at com.tivoli.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:290)
         at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:659)
         at com.ibm.ws.console.core.mbean.MBeanHelper.invoke(MBeanHelper.java:141)
         at com.ibm.ws.console.appdeployment.ApplicationDeploymentCollectionAction.perform(ApplicationDeploymentCollectionAction.java:336)
         at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1791)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
         at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
         at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
         at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
         at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
         at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
         at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
         at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
         at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1171)
         at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:676)
         at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:203)
         at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:125)
         at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:300)
         at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
         at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:246)
         at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
         at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
         at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:652)
         at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:458)
         at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:936)

    Hi,
    It seems one of your ejb jar is missing from the current file location.
    D:\dev\workspaces\.metadata\.plugins\org.eclipse.core.resources\.projects\itr-ear\beadep\citron_domain\itr-ear\split_src
    you can make it manually copied to this location and build the project again so that it can able to deploy propertly.
    Now one more thing you can do open a ticket with oracle support for better assistance.
    Regards,
    Kal

  • EJB build and deployment

    Hi,
    To build ejb jar files, we can include all beans (including bean class, home,
    inteface, and other java classes) of the application into one jar file. Or we
    can make ONE jar file for EACH bean (including only bean class, home and interface.
    NOT other dependent classes that will sit in weblogic server classpath).
    I would like to know any disadvantage for second method in terms of memory, class
    loading, etc. Or any advantage for the second method
    Thanks

    Although you could deploy each bean in a different .jar file , deploying them
    together in an jar file produces a classloader arrangement that allows one ejb
    class to refer to another ejb class. Packaging ejb jar files in a ear file produces
    a common classloader for the ejb jar files.
    "Gary Gu" <[email protected]> wrote:
    >
    Hi,
    To build ejb jar files, we can include all beans (including bean class,
    home,
    inteface, and other java classes) of the application into one jar file.
    Or we
    can make ONE jar file for EACH bean (including only bean class, home
    and interface.
    NOT other dependent classes that will sit in weblogic server classpath).
    I would like to know any disadvantage for second method in terms of memory,
    class
    loading, etc. Or any advantage for the second method
    Thanks

  • Stand-alone JNDI lookup of an EJB in an Enterprise Application (EAR) build

    Hi All,
    I am having some difficulty doing JNDI look up an EJB 3.0 Bean that is part of an Enterprise Application (EAR) build. Below are all the related codes:
    package ejb;
    import javax.ejb.Local;
    @Local
    public interface Hello1Local {
        public String getHello1();
    package ejb;
    import javax.ejb.Stateless;
    @Stateless
    public class Hello1Bean implements Hello1Local {
        public String getHello1() {
            return "I am Hello1 Bean!";
    package ejb;
    import javax.ejb.Remote;
    @Remote
    public interface Hello2Remote {
        public String getHello2();
    package ejb;
    import javax.ejb.Stateless;
    import javax.ejb.EJB;
    @Stateless
    @EJB(name="ejb/Hello1",
         beanInterface=Hello1Local.class,
         beanName="Hello1Bean")
    public class Hello2Bean implements Hello2Remote {
        @EJB private Hello1Local hello1bean;
        public String getHello2() {
            return hello1bean.getHello1();
    There is no problem looking up Hello2 Bean using an Application Client such as the following:
    public class LocalHelloApplicationClient {
        @EJB(name="Hello2")
        private static Hello2Remote hello2Bean;
        public static void main(String[] args) {
            System.out.println("hello2Bean.getHello2(): " + hello2Bean.getHello2());
    }There is also no problem doing JNDI lookup (from a Stand-Alone Client the same bean if both Hello1 and Hello2 were created by themselves. ie not part of an Enterprise Application (EAR) build. However, I am wondering whether it is possible to do JNDI lookup of the same bean (Hello2) that is part of an Enterprise Application (EAR) built. Below are the type of JNDI lookup entries that I have tried without success:
    public class StandalonePojoCallHelloWorld {
        public static void main(String [] args)
            try
                InitialContext jndiContext = new InitialContext();
                Hello2Remote hello2Bean =  (Hello2Remote) jndiContext.lookup("ejb.Hello2Remote");
                                                                     or
                Hello2Remote hello2Bean =  (Hello2Remote) jndiContext.lookup("LocalHelloEnterpriseApplication.Hello2.remote");
                                                                     or
                Hello2Remote hello2Bean =  (Hello2Remote) jndiContext.lookup("LocalHelloEnterpriseApplication.ejb.Hello2Remote");
                                                                     or
                Hello2Remote hello2Bean =  (Hello2Remote) jndiContext.lookup("LocalHelloEnterpriseApplication.Hello2Remote");
                                                                     or
                Hello2Remote hello2Bean =  (Hello2Remote) jndiContext.lookup("LocalHelloEnterpriseApplication.LocalHelloEnterpriseApplication-ejb.Hello2Remote");
                System.out.println("hello2Bean.getHello2(): " + hello2Bean.getHello2());
            catch (javax.naming.NamingException ne)
             ne.printStackTrace();
    They all came up with the same error message:
    javax.naming.NameNotFoundException: LocalHelloEnterpriseApplication.LocalHelloEnterpriseApplication-ejb.Hello2Remote not found
            at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
            at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
            at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
            at com.sun.enterprise.naming.RemoteSerialContextProviderImpl.lookup(RemoteSerialContextProviderImpl.java:129)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)Any suggestion would be appreciated.
    Thanks,
    Jack

    Hello
    I've somme problems to get access to ejb interface from remote stand-alone client.
    Here is my EJB code :
    package stateless;
    import javax.ejb.Stateless;
    @Stateless(name = "TestSB", mappedName = "ejb/stateless/TestSB")
    public class TestEJBBean implements TestEJBRemote {
        public String getMessage() {
           return "Hello EJB World";
    }And the remote interface :
    package stateless;
    import javax.ejb.Remote;
    @Remote
    public interface TestEJBRemote {
        String getMessage();
    } In client side, i just edit main.java like this :
    package testclient;
    import java.io.FileInputStream;
    import java.util.Properties;
    import javax.naming.InitialContext;
    import stateless.TestEJBRemote;
    public class Main {
        public static void main(String[] args) throws Exception {
            Properties props = new Properties();
            props.load(new FileInputStream("jndi.properties"));
            InitialContext ctx = new InitialContext(props);
            TestEJBRemote testEJB = (TestEJBRemote) ctx.lookup("ejb/stateless/TestSB");
            System.out.println(testEJB.getMessage());
    }here is my jndi.properties file (my glassfish server IP is 192.168.0.10) :
    java.naming.factory.initial = com.sun.enterprise.naming.SerialInitContextFactory
    java.naming.factory.url.pkgs = com.sun.enterprise.naming
    java.naming.factory.state = com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl
    org.omg.CORBA.ORBInitialHost = 192.168.0.10
    org.omg.CORBA.ORBInitialPort = 3918when i run client on the same machine than the glassfish app server, it works fine.
    But i run it on the different machine than the glassfish app server (on the same LAN without firewall), it fails with this error message :
    eclan@eclan-laptop:~/NetBeansProjects/TestClient$ java -jar dist/TestClient.jar
    24 ao&ucirc;t 2008 09:53:05 com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
    ATTENTION: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 127.0.1.1; port: 3918"
    org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2690)
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2711)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:261)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:274)
         at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:130)
         at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:192)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:181)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:325)
         at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
         at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
         at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:131)
         at com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:220)
         at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:160)
         at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at testclient.Main.main(Main.java:14)
    Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:347)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:244)
         ... 13 more
    Caused by: java.net.ConnectException: Connection refused
         at sun.nio.ch.Net.connect(Native Method)
         at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507)
         at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:105)
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:332)
         ... 14 more
    24 ao&ucirc;t 2008 09:53:05 com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
    ATTENTION: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 127.0.1.1; port: 4038"
    org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2690)
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2711)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:261)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:274)
         at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:130)
         at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:192)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:181)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:325)
         at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
         at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
         at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:131)
         at com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:220)
         at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:160)
         at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at testclient.Main.main(Main.java:14)
    Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:347)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:244)
         ... 13 more
    Caused by: java.net.ConnectException: Connection refused
         at sun.nio.ch.Net.connect(Native Method)
         at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507)
         at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:105)
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:332)
         ... 14 more
    24 ao&ucirc;t 2008 09:53:05 com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
    ATTENTION: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 127.0.1.1; port: 4138"
    org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2690)
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2711)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:261)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:274)
         at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:130)
         at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:192)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:181)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:325)
         at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
         at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
         at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:131)
         at com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:220)
         at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:160)
         at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at testclient.Main.main(Main.java:14)
    Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:347)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:244)
         ... 13 more
    Caused by: java.net.ConnectException: Connection refused
         at sun.nio.ch.Net.connect(Native Method)
         at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507)
         at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:105)
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:332)
         ... 14 more
    24 ao&ucirc;t 2008 09:53:05 com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
    ATTENTION: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 127.0.1.1; port: 3918"
    org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2690)
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2711)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:261)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:274)
         at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:130)
         at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:192)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:181)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:325)
         at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
         at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
         at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:131)
         at com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:220)
         at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:160)
         at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at testclient.Main.main(Main.java:14)
    Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:347)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:244)
         ... 13 more
    Caused by: java.net.ConnectException: Connection refused
         at sun.nio.ch.Net.connect(Native Method)
         at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507)
         at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:105)
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:332)
         ... 14 more
    24 ao&ucirc;t 2008 09:53:05 com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
    ATTENTION: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 127.0.1.1; port: 4038"
    org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2690)
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2711)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:261)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:274)
         at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:130)
         at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:192)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:181)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:325)
         at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
         at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
         at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:131)
         at com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:220)
         at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:160)
         at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at testclient.Main.main(Main.java:14)
    Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:347)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:244)
         ... 13 more
    Caused by: java.net.ConnectException: Connection refused
         at sun.nio.ch.Net.connect(Native Method)
         at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507)
         at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:105)
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:332)
         ... 14 more
    24 ao&ucirc;t 2008 09:53:05 com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
    ATTENTION: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 127.0.1.1; port: 4138"
    org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2690)
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2711)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:261)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:274)
         at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:130)
         at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:192)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:181)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:325)
         at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
         at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
         at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:131)
         at com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:220)
         at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:160)
         at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at testclient.Main.main(Main.java:14)
    Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:347)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:244)
         ... 13 more
    Caused by: java.net.ConnectException: Connection refused
         at sun.nio.ch.Net.connect(Native Method)
         at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507)
         at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:105)
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:332)
         ... 14 more
    eclan@eclan-laptop:~/NetBeansProjects/TestClient$ THANKS YOU FOR YOUR HELP
    Justin

  • Looking up EJB from Java Web start

    I have a java client application that looks-up an EJB deployed in WebLogic Server 10.3 on windows xp. the application works fine when invoked from command line. But when I try to run the same application via Java Web Start, I get following error while doing EJB lookup:
    java.lang.AssertionError: java.lang.ClassNotFoundException: com.pks.dummy.SL1
    at weblogic.ejb.container.internal.RemoteBusinessIntfGenerator.generateRemoteInterface(RemoteBusinessIntfGenerator.java:57)
    at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.readObject(RemoteBusinessIntfProxy.java:205)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:197)
    at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:564)
    at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:193)
    at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:62)
    at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:240)
    at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348)
    at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
    at weblogic.jndi.internal.ServerNamingNode_1030_WLStub.lookup(Unknown Source)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:392)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:380)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at com.pks.dummy.client.TestClientDummy.doTest(Unknown Source)
    at com.pks.dummy.client.TestClientDummy.main(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.sun.javaws.Launcher.executeApplication(Unknown Source)
    at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
    at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
    at com.sun.javaws.Launcher.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.ClassNotFoundException: com.pks.dummy.SL1
    at weblogic.ejb.container.deployer.RemoteBizIntfClassLoader.getClassBytes(RemoteBizIntfClassLoader.java:151)
    at weblogic.ejb.container.deployer.RemoteBizIntfClassLoader.loadClass(RemoteBizIntfClassLoader.java:96)
    at weblogic.ejb.container.internal.RemoteBusinessIntfGenerator.generateRemoteInterface(RemoteBusinessIntfGenerator.java:54)
    ... 36 more
    #### Java Web Start Error:
    #### null
    com.pks.dummy.SL1 is Remote interface for the Session Bean. and is packaged in same jar with client jar. Also, I am able to instantiate the com.pks.dummy.SL1 using class.forName in main() method of client code in both command line as well as Web start environment.
    Any help is appreciated. Thanks.
    Edited by: javaDev on Dec 19, 2008 11:58 AM
    Edited by: javaDev on Dec 19, 2008 12:18 PM

    I got the solution for ClassNotFound issue. To avoid this error, one need to package EJB stubs on client side. Packaging just the EJB interfaces doesn't help.
    EJB stubs can be generated using weblogic.appc utility. For more information about this utility please refer
    WebLogic Server Command Reference : Link: [http://edocs.bea.com/wls/docs103/pdf/admin_ref.pdf]

  • EJB 3 reference problem

    Hello all.
    I use glassfish b48.
    I need two classes with unidirectional ManyToOne relation:
    Pupil -> Grade
    Pupil.java:
    @Entity
    public class Pupil extends Person {
        @ManyToOne
        private Grade grade;
    }Person.java:
    @Entity
    public class Person extends VersionControl {
    ...VersionControl.java:
    @Entity
    @Inheritance(strategy=InheritanceType.JOINED)
    public class VersionControl implements Serializable {
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO) 
        private Long id;
        ...Grade.java:
    @Entity
    public class Grade extends VersionControl {
    ...When i change Pupil-instance grade attribute from 'A' to 'B' grade attribute in pupil instance, database updates successfully, but grade attribute of Pupil instance contents Grade-class instance with all NULL fields, and
    em.createQuery("select o from Grade o where order by o.name").getResultList();returns Collection with all Grade objects, but on the 'B-object-place' i see object with all fields = null.
    i.e.
    id       name
    "1"        "A"
    "3"        "C"I tried to run on various platforms and glassfish versions, on JavaDB and PostgreSQL database, various CascadeType's - same result.
    When i redeploy my application(or restart server;-)) all is ok.
    If i create new Grade object and use it for setting to Pupil attribute a don't see this problem.
    But if i use "old" Grade object createed before last deploying of application this problem occur.
    Where is my problem?

    The issue is that the Local EJB view was not intended to be accessible across application boundaries. The Local view
    requires pass-by-reference semantics, which implies that both the caller and callee are using the same classloader.
    Some products support cross-application Local EJB access but it's not portable.
    One of the related issues is that the requirement for packaging ejb's in their own ejb-jar is too cumbersome. We're fixing this
    in EJB 3.1 so that EJB components can be packaged directly in a .war. See my blog posting here : http://blogs.sun.com/kensaks/entry/simplified_ejb_component_packaging

  • Ejb ref resolution error

    Dear all,
    I try to set up a simple ejb environment. I managed to run the converter example from the JEE tutorial bundle in the NetBeans / Glassfish environment.
    Then I tried to write a standalone java client. The code consists in essential of the statements
    Context ctx = new InitialContext();
    ctx.lookup("converter.ejb.Converter");Unfortunately, running this program from a windows command line by the "java" command (plus some classpath settings) results in:
    NamingException: ejb ref resolution error for remote business interface converter.ejb.ConverterThe jndi entries of the app server are
    jndi root
      |
      |--  converter.ejb.Converter#converter.ejb.Converter
      |--  converter.ejb.Converter__3_x_Internal_RemoteBusinessHome__
      |
      |--ejb
          |-- converter.ejb.Converter All environment settings are the standard ones.
    Has anybody an idea, what the problem could be ? Thank you very much for your help.
    Ralph

    Hi,
    thanks for your interest. The client code is
    // file ConverterClient
    package ejb.clients;
    import javax.naming.*;
    import java.util.*;
    public class ConverterClient
      public static void main(String[] args)
        try
          Context ctx = new InitialContext();
          ctx.lookup("converter.ejb.Converter");
          Enumeration e = ctx.list("");
          while (e.hasMoreElements())
            System.out.println(e.nextElement());
        catch(NamingException ex)
          ex.printStackTrace();
    }The interface:
    // file Converter
    package converter.ejb;
    import java.math.BigDecimal;
    import javax.ejb.Remote;
    @Remote
    public interface Converter {
        public BigDecimal dollarToYen(BigDecimal dollars);
        public BigDecimal yenToEuro(BigDecimal yen);
    }The bean code is
    // file ConverterBean
    package converter.ejb;
    import java.math.BigDecimal;
    import javax.ejb.Stateless;
    @Stateless
    public class ConverterBean implements converter.ejb.Converter {
        private BigDecimal euroRate = new BigDecimal("0.0070");
        private BigDecimal yenRate = new BigDecimal("112.58");
        public BigDecimal dollarToYen(BigDecimal dollars) {
            BigDecimal result = dollars.multiply(yenRate);
            return result.setScale(2, BigDecimal.ROUND_UP);
        public BigDecimal yenToEuro(BigDecimal yen) {
            BigDecimal result = yen.multiply(euroRate);
            return result.setScale(2, BigDecimal.ROUND_UP);
    }It's been deployed successfully with NetBeans on Glassfish app server.
    The commands for compiling and running the client. "c:\java\JEE" is the installation dir for jee.
    c:\java\programs\src javac -d ..  -cp c:\java\JEE\lib\javaee.jar;c:\java\JEE\lib\appserv-rt.jar   ConverterClient.java
    c:\java\programs java -cp c:\java\JEE\lib\javaee.jar;c:\java\JEE\lib\appserv-rt.jar;.  ejb.clients.ConverterClient

  • Compiling EJB files and Deployment Discriptor

    Hi,
    Could any body tell me step by step process of compiling EJB files and building deployment descriptor. I want to learn from scrap. I search on web but not found material that I need.
    Actually I've made a simple EJB example now I want to compile and want to write a deployment descriptor for that using ant or javac.
    You can also refer me tutorial describing the process form scrap.
    Looking forward,
    Regards,
    Abbasi

    Although you could deploy each bean in a different .jar file , deploying them
    together in an jar file produces a classloader arrangement that allows one ejb
    class to refer to another ejb class. Packaging ejb jar files in a ear file produces
    a common classloader for the ejb jar files.
    "Gary Gu" <[email protected]> wrote:
    >
    Hi,
    To build ejb jar files, we can include all beans (including bean class,
    home,
    inteface, and other java classes) of the application into one jar file.
    Or we
    can make ONE jar file for EACH bean (including only bean class, home
    and interface.
    NOT other dependent classes that will sit in weblogic server classpath).
    I would like to know any disadvantage for second method in terms of memory,
    class
    loading, etc. Or any advantage for the second method
    Thanks

  • Just learning EJB - having problems compiling

    I'm trying to learn EJB by going through the Sun J2EE tutorial. When trying to compile the converter example I get the following error messages:
    E:\MostlyJava\j2eetutorial\examples>ant converter
    Buildfile: build.xml
    init:
    converter:
    [javac] Compiling 4 source files to E:\MostlyJava\j2eetutorial\examples\buil
    d\ejb\converter
    [javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\Converter.java
    :10: cannot resolve symbol
    [javac] symbol : class EJBObject
    [javac] location: package ejb
    [javac] import javax.ejb.EJBObject;
    [javac] ^
    [javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\Converter.java
    :14: cannot resolve symbol
    [javac] symbol : class EJBObject
    [javac] location: interface Converter
    [javac] public interface Converter extends EJBObject {
    [javac] ^
    [javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\ConverterBean.
    java:11: cannot resolve symbol
    [javac] symbol : class SessionBean
    [javac] location: package ejb
    [javac] import javax.ejb.SessionBean;
    [javac] ^
    [javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\ConverterBean.
    java:12: cannot resolve symbol
    [javac] symbol : class SessionContext
    [javac] location: package ejb
    [javac] import javax.ejb.SessionContext;
    [javac] ^
    [javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\ConverterBean.
    java:15: cannot resolve symbol
    [javac] symbol : class SessionBean
    [javac] location: class ConverterBean
    [javac] public class ConverterBean implements SessionBean {
    [javac] ^
    [javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\ConverterBean.
    java:37: cannot resolve symbol
    [javac] symbol : class SessionContext
    [javac] location: class ConverterBean
    [javac] public void setSessionContext(SessionContext sc) {}
    [javac] ^
    [javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\ConverterHome.
    java:12: cannot resolve symbol
    [javac] symbol : class CreateException
    [javac] location: package ejb
    [javac] import javax.ejb.CreateException;
    [javac] ^
    [javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\ConverterHome.
    java:13: cannot resolve symbol
    [javac] symbol : class EJBHome
    [javac] location: package ejb
    [javac] import javax.ejb.EJBHome;
    [javac] ^
    [javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\ConverterHome.
    java:15: cannot resolve symbol
    [javac] symbol : class EJBHome
    [javac] location: interface ConverterHome
    [javac] public interface ConverterHome extends EJBHome {
    [javac] ^
    [javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\ConverterHome.
    java:17: cannot resolve symbol
    [javac] symbol : class CreateException
    [javac] location: interface ConverterHome
    [javac] Converter create() throws RemoteException, CreateException;
    [javac] ^
    [javac] 10 errors
    BUILD FAILED
    E:\MostlyJava\j2eetutorial\examples\build.xml:89: Compile failed, messages shoul
    d have been provided.
    Total time: 2 seconds

    Thanks, for your reply the problem was with the classpath, even though it appears that the ant script points to it I had to set it in the environment.

Maybe you are looking for