Finding EJB from Application Client

When i tried to use lookup function using j2ee1.4 it was throwing an exception "NoInitialContextException".
So I stored Context and port information in System.Property and use them while creating an object of InitialContext. It is working fine.
But my problem is, we were not specifying these things with the earlier versions of j2ee. Is it a right way to get the reference of EJB or is there any other way to do it.
Thanx in Advance
Sandeep

You can put all the necessary properties in jndi.properties file and put the file in an application classpath, i.e. :
jndi.properties file:
java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
java.naming.provider.url=t3://localhost:7001http://java.sun.com/j2se/1.4.2/docs/guide/jndi/spec/jndi/jndi.6.html
Message was edited by: akocic66
akocic66

Similar Messages

  • 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>

  • Error while running EJB from java client on JBOSS

    Hi
    As i am new to EJB i have created a helloworld application in ejb which is working fine when i try to call it from servlet but when i try to invoke the same ejb from java client (i.e from diff jvm) on jboss i got the following error:
    javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]]]
         at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1399)
         at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:579)
         at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
         at javax.naming.InitialContext.lookup(InitialContext.java:351)
         at com.gl.TestClient.main(TestClient.java:39)
    Caused by: javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]]
         at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:254)
         at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1370)
         ... 4 more
    Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]
         at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:228)
         ... 5 more
    Caused by: java.net.ConnectException: Connection refused
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
         at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
         at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
         at java.net.Socket.connect(Socket.java:519)
         at java.net.Socket.connect(Socket.java:469)
         at java.net.Socket.<init>(Socket.java:366)
         at java.net.Socket.<init>(Socket.java:266)
         at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:69)
         at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:62)
         at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:224)
         ... 5 more
    Following is my code:
    Home Interface:
    package com.gl;
    import javax.ejb.CreateException;
    public interface testHome extends EJBHome {
         String JNDI_NAME = "testBean";
         public     test create()
         throws java.rmi.RemoteException,CreateException;
    Remote Interface:
    package com.gl;
    import java.rmi.RemoteException;
    import javax.ejb.EJBObject;
    public interface test extends EJBObject {
         public String welcomeMessage() throws RemoteException;
    Bean:
    package com.gl;
    import java.rmi.RemoteException;
    import javax.ejb.EJBException;
    import javax.ejb.SessionBean;
    import javax.ejb.SessionContext;
    public class testbean implements SessionBean {
         public void ejbActivate() throws EJBException, RemoteException {
              // TODO Auto-generated method stub
         public void ejbPassivate() throws EJBException, RemoteException {
              // TODO Auto-generated method stub
         public void ejbRemove() throws EJBException, RemoteException {
              // TODO Auto-generated method stub
         public void setSessionContext(SessionContext arg0) throws EJBException,
                   RemoteException {
              // TODO Auto-generated method stub
         public void ejbCreate(){}
         public String welcomeMessage(){
              return "Welcome to the World of EJB";
    ejb-jar.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
    <enterprise-beans>
    <session>
    <ejb-name>testBean</ejb-name>
    <home>com.gl.testHome</home>
    <remote>com.gl.test</remote>
    <ejb-class>com.gl.testbean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    </enterprise-beans>
    </ejb-jar>
    jboss.xml:
    <?xml version='1.0' ?>
    <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd">
    <jboss>
    <enterprise-beans>
    <entity>
    <ejb-name>testBean</ejb-name>
    <jndi-name>testBean</jndi-name>
    </entity>
    </enterprise-beans>
    </jboss>
    Client code:
    package com.gl;
    import java.util.Properties;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.rmi.PortableRemoteObject;
    public class TestClient {
         public static void main(String[] args) throws Exception{
                   try{
                   /*     Properties props=new Properties();
                        props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
                        props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
                        props.put(Context.PROVIDER_URL, "jnp://localhost:1099");
                   Properties props = new Properties();
    props.put(Context.INITIAL_CONTEXT_FACTORY,
    "org.jnp.interfaces.NamingContextFactory");
    props.put(Context.PROVIDER_URL, "localhost:1099");
                        System.out.println("Properties ok");
                        //env.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.HttpNamingContextFactory");
                        //env.put(Context.PROVIDER_URL,"http://localhost:8080");
                        //env.put(Context.SECURITY_PRINCIPAL, "");
                        //env.put(Context.SECURITY_CREDENTIALS, "");
                        Context ctx=new InitialContext(props);
                        System.out.println("context ok");
                        //testHome home = (testHome)ctx.lookup("testBean");
                        Object obj = ctx.lookup ("testBean");
                        System.out.println("ojb = " + obj);
                        testHome ejbHome = (testHome)PortableRemoteObject.narrow(obj,testHome.class);
                   test ejbObject = ejbHome.create();
                   String message = ejbObject.welcomeMessage();
                        System.out.println("home ok");
                        System.out.println("remote ok");
                        System.out.println(message);
                        catch(Exception e){e.printStackTrace();}
    I am able to successfully deployed my ejb on JBOSS but i m getting above error when i am trying to invoke ejb from java client.
    kindly suggest me something to solve this issue.
    Regards
    Gagan
    Edited by: Gagan2914 on Aug 26, 2008 3:28 AM

    Is it a remote lookup? Then maybe this will help:
    [http://wiki.jboss.org/wiki/JBoss42FAQ]
    - Roy

  • I unable to run ejb with application client using oc4j j2ee container

    Hi,
    I have installe oracle9i (1.0.2.2) oc4j j2ee container.
    I unable to run the ejbs . please help me how to run ejbs with application client and which files are shall configure.
    See the client application is :
    public static void main (String []args)
    try {
    //Hashtable env = new Hashtable();
    //env.put("java.naming.provider.url", "ormi://localhost/Demo");
    //env.put("java.naming.factory.initial", "com.evermind.server.ApplicationClientInitialContextFactory");
    //env.put(Context.SECURITY_PRINCIPAL, "guest");
    //env.put(Context.SECURITY_CREDENTIALS, "welcome");
    //Context ic = new InitialContext (env);
    System.out.println("\nBegin statelesssession DemoClient.\n");
    Context context = new InitialContext();
    Object homeObject = context.lookup("java:comp/env/DemoApplication");
    DemoHome home= (DemoHome)PortableRemoteObject.narrow(homeObject, DemoHome.class);
    System.out.println("Creating Demo\n");
    Demo demo = home.create();
    System.out.println("The result of demoSelect() is.. " +demo.sayHello());
    }catch ( Exception e )
    System.out.println("::::::Error:::::: ");
    e.printStackTrace();
    System.out.println("End DemoClient....\n");
    When I am running client application I got this type of Exception
    java.lang.SecurityException : No such domain/application: sampledemo
    at com.evermind.server.rmi.RMIConnection.connect(RMIConnection.java : 2040)
    at com.evermind.server.rmi.RMIConnection.connect(RMIConnection.java : 1884)
    at com.evermind.server.rmi.RMIConnection.lookup(RMIConnection.java : 1491)
    at com.evermind.server.rmi.RMIServer.lookup(RMIServer.java : 323)
    at com.evermind.server.rmi.RMIContext.lookup(RMIConext.java : 106)
    at com.evermind.server.administration.LazyResourceFinder.lookup(LazyResourceFinder.java : 59)
    at com.evermind.server.administration.LazyResourceFinder.getEJBHome(LazyResourceFinder.java : 26)
    at com.evermind.server.Application.createContext(Application.java: 653)
    at com.evermind.server.ApplicationClientInitialContext.getInitialContext(ApplicationClientInitialContextFactory.java :179 )
    at javax.naming.spi.NamingManager.getInitialContext(NamingManger.java : 246)
    at javax.naming.InitialContext.getDefaultInitialCtx(InitialContext.java : 246)
    at javax.naming.InitialContext.init(InitialContext.java : 222)
    at javax.naming.InitialContext.<init>(InitialContext.java : 178)
    at DemoClient.main(DemoClient.java : 23)
    .ear file is copied into applications directory.
    I have configured server.xml file like this
    <application name="sampledemo" path="../applications/demos.ear" />
    demos.ear file Contains following files
    application.xml
    demobean.jar
    Manifest.mf
    demobean.jar file contains following files
    application-client.xml
    Demo.class
    DemoBean.class
    DemoHome.class
    ejb-jar.xml
    jndi.properties
    Mainifest.mf
    Please give me your valuable suggestions. Which are shall i configure .
    Thanks & Regards,
    Badri

    Hi Badri,
    ApplicationClientInitialContextFactory is for clients which got deployed inside OC4J container..
    For looking up EJB from a stand alone java client please use RMIInitialContextFactory..So please change ur code....
    Also please check ur server.xml
    Since you have specified your ejb domain as "sampledemo"
    you have to use that domian only for look up..But it seems that you are looking up for "Demo" domain instead of "sampledemo" domain...So change your code to reflect that..
    Code snippet for the same is :
    Hashtable env = new Hashtable();
    env.put("java.naming.provider.url", "ormi://localhost/sampledemo");
    env.put("java.naming.factory.initial", "om.evermind.server.rmi.RMIInitialContextFactory");
    env.put(Context.SECURITY_PRINCIPAL, "guest");
    env.put(Context.SECURITY_CREDENTIALS, "welcome");
    Context ic = new InitialContext (env);
    Hope this helps
    --Venky                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Dependency Injection of EJB in application client

    Hello,
    I did a quick search and did not find a similar posting on this. I apologize if I missed one.
    I wrote a simple stateless session bean based on EJB 3.0 specification. I wrote a simple client called TestCVTApplication. I am hoping to inject this EJB. Here is how I defined my application-client.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <application-client xmlns="http://java.sun.com/xml/ns/j2ee"
                        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-client_1_4.xsd"
                        version="1.4">
        <ejb-ref>     
            <ejb-ref-name>cvt.server.HelloBean</ejb-ref-name>
            <ejb-ref-type>Session</ejb-ref-type>
            <remote>cvt.server.Hello</remote>
            <injection-target>
                <injection-target-class>cvt.client.TestCVTApplication</injection-target-class>
                <injection-target-name>helloEJB</injection-target-name>     
            </injection-target>  
        </ejb-ref>                   
        <callback-handler>
            cvt.client.MyCallbackHandler
        </callback-handler>
    </application-client>When I run my client, I am getting the below exception
    Exception in thread "main" java.lang.InstantiationException: Injection of multiple references to the same target[class = cvt.client.TestCVTApplication, field/property = helloEJB]
    Thanks for your help.
    Mustafa

    Injection is required to be supported in Application Client main classes. This error probably means you have defined two different dependencies that have the same target field name in the main class. Did you put an @EJB annotation in the main class in addition to adding the ejb-ref in the application-client.xml? You should just use either one or the other. Also make sure that the field in the main class has a "static" modifier.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Cannot access to JDBC Resource from application client

    Hello!
    I have created a Connection Pool to my PostgreSQL database and a JDBC Resource via Admin Console in SJSAS 9.1_02. I can ping the connection pool ok.
    I can get a Connection from a Stateless session Bean:
    Context ctx = new InitialContext();               
    DataSource ds = (DataSource)ctx.lookup("jdbc/pgDS");
    Connection c = ds.getConnection();
    //working with c
    c.close();It works fine.
    But when I try to do the same from client application (created with netbeans template "Enterprise Application Client"), I get an exception on this line: Connection c = ds.getConnection();
    The Exception:
    28.10.2008 20:09:10 com.sun.gjc.common.DataSourceObjectBuilder getDataSourceObject
    SEVERE: RAR5099 : Wrong class name or classpath for Datasource Object
    java.lang.ClassNotFoundException: org.postgresql.ds.PGSimpleDataSource
    at com.sun.enterprise.loader.EJBClassLoader.findClassData(EJBClassLoader.java:741)
    at com.sun.enterprise.loader.EJBClassLoader.findClass(EJBClassLoader.java:631)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at com.sun.gjc.common.DataSourceObjectBuilder.getDataSourceObject(DataSourceObjectBuilder.java:251)
    at com.sun.gjc.common.DataSourceObjectBuilder.constructDataSourceObject(DataSourceObjectBuilder.java:106)
    at com.sun.gjc.spi.ManagedConnectionFactory.getDataSource(ManagedConnectionFactory.java:970)
    at com.sun.gjc.spi.DSManagedConnectionFactory.getDataSource(DSManagedConnectionFactory.java:139)
    at com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:93)
    at com.sun.enterprise.resource.LocalTxConnectorAllocator.createResource(LocalTxConnectorAllocator.java:68)
    at com.sun.enterprise.resource.AbstractResourcePool.createSingleResource(AbstractResourcePool.java:891)
    at com.sun.enterprise.resource.AbstractResourcePool.createResourceAndAddToPool(AbstractResourcePool.java:1752)
    at com.sun.enterprise.resource.AbstractResourcePool.createResources(AbstractResourcePool.java:917)
    at com.sun.enterprise.resource.AbstractResourcePool.initPool(AbstractResourcePool.java:225)
    at com.sun.enterprise.resource.AbstractResourcePool.internalGetResource(AbstractResourcePool.java:516)
    at com.sun.enterprise.resource.AbstractResourcePool.getResource(AbstractResourcePool.java:443)
    at com.sun.enterprise.resource.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:248)
    at com.sun.enterprise.resource.PoolManagerImpl.getResource(PoolManagerImpl.java:176)
    at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:327)
    at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:189)
    at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:165)
    at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:158)
    at com.sun.gjc.spi.base.DataSource.getConnection(DataSource.java:108)
    at converter.Main.doConversion(Main.java:56)
    at converter.Main.main(Main.java:29)
    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:266)
    at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:449)
    at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:259)
    at com.sun.enterprise.appclient.Main.main(Main.java:200)
    28.10.2008 20:09:10 com.sun.enterprise.resource.LocalTxConnectorAllocator createResource
    WARNING: RAR5038:Unexpected exception while creating resource for pool vlkvPostgresPool. Exception : Class name is wrong or classpath is not set for : org.postgresql.ds.PGSimpleDataSource
    28.10.2008 20:09:10 com.sun.enterprise.connectors.ConnectionManagerImpl internalGetConnection
    WARNING: RAR5117 : Failed to obtain/create connection from connection pool [ vlkvPostgresPool ]. Reason : Class name is wrong or classpath is not set for : org.postgresql.ds.PGSimpleDataSource
    28.10.2008 20:09:10 com.sun.gjc.spi.base.DataSource getConnection
    WARNING: RAR5114 : Error allocating connection : [Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : org.postgresql.ds.PGSimpleDataSource]
    Caught an unexpected exception!
    java.sql.SQLException: Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : org.postgresql.ds.PGSimpleDataSource
    at com.sun.gjc.spi.base.DataSource.getConnection(DataSource.java:115)
    at converter.Main.doConversion(Main.java:56)
    at converter.Main.main(Main.java:29)
    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:266)
    at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:449)
    at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:259)
    at com.sun.enterprise.appclient.Main.main(Main.java:200)
    Please help me, I'm trying to solve it all day long...

    the issue is right in the exception trace. obviously, your client code does not have the "org.postgresql.ds.PGSimpleDataSource" class in its classpath.
    note, generally DataSources are not something you would access from a remote client.
    Edited by: jtahlborn on Oct 28, 2008 4:18 PM

  • Help!! Can not find ejb from servlet!!!

    I have tried several days...here is my code to look up ejb..
    Context context = new InitialContext();
    Object ref = context.lookup("CustomerFacade");
    //Object ref = context.lookup("CustomerFacade");
    facadeHome = (CustomerFacadeHome) PortableRemoteObject.narrow(ref, CustomerFacadeHome.class);
    facade = facadeHome.create();
    do I need a orion-ejb-jar.xml? oc4j will generate it, right?
    Do I need a ejb-ref tag in the web.xml file? I've tried to use JDev to develop an example..the file it generates doesn't have ejb-ref tag at all..however..it works...
    the problem is that I want to port an app from JBoss to OC4J....so I cannot use JDev to develop from scratch...
    Please help me~~~I am stuck for several days...

    Next step it to restore to factory defaults in case there is some corruption which is now in the backup. If that does not work then you may have a hardware problem.

  • Can't find Thunderbird from application

    Hi,
    I am using Gnome 3 as my desktop.
    I installed Thunderbird through pacman, but after the installation finished , I can't find it in Activities -> Application, how can I add it to Application ?
    Thanks!

    bws wrote:Did you restart gnome shell after the installation?
    I'm sorry, this is a little off topic, but... Does GNOME Shell really need to be restarted in order to "see" new applications? It's 2012!

  • How to run application client of an EJB application?

    Hi,
    My EJB application is deployed on websphere. I have written a small java client program to interact with an EJB which is working fine if I compile and run it in websphere studio environment.
    However I am getting runtime exception when I tried to run it at command line.
    RemoteConn.java
    import java.util.Hashtable;
    import com.deque.HelloJavaHome;
    import com.deque.HelloJava;
    import javax.naming.InitialContext;
    import javax.naming.Context;
    import javax.ejb.EJBHome;
    import javax.ejb.EJBObject;
    public class RemoteConn {
    public static void main(String[] ar) throws Exception{
    String name="Paruchuri!!";
    String greeting = "";
    try{
    Hashtable env = new Hashtable();
    //env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.ws.naming.util.WsnInitCtxFactory");
    env.put(Context.PROVIDER_URL, "iiop://localhost:2809");
    InitialContext initContext = new InitialContext(env);
    Object obj = initContext.lookup("ejb/HelloJavaHome");
    HelloJavaHome home = (HelloJavaHome) javax.rmi.PortableRemoteObject.narrow(obj, HelloJavaHome.class);
    HelloJava remote = home.create();
    greeting = remote.getGreeting(name);
    catch(Exception e){
    e.printStackTrace();
    System.out.println("Greeting::"+ greeting);
    I have set the application ejb client jar in the class path of client program.
    The exception I am getting at runtime is
    Exception in thread "main" java.lang.NoClassDefFoundError: com.ibm.CORBA.iiop.GlobalORBFactory
    at com.ibm.ejs.oa.EJSORBImpl.class$(EJSORBImpl.java:44)
    at com.ibm.ejs.oa.EJSORBImpl.initializeORB(EJSORBImpl.java:195)
    at com.ibm.ejs.oa.EJSClientORBImpl.(EJSClientORBImpl.java:93)
    at com.ibm.ejs.oa.EJSClientORBImpl.(EJSClientORBImpl.java:65)
    at com.ibm.ejs.oa.EJSORB.init(EJSORB.java:385)
    at com.ibm.ws.naming.util.Helpers.getOrb(Helpers.java:284)
    at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:369)
    at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:112)
    at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:422)
    at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:143)
    at javax.naming.InitialContext.lookup(InitialContext.java:347)
    at RemoteConn.main(RemoteConn.java:38)
    Initially I thought I shuold set some jar file of websphere in the classpath of client. But I did not find such a jar containing the above class in websphere studio.
    Basically the error is generated at the below statement at runtime.
    Object obj = initContext.lookup("ejb/HelloJavaHome");
    The only difference I discovered was that the client application has a descriptor file (application-client.xml ) available to it when it ran in websphere studio,. I guess the same META-INF should be provided to client when it runs at command line.
    Right now I am not using any client descriptor file to run the client program. If the above error is due to not supplying META-INF to the client application, how should I make this folder available to client at runtime?
    I greatly appreciate if I could get help ASAP.
    Thanks

    Hey got what is going on. In order to invoke EJB, deployed on WebSpehre App Server, from application client we need to install either WebSphere Application Pluggable Client or WebSphere Thin client on the workstation. Pluggable client is a wrapper to SUN JRE where as Thin Client uses IBM JRE.

  • EJB Application Client clarification

    Hi EJB Guru,
    I would like some clarification on accessing Remote/Local Session Bean using an Application Client. In other word,
    there appears to be more than one approach to the same Session bean. Let's start by declaring the Converter EJB:
    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);
    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);
    }I have two method to accessing this bean.
    ( i ) Lookup JNDI using the following set of code:
    package converter.client;
    import converter.ejb.Converter;
    import java.math.BigDecimal;
    import javax.ejb.EJB;
    import javax.naming.InitialContext;
    import javax.naming.Context;
    import javax.naming.NamingException;
    public class ConverterClient {
        public static void main(String[] args) {
            try {
                InitialContext ctx = new InitialContext();
                ConverterRemote jndiconverter = (ConverterRemote) ctx.lookup("converter.ejb.ConverterRemote");
                BigDecimal param = new BigDecimal("100.00");
                BigDecimal yenAmount = jndiconverter.dollarToYen(param);
                System.out.println("$" + param + " is " + yenAmount + " Yen.");
                BigDecimal euroAmount = jndiconverter.yenToEuro(yenAmount);
                System.out.println(yenAmount + " Yen is " + euroAmount + " Euro.");
                System.exit(0);
            } catch (javax.naming.NamingException ne) {
                System.err.println("Caught an unexpected exception!");
                ex.printStackTrace();
    }( ii ) Application Client lookup?
    package converter.client;
    import converter.ejb.Converter;
    import java.math.BigDecimal;
    import javax.ejb.EJB;
    public class ConverterClient {
        @EJB
        private static Converter converter;
        /** Creates a new instance of Client */
        public ConverterClient(String[] args) {
        public static void main(String[] args) {
            ConverterClient client = new ConverterClient(args);
            client.doConversion();
        public void doConversion() {
            try {
                BigDecimal param = new BigDecimal("100.00");
                BigDecimal yenAmount = converter.dollarToYen(param);
                System.out.println("$" + param + " is " + yenAmount + " Yen.");
                BigDecimal euroAmount = converter.yenToEuro(yenAmount);
                System.out.println(yenAmount + " Yen is " + euroAmount + " Euro.");
                System.exit(0);
            } catch (Exception ex) {
                System.err.println("Caught an unexpected exception!");
                ex.printStackTrace();
    }It is the first time I come a cross method ( ii ) and could not get it to work properly. The error message
    received were:
    SJSAS server side
    **RemoteBusinessJndiName: converter.ejb.Converter; remoteBusIntf: converter.ejb.Converter
    LDR5010: All ejb(s) of [converter] loaded successfully!
    Registering ad hoc servlet: WebPathPath: context root = "/converter", path = "/converter-app-client'
    Java Web Start services started for application com.sun.enterprise.appclient.jws.ApplicationContentOrigin@c91c07
    registration name=converter
        [email protected]3900 registration name=converter, context
    root=/converter/converter-app-client, module name=
    , parent=converter
    WEB0100: Loading web module [converter:converter-war.war] in virtual server [server] at [/converter]
    Class [ Lconverter/ejb/Converter; ] not found. Error while loading [ class converter.client.ConverterClient ]
    Error in annotation processing: java.lang.NoClassDefFoundError: Lconverter/ejb/Converter;
    deployed with moduleid = converter-app-client
    Converter-app-client side
    Caught an unexpected exception!
    java.lang.NullPointerException
            at converter.client.ConverterClient.doConversion(ConverterClient.java:59)
            at converter.client.ConverterClient.main(ConverterClient.java:53)Here is the JNDI listing in ASADMIN:
    C:\>asadmin
    Use "exit" to exit and "help" for online help.
    asadmin> list-jndi-entries
    Jndi Entries for server within root context:
    converter.ejb.Converter: javax.naming.Reference
    converter.ejb.Converter#converter.ejb.Converter: javax.naming.Reference
    jbi: com.sun.enterprise.naming.TransientContext
    jdbc: com.sun.enterprise.naming.TransientContext
    UserTransaction: com.sun.enterprise.distributedtx.UserTransactionImpl
    ejb: com.sun.enterprise.naming.TransientContext
    converter.ejb.Converter__3_x_Internal_RemoteBusinessHome__: javax.naming.Reference
    Command list-jndi-entries executed successfully.
    asadmin>My questions are:
    ( a ) Why does the error occur?
    ( b ) what is the architecture difference in accessing the same bean? Does JNDI lookup allows one to access EJB from remote host as opposed the method ( ii ) which is only restricted to local access on the same JVM/Container?
    ( c ) What are the pros & cons between the two?
    I am using Application Client to lookup these Session Beans on Netbeans 5.5, SJSAS 9.0, SDK 1.5.0_11 on Windows XP platform.
    Any guideance/advice would be very much appreciated.
    Thanks alot,
    Henry

    Hi, may be you can help me with a similar problem that I have, I transcript the post in the netbeans forum, I really hope that you or someone can help me with this. Thanks in advance!
    I hope that somebody can help me solving this issue.
    Environment:
    NetBeans 6.0 beta1 + glassfish b58g fresh installed
    Windows XP
    Make a new enterprise application with application client. Run the empty Main and it runs ok.
    Now create a Stateless Session Bean with hello method.
    In the Application Client Main insert a reference to the EJB using the wizard. (@EJB etc...)
    invoke the hello method from the main().
    right click on libraries from application client and add the application-ejb project
    Deploy and it deploys ok, but when you run it throws an exception:
    client:
    java.lang.NullPointerException
    server:
    Error in annotation processing: java.lang.NoClassDefFoundError: Lorg/arautos/revista/sacrae/server/business/SACRAEFacadeRemote;
    java.io.FileNotFoundException: C:\opt\glassfish-v2-b58g\domains\domain1\applications\j2ee-modules\SACRAE-app-client\SACRAE-ejb.jar (El sistema no puede hallar el archivo especificado)
    Remember we added the project to the appclient libraries. If I place the missing file in the applications directory of glassfish it wont work, because when you run it, deploying on the server will erase it again. But, if you copy the jar file in the directory and open it with 7zip or any other application that can keep the file open, when you run it again it will work (because the server is not able to delete the file).
    Although this is a workaround, there should be something I am doing wrong to cause this behavior, now when I try to use Java Web Start to execute the client it fails (surprisingly) with this exception:
    java.lang.reflect.InvocationTargetException
    Caused by: java.lang.NoClassDefFoundError: org/arautos/revista/sacrae/server/business/SACRAEFacadeRemote
    at org.arautos.revista.sacrae.client.desktop.Main.main(Main.java:30)
    ... 21 more
    And I don't know where in the domain1 directory place the jar, worse, I don't know how to solve the issue with the ejb-jar in the first place, does anybody has an idea, link, same problem? I have googled, netbeans-ed and java.net-ed a lot but didn't find anything :(
    Thanks in advance for any help.
    Best Regards.

  • In a single program how to lookup different EJB from different application

    Hi,
    I have deployed two applications app1 and app2 on oc4j.
    There is a stateless session bean in a1 called ejb1.
    And there is also a stateless session bean ejb2 in app2.
    I write a test jsp in app1 to lookup ejb1 and ejb2 as an application client. So I need to create an application-client.xml for it.
    <?xml version="1.0"?>
    <!DOCTYPE application-client PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application Client 1.2//EN" "http://java.sun.com/j2ee/dtds/application-client_1_2.dtd">
    <application-client>
    <display-name>ejbs</display-name>
    <ejb-ref>
    <ejb-ref-name>ejb1</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>class_of_ejb1Home</home>
    <remote>class_of_ejb1</remote>
    </ejb-ref>
    <ejb-ref>
    <ejb-ref-name>ejb2</ejb-ref-name>
    <ejb-ref-type>ejb2</ejb-ref-type>
    <home>class_of_ejb2Home</home>
    <remote>class_of_ejb2</remote>
    </ejb-ref>
    </application-client>
    However, When I run the test.jsp, It will report following error:
    javax.naming.NamingException: Error reading application-client descriptor: No location specified and no suitable instance of the type 'class_of_ejb2' found for the ejb-ref ejb2
    In fact, if I only lookup any of the ejb and the application-client.xml just specify only the according ejb-ref, everything is alright.
    But how to construct the application-client.xml so that it can suitable for 2 different ejb in different application? Do I miss something in doing it?
    Kindly advice!
    Queeny Tang

    Hi Debabrata Panda,
    I did add parent in web.xml, but it still encounter
    "Error reading application-client descriptor: No location specified and no suitable instance of the type 'class_of_ejb2' found for the ejb-ref ejb2"
    In my program, a jsp in app2 will lookup ejb1 of app1. In the same way, a jsp in app1 will lookup ejb2 of app2.
    if I declare in server.xml
    <application name="app2" path="../applications/app2.ear" parent="app1" auto-start="true" />
    <application name="app1" path="../applications/app1.ear" parent="app2" auto-start="true" />
    That will cause error reading application-client.xml for all
    ejbs.
    How to solve this.
    Thanks in advance!
    Yours Queeny

  • Env-entry-mapping in orion-application-client not available in JNDI lookup

    I have an application client module in my EAR file that I've configured to auto-start.
    It has a few env-entry defined in it's application-client.xml.
    When I deploy the EAR file to OC4J 10.1.3, the application client module gets started and can access these env-entry properties from its JNDIContext.
    Now, comes the problem. During the deployment process, I edit the Deployment Plan, and change the env-entry property values, and then deploy the application.
    However, the application client module still gets the original values when it does the JNDI lookups of those env-entry names.
    I have checked to see that OC4J creates an orion-application-client.xml during deployment and it shows the env-entry-mapping elements with the updated values.
    Why is the JNDI lookup returning the values from application-client.xml and not the overriden values set in orion-application-client.xml?
    I have tried this on OC4J 10.1.3, as well as 10.1.3.1.0 - got same behavior.
    Is this a bug in OC4J? This seems to work fine with ejb modules, but not application client modules.
    Thanks,
    Kalpak

    Avi!
    Of course, I had tried it before I wrote the question. I put the modified xml file into the application area. After that AS restarts OC4J instance. And then I find my xml without any changes I made! I tried to do the same thing from the AS console. The same!
    Leonid

  • EJB-JSF Application : Data does not persist to the database

    Hi,
    I am developing a JSF - EJB application and the data that I send from JSP Page through JSF Managed Bean --> Session Bean --> Java Persistence does not persist in database.
    Here is my scenario ( Iam using JDeveloper IDE to create this application) -
    SCENARIO START
    The scenario consists of two web pages, one enlisting all the users stored in the database, the other contains a form for adding a user
    1.) INDEX.JSP
    2.) ADDUSER.JSP
    Step 1: Create the USERS Table in database
    CREATE TABLE users
    user_id serial,
    username varchar(255) NOT NULL,
    first_name varchar(255),
    last_name varchar(255),
    password char(64) NOT NULL,
    CONSTRAINT pk_users PRIMARY KEY (user_id)
    Step 2: Add Database Connection To JDeveloper
    Go to Database Connection Navigator and create a New Database Connection using the Wizard
    Step 3: Create a New Application in JDeveloper and select JSF, EJB from Application Template
    Step 4: ENTITY BEAN - In the EJB Node Right Click and Select EJB � New Entites from Table (JPA/EJB3.0)
    Use The Wizard and create Entity Bean from Users Table which creates an Entity Bea POJO file as follows �
    User.java -
    package lux.domain;
    import java.io.Serializable;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.NamedQuery;
    import javax.persistence.SequenceGenerator;
    import javax.persistence.Table;
    @Entity
    @NamedQuery(name = "User.findAll", query = "select o from User o")
    @Table(name = "USERS")
    public class User implements Serializable {
    @Column(name="FIRST_NAME")
    private String firstName;
    @Column(name="LAST_NAME")
    private String lastName;
    @Column(nullable = false)
    private String password;
    @Column(nullable = false)
    private String username;
    @Id
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="users_seq_generator")
    @SequenceGenerator(name="users_seq_generator", sequenceName="users_user_id_seq")
    @Column(name="USER_ID", nullable = false)
    private Long userId;
    public User() {
    public String getFirstName() {
    return firstName;
    public void setFirstName(String firstName) {
    this.firstName = firstName;
    public String getLastName() {
    return lastName;
    public void setLastName(String lastName) {
    this.lastName = lastName;
    public String getPassword() {
    return password;
    public void setPassword(String password) {
    this.password = password;
    public String getUsername() {
    return username;
    public void setUsername(String username) {
    this.username = username;
    public Long getUserId() {
    return userId;
    public void setUserId(Long userId) {
    this.userId = userId;
    Step 5: STATELESS SESSION BEAN - In the EJB Node Right Click and Select EJB � New Entites from Table (JPA/EJB3.0)
    Again Right Click on Model and create Session Bean from Wizard which creates two files �
    UserDAOBean.java � Stateless Session Bean
    UserDAO.java � Local Interface
    package lux.facade;
    import java.security.MessageDigest;
    import java.security.NoSuchAlgorithmException;
    import java.util.List;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    import javax.persistence.Query;
    import lux.domain.User;
    @Stateless(name="UserDAO")
    public class UserDAOBean implements UserDAO {
    @PersistenceContext(unitName="Model")
    private EntityManager em;
    public UserDAOBean() {
    public User getUser(int UserId) {
    User u = new User();
    u = em.find(User.class, UserId);
    return u;
    public List<User> getAllUsers() {
    Query q = em.createQuery("SELECT u FROM User u");
    List<User> users = q.getResultList();
    return users;
    public void createUser(User u) {
    String hashedPw = hashPassword(u.getPassword());
    u.setPassword(hashedPw);
    em.persist(u);
    public void updateUser(User u) {
    String hashedPw = hashPassword(u.getPassword());
    u.setPassword(hashedPw);
    em.merge(u);
    public void deleteUser(User u) {
    em.remove(u);
    private String hashPassword(String password) {
    StringBuilder sb = new StringBuilder();
    try {
    MessageDigest messageDigest = MessageDigest.getInstance("SHA");
    byte[] bs;
    bs = messageDigest.digest(password.getBytes());
    for (int i = 0; i < bs.length; i++) {
    String hexVal = Integer.toHexString(0xFF & bs);
    if (hexVal.length() == 1) {
    sb.append("0");
    sb.append(hexVal);
    } catch (NoSuchAlgorithmException ex) {
    Logger.getLogger(UserDAOBean.class.getName()).log(Level.SEVERE, null, ex);
    return sb.toString();
    Step 6: Create a Deployment file in the Model and Deploy this to a JAR file
    Step 7: Now Right Click on View/Controller Node and create a Java File �
    UserController.java -
    package lux.controllers;
    import javax.ejb.EJB;
    import javax.faces.model.DataModel;
    import javax.faces.model.ListDataModel;
    import lux.domain.User;
    import lux.facade.UserDAO;
    public class UserController {
    @EJB UserDAO userDao;
    private User user;
    private DataModel model;
    public String createUser() {
    this.user = new User();
    return "create_new_user";
    public String saveUser() {
    String r = "success";
    try {
    userDao.createUser(user);
    } catch (Exception e) {
    e.printStackTrace();
    r = "failed";
    return r;
    public DataModel getUsers() {
    model = new ListDataModel(userDao.getAllUsers());
    return model;
    public User getUser() {
    return user;
    public void setUser(User user) {
    this.user = user;
    Step 8: Configure page flow in faces-config.xml
    1. Create the JSP file adduser.jsp by right-clicking View-Controller
    node and selecting New > JSP. Use the wizard to create JSF � JSP Page, fill in
    File Name adduser.jsp, click Finish. -
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
    <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>New user</title>
    </head>
    <body>
    <f:view>
    <h:form>
    <h:messages/>
    <h:panelGrid columns="2">
    <h:outputText value="Username"/>
    <h:inputText
    id="Username"
    value="#{user.user.username}"
    required="true"/>
    <h:outputText value="First name"/>
    <h:inputText
    id="FirstName"
    value="#{user.user.firstName}" />
    <h:outputText value="Last name"/>
    <h:inputText
    id="LastName"
    value="#{user.user.lastName}" />
    <h:outputText value="Password" />
    <h:inputSecret
    id="Password"
    value="#{user.user.password}"
    required="true" />
    <h:panelGroup/>
    <h:commandButton
    action="#{user.saveUser}"
    value="Save"/>
    </h:panelGrid>
    </h:form>
    </f:view>
    </body>
    </html>
    2. Repeat the previous step for another JSP file failed.jsp.
    3. On failed.jsp add the string
    Save failed
    Next we configure the page flow.
    1. Open faces-config.xml.
    2. Create index.jsp -
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
    <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>User Listing</title>
    </head>
    <body>
    <f:view>
    <h:form>
    <h:outputText value="User Listing"/>
    <h:commandLink action="#{user.createUser}" value="Create a user"/>
    <h:dataTable value="#{user.user}"
    var="dataTableItem" border="1" cellpadding="2" cellspacing="2">
    <h:column>
    <f:facet name="header">
    <h:outputText value="Username"/>
    </f:facet>
    <h:outputText value="#{dataTableItem.username}" />
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="First name"/>
    </f:facet>
    <h:outputText value="#{dataTableItem.firstName}" />
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="Last name"/>
    </f:facet>
    <h:outputText value="#{dataTableItem.lastName}" />
    </h:column>
    </h:dataTable>
    </h:form>
    </f:view>
    </body>
    </html>
    3. Drag an arrow from index.jsp to adduser.jsp and replace the arrow�s label to create_new_user.
    4. Repeat the previous step for failed, by dragging and arrow from adduser.jsp to failed.jsp renaming the label to f
    ailed
    5. Finally repeat the step for adduser.jsp, by dragging from adduser.jsp to index.jsp renaming the label to success.
    This creates the following faces-config.xml file �
    <?xml version='1.0' encoding='UTF-8'?>
    <faces-config>
    <managed-bean>
    <managed-bean-name>user</managed-bean-name>
    <managed-bean-class>lux.controllers.UserController</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    <managed-property>
    <property-name>username</property-name>
    <value>#{username}</value>
    </managed-property>
    <managed-property>
    <property-name>firstName</property-name>
    <value>#{firstName}</value>
    </managed-property>
    <managed-property>
    <property-name>lastName</property-name>
    <value>#{lastName}</value>
    </managed-property>
    <managed-property>
    <property-name>password</property-name>
    <value>#{password}</value>
    </managed-property>
    </managed-bean>
    <navigation-rule>
    <from-view-id>/index.jsp</from-view-id>
    <navigation-case>
    <from-outcome>create_new_user</from-outcome>
    <to-view-id>/adduser.jsp</to-view-id>
    </navigation-case>
    </navigation-rule>
    <navigation-rule>
    <from-view-id>/adduser.jsp</from-view-id>
    <navigation-case>
    <from-outcome>failed</from-outcome>
    <to-view-id>/failed.jsp</to-view-id>
    </navigation-case>
    <navigation-case>
    <from-outcome>success</from-outcome>
    <to-view-id>/index.jsp</to-view-id>
    </navigation-case>
    </navigation-rule>
    </faces-config>
    Step 9: Create a Deployment file in the View-Controller and Deploy this to a WAR file
    Step 10: Create a Deployment file in the View-Controller and create an EAR file and add Model�s JAR and View-Controller�s
    WAR files to it.
    Step 11: Run the JSP Files
    SCENARIO END
    Now, When I execute Index.jsp, it does not list values from database and when I click on Create User link, it takes me to adduser.jsp page. When I fill values in this page and click Save button, it takes me to Save Failed page and data does not persist to the database.
    WHAT IS WRONG OUT HERE ???

    If you set a breakpoint in your createUser method - does this code get executed?
    We have a couple of tutorials that might show you how to do this.
    EJB/JSF with ADF-binding tutorial:
    http://www.oracle.com/technology/obe/obe1013jdev/10131/ejb_and_jpa/master-detail_pagewith_ejb.htm
    EJB/JSF without ADF binding:
    http://www.oracle.com/technology/obe/JavaEE_tutorial_10131/index.htm

  • Call an Application Module deployed as EJB into JServer from a client

    Hi all,
    I've successfully deployed a BC4J Application Module as EJB Session Bean into Oracle8i 8.1.6.
    The deployment descriptor (file LoginModule.dd) starts with the foolowing lines:
    Session Bean ricercalista.server.ejb.LoginModuleServerEJB
    BeanHomeName = "/test/omero/ejb/ricercalista.LoginModule";
    HomeInterfaceClassName = ricercalista.common.ejb.LoginModuleHome;
    RemoteInterfaceClassName = ricercalista.common.ejb.RemoteLoginModule;
    The client code that calls the EJB is:
    import oracle.jbo.*;
    import java.util.Hashtable;
    import javax.naming.*;
    import oracle.jbo.JboContext;
    import ricercalista.common.*;
    import ricercalista.common.ejb.*;
    import ricercalista.UserProfile;
    public class ProvaEJBLogin {
    public static void main(String[] args) throws Exception {
    final String AMDefName = "ricercalista.LoginModule";
    final String Username = "omero";
    final String Password = "omero";
    final String DBUrl = "jdbc:oracle:thin:omero/omero@localhost:1521:OMERO";
    try {
    Hashtable env = new Hashtable(10);
    env.put(Context.INITIAL_CONTEXT_FACTORY, JboContext.JBO_CONTEXT_FACTORY);
    env.put(JboContext.DEPLOY_PLATFORM, JboContext.PLATFORM_ORACLE8I);
    env.put(JboContext.HOST_NAME, "bacco08.csr.unibo.it");
    env.put(JboContext.CONNECTION_PORT, "2481");
    env.put(JboContext.ORACLE_SID, "OMERO");
    env.put(JboContext.APPLICATION_PATH, "test/omero/ejb");
    env.put(JboContext.SECURITY_PRINCIPAL, Username);
    env.put(JboContext.SECURITY_CREDENTIALS, Password);
    Context ic = new InitialContext(env);
    LoginModuleHome home = (LoginModuleHome) ic.lookup(AMDefName);
    LoginModule myejb = (LoginModule) home.create();
    myejb.getTransaction().connect(DBUrl, Username, Password);
    myejb.setUser("turronic", "chris");
    System.out.println((String) myejb.getCognome());
    System.out.println((String) myejb.getNome());
    UserProfile up = myejb.getUserProfile();
    for (int i = 0; i < up.size(); i++) {
    System.out.println("dominio = " + up.getCodeDomain(i) + " grado = " + up.getInterestDegree(i));
    myejb.getTransaction().disconnect();
    myejb.remove();
    catch (NamingException ne) {
    System.out.println("Unable to find application " + AMDefName);
    ne.printStackTrace();
    catch (ApplicationModuleCreateException e) {
    System.out.println("Unable to create application module " + AMDefName);
    e.printStackTrace();
    When I run this client, I find the following error:
    "D:\Program Files\Oracle\JDeveloper 3.1.1.2\java1.2\jre\bin\javaw.exe" -classpath "D:\Program Files\Oracle\JDeveloper 3.1.1.2\myclasses;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jbojdbcpatch.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jboorasql.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jbodatum12.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jdev-rt.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\jdbc\lib\oracle8.1.6\classes12.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\connectionmanager.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jbomt.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jboremote.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jndi.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\xmlparserv2.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\javax_ejb.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jboremoteejb.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\aurora\lib\aurora_client.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\aurora\lib\vbjorb.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\aurora\lib\vbjapp.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jbohtml.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jboo8i.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\jswdk-1.0.1\lib\servlet.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\samples\borland\samples\bdk\Test.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\samples\borland\samples\bdk\Jelly.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\samples\borland\samples\bdk\Juggler.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\samples\borland\samples\bdk\Misc.jar;D:\Program Files \Oracle\JDeveloper 3.1.1.2\samples\borland\samples\bdk\Molecule.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\samples\borland\samples\bdk\Buttons.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\classgen.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jboejb.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\aurora\lib\aurora_client.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\aurora\lib\vbjorb.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\aurora\lib\vbjapp.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\javax_ejb.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\aurora\lib\vbjtools.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\aurora\lib\vbj30ssl.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\aurora\lib\aurora.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\sqlj\lib\translator.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jboremote.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jbo8iclient.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\aurora\lib\aurora_client.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\aurora\lib\vbjorb.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\aurora\lib\vbjapp.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jndi.jar;D:\Program Files\Oracle\JDeveloper 3.1.1.2\lib\jbodatum12.zip;D:\Program Files\Oracle\JDeveloper 3.1.1.2\java1.2\jre\lib\rt.jar" ricercalista.ProvaEJBLogin
    Diagnostics: Silencing all diagnostic output (use -Djbo.debugoutput=console to see it)
    Unable to find application ricercalista.LoginModule
    [Root exception is java.lang.ClassNotFoundException: ricercalista.common.ejb.LoginModuleHomeHelper]javax.naming.NamingException: Unknown reasons
    void oracle.jbo.client.remote.corba.aurora.AuroraApplicationModuleHome.initRemoteHome()
    void oracle.jbo.client.remote.corba.aurora.AuroraApplicationModuleHome.<init>(oracle.jbo.JboContext, java.lang.String)
    oracle.jbo.common.JboHome oracle.jbo.client.remote.corba.aurora.AuroraInitialContext.createJboHome(java.lang.String)
    java.lang.Object oracle.jbo.common.JboInitialContext.lookup(java.lang.String)
    java.lang.Object javax.naming.InitialContext.lookup(java.lang.String)
    void ricercalista.ProvaEJBLogin.main(java.lang.String[])
    What's wrong in my code? Are the Context Properties set correctly? The test on this Application Module works fine. So what's the problem?
    I need your help!
    Tnx!
    null

    I've added libraries LoginModuleEJBClient.jar and EJBGenerated.jar to the client project.
    The error isn't the same, but the following:
    Diagnostics: Silencing all diagnostic output (use -Djbo.debugoutput=console to see it)
    Unable to find application ricercalista.LoginModule
    javax.naming.NamingException. Root exception is java.lang.ClassCastException
    void oracle.jbo.client.remote.corba.aurora.AuroraApplicationModuleHome.initRemoteHome()
    void oracle.jbo.client.remote.corba.aurora.AuroraApplicationModuleHome.<init>(oracle.jbo.JboContext, java.lang.String)
    oracle.jbo.common.JboHome oracle.jbo.client.remote.corba.aurora.AuroraInitialContext.createJboHome(java.lang.String)
    java.lang.Object oracle.jbo.common.JboInitialContext.lookup(java.lang.String)
    java.lang.Object javax.naming.InitialContext.lookup(java.lang.String)
    void client.LoginClient.<init>()
    void client.LoginClient.main(java.lang.String[])
    Why is there a ClassCastException?
    Tnx in advance for your help.

  • How to call ejb from a Swing gui application client?

    Hi Everyone,
    I am new to EJB and I have question for calling an ejb from a Swing GUI application client. Can anyone give me an example of how my Swing GUI can call an EJB from a SUN ONE Application Server. If anyone can give me some insight, I appreciate it.

    I have looked up various sources and just can't get it to work. I know I have to use the lookup() method, but I have also seen lookups using IIOP://servename......
    Context ctx = getInitialContext();
    DemoHome dhome = (DemoHome)ctx.lookup("demo.DemoHome");
    or
    Context ctx = getInitialContext();
    DemoHome dhome = (DemoHome)ctx.lookup(java:comp/......)
    so can anyone tell what is the difference between using iiop://servername..... as the lookup string and java:comp/......
    and if using java:comp/ what does this mean? Does it mean that lookup() method is looking for the ejb somewhere in this directory. I would really appreciate if someone can give an example of a Swing GUI calling a ejb from an application server and how the code is actually doing the lookup in and what are each steps it goes through.
    Thanks

Maybe you are looking for

  • Has anyone tried to extend Spatial with a 3D primitive?

    Has anyone tried to extend Spatial with a 3D primitive that for example can model buildings and tunnels? I am trying to add the polyhedron primitive next to the existing point, line, polygon model. I just want to hear some tips or ideas...

  • Custim repeats calender apps for the ipad

    I do not want any that are very expenstive. the default calender app is nice but not a lot of ways to customize it. the calender just needs the times and has to have custom repeat options. is calpad worth the price? i tried the lite version and filli

  • My iphone just died and i'm trying to at least get my calender on my computer how do i do that

    my iphone just died went all black and i'm wondering 1- how can i fix this and also how can i find all my info that i on my iphone to my computer???

  • EWA ABAP stack from solution manger

    Dear all. We are configuring our solution manager in order to obtain EWA ABAP stack of all our satellite systems. Our solution manager is 7.0 EHP1. We have created our satellite system in SMSY and generated all required RFC. We have created a solutio

  • Where to store employee photos after upload to R3 and ESS?

    Hello everyone! I'm looking for documentation related with upload employees photos in order to decide where is the 'right' server type to store our photos concearning our reality. We have many companies around the world in diferent sites. After uploa