Problem accessing a session bean running on a different port

Hi,
I am using weblogic7.0 as the application server. I craeted two EJB's and
deployed them in two ports, port 7001 and 7378. I can access the beans when I
deploy them in the same port. But, I am having problem when EJB1 'server1' accesses
EJB2 'server2' deployed in port 7378. Below is the code I am using to lookup the
bean.
Properties prop = new Properties();
prop.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
prop.put(Context.PROVIDER_URL, "t3://localhost:7378");
Context ctx = new InitialContext(prop);
Object objref = ctx.lookup("java:comp/env/server2");
System.out.println("Inside the Object method "+objref);
iHome = (server2.InsertHome) objref;
System.out.println("Inside the iHome method "+iHome);
mInsert=iHome.create();
I am getting the following exception when I run the client. Can any one plaes
help me with the problem I am facing.
Thanks,
Ramya.
java.rmi.RemoteException: EJB Exception: ; nested exception is:
java.lang.NullPointerException
Start server side stack trace:
java.rmi.RemoteException: EJB Exception: ; nested exception is:
java.lang.NullPointerException
java.lang.NullPointerException
at server1.ConnectBean.insertName(ConnectBean.java:133)
at server1.ConnectBean_wtb7ta_EOImpl.insertName(ConnectBean_wtb7ta_EOIm
pl.java:45)
at server1.ConnectBean_wtb7ta_EOImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:362)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServer
Ref.java:114)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:313)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServi
ceManager.java:785)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.ja
va:308)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteReques
t.java:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
End server side stack trace
; nested exception is:
java.lang.NullPointerException:
Start server side stack trace:
java.lang.NullPointerException
at server1.ConnectBean.insertName(ConnectBean.java:133)
at server1.ConnectBean_wtb7ta_EOImpl.insertName(ConnectBean_wtb7ta_EOIm
pl.java:45)
at server1.ConnectBean_wtb7ta_EOImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:362)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServer
Ref.java:114)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:313)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServi
ceManager.java:785)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.ja
va:308)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteReques
t.java:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
End server side stack trace
at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutbound
Request.java:109)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemote
Ref.java:262)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemote
Ref.java:229)
at server1.ConnectBean_wtb7ta_EOImpl_WLStub.insertName(Unknown Source)
at server1.Client.example(Client.java:156)
at server1.Client.main(Client.java:168)
Caused by: java.lang.NullPointerException:
Start server side stack trace:
java.lang.NullPointerException
at server1.ConnectBean.insertName(ConnectBean.java:133)
at server1.ConnectBean_wtb7ta_EOImpl.insertName(ConnectBean_wtb7ta_EOIm
pl.java:45)
at server1.ConnectBean_wtb7ta_EOImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:362)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServer
Ref.java:114)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:313)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServi
ceManager.java:785)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.ja
va:308)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteReques
t.java:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
End server side stack trace

So it looks like mInsert is null causing the NPE. I think you'll have
to debug this one.
-- Rob
Ramya wrote:
Hi Rob,
Thanks for your relpy. Below is the method which calls methods from the EJB2.
public void insertName(String name) throws Exception {
Connection con = null;
String name2="raj";
int num=30;
PreparedStatement ps = null;
CallableStatement cs=null;
String fName=null;
try {
System.out.println("In the insertName() before calling this.lookup()");
this.lookUp();
System.out.println("In the insertName() after calling this.lookup()");
con=mInsert.getConnection();
System.out.println("Inside the InsertName() in connectbean the value
of connect is"+con);
ps = con.prepareStatement("Insert into My_info values (?,?,?) ");
ps.setString(1, name);
ps.setString(2, "RamyaRAJ");
ps.setInt(3,30);
if (!(ps.executeUpdate() > 0)) {
String error = "insertName: MyInfoBean (" + fName + ") not updated";
throw new NoSuchEntityException (error);
else{
System.out.println("After calling execute upadte");
} catch(Exception e) {
System.out.println("There is an SQL insert exception in insertName()
method");
e.printStackTrace();
throw new EJBException (e);
} finally {
mInsert.cleanup(con, ps);//LINE NO 133
Line 133 (mInsert.cleanup(con, ps);) is the call to close up the SQL connection
that is from EJB2. mInsert is the member variable of the Remote class from EJB2.
Thanks,
Ramya.
Rob Woollen <[email protected]> wrote:
That looks like a NullPointerException in your code. You'd have to show
us line 133 of ConnectBean if you need help debugging it.
-- Rob
Ramya wrote:
Hi,
I am using weblogic7.0 as the application server. I craeted twoEJB's and
deployed them in two ports, port 7001 and 7378. I can access the beanswhen I
deploy them in the same port. But, I am having problem when EJB1 'server1'accesses
EJB2 'server2' deployed in port 7378. Below is the code I am usingto lookup the
bean.
Properties prop = new Properties();
prop.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
prop.put(Context.PROVIDER_URL, "t3://localhost:7378");
Context ctx = new InitialContext(prop);
Object objref = ctx.lookup("java:comp/env/server2");
System.out.println("Inside the Object method "+objref);
iHome = (server2.InsertHome) objref;
System.out.println("Inside the iHome method "+iHome);
mInsert=iHome.create();
I am getting the following exception when I run the client. Can anyone plaes
help me with the problem I am facing.
Thanks,
Ramya.
java.rmi.RemoteException: EJB Exception: ; nested exception is:
java.lang.NullPointerException
Start server side stack trace:
java.rmi.RemoteException: EJB Exception: ; nested exception is:
java.lang.NullPointerException
java.lang.NullPointerException
at server1.ConnectBean.insertName(ConnectBean.java:133)
at server1.ConnectBean_wtb7ta_EOImpl.insertName(ConnectBean_wtb7ta_EOIm
pl.java:45)
at server1.ConnectBean_wtb7ta_EOImpl_WLSkel.invoke(UnknownSource)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:362)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServer
Ref.java:114)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:313)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServi
ceManager.java:785)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.ja
va:308)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteReques
t.java:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
End server side stack trace
; nested exception is:
java.lang.NullPointerException:
Start server side stack trace:
java.lang.NullPointerException
at server1.ConnectBean.insertName(ConnectBean.java:133)
at server1.ConnectBean_wtb7ta_EOImpl.insertName(ConnectBean_wtb7ta_EOIm
pl.java:45)
at server1.ConnectBean_wtb7ta_EOImpl_WLSkel.invoke(UnknownSource)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:362)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServer
Ref.java:114)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:313)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServi
ceManager.java:785)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.ja
va:308)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteReques
t.java:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
End server side stack trace
at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutbound
Request.java:109)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemote
Ref.java:262)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemote
Ref.java:229)
at server1.ConnectBean_wtb7ta_EOImpl_WLStub.insertName(UnknownSource)
at server1.Client.example(Client.java:156)
at server1.Client.main(Client.java:168)
Caused by: java.lang.NullPointerException:
Start server side stack trace:
java.lang.NullPointerException
at server1.ConnectBean.insertName(ConnectBean.java:133)
at server1.ConnectBean_wtb7ta_EOImpl.insertName(ConnectBean_wtb7ta_EOIm
pl.java:45)
at server1.ConnectBean_wtb7ta_EOImpl_WLSkel.invoke(UnknownSource)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:362)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServer
Ref.java:114)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:313)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServi
ceManager.java:785)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.ja
va:308)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteReques
t.java:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
End server side stack trace

Similar Messages

  • Problem calling a session bean (EJB 3.0)

    Hello,
    I'm new to netbeans and J2EE. I'm using NetBeans 5.5 Beta 2 and sun application server 9 pe.
    I created a new enterprise application and i'm trying to access a Session Bean (Remote and Stateless)
    from the app-client (outside the main class).
    This is the loockup method that was generated by the IDE (Enterprise Resources > Call enterprise bean):
    private ejb.SessionBeanDoenteRemote lookupSessionBeanDoenteBean() {
    try {
    javax.naming.Context c = new javax.naming.InitialContext();
    return (ejb.SessionBeanDoenteRemote) c.lookup("java:comp/env/ejb/SessionBeanDoenteBean");
    catch(javax.naming.NamingException ne) {
    java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"exception caught" ,ne);
    throw new RuntimeException(ne);
    When I run the application and try to invoke the lookup method my application gets the following exception:
    SEVERE: exception caught
    javax.naming.NameNotFoundException: No object bound to name java:comp/env/ejb/Se
    ssionBeanDoenteBean
    at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.
    java:751)
    at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.j
    ava:156)
    at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:307
    at javax.naming.InitialContext.lookup(InitialContext.java:351)
    at intensivecare.entrada.JDialogEntrada.lookupSessionBeanDoenteBean(JDia
    logEntrada.java:219)
    at intensivecare.entrada.JDialogEntrada.buttonMenuGravarActionPerformed(
    JDialogEntrada.java:79)
    at intensivecare.JDialogWizzard$2.jButtonGravarActionPerformed(JDialogWi
    zzard.java:178)
    at componentes.JTaskPanelMenu$3.actionPerformed(JTaskPanelMenu.java:54)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:18
    49)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.jav
    a:2169)
    Please... can someone help me?

    The portable way to acquire the dependency is through java:comp/env or @EJB. Accessing the
    global namespace directly is not recommended. If you use an ejb-ref, you need to define it
    in the component environment within which you'll be looking up the dependency. So if you're
    looking it up from an Application Client, you'll need to define the ejb-ref in application-client.xml.
    Also, the ejb-ref-name is the portion of the string after java:comp/env. There is no automatic
    "ejb" appended to it. If you do ic.lookup("java:comp/env/foo"), your ejb-ref-name would be "foo".
    You can use @EJB but it can only be defined in certain managed classes such as the
    Application Client main class.
    You can find additional info in our EJB FAQ :
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • A simple problem with sateful Session beans

    Hi,
    I have a really novice problem with stateful session bean in Java EE 5.
    I have written a simple session bean which has a counter inside it and every time a client call this bean it must increment the count value and return it back.
    I have also created a simple servlet to call this session bean.
    Everything seemed fine I opened a firefox window and tried to load the page, the counter incremented from 1 to 3 for the 3 times that I reloaded the page then I opened an IE window (which I think is actually a new client) but the page counter started from 4 not 1 for the new client and it means that the new client has access to the old client session bean.
    Am I missing anything here???
    Isn�t it the way that a stateful session bean must react?
    This is my stateful session bean source.
    package test;
    import javax.ejb.Stateful;
    @Stateful
    public class SecondSessionBean implements SecondSessionRemote
    private int cnt;
    /** Creates a new instance of SecondSessionBean */
    public SecondSessionBean ()
    cnt=1;
    public int getCnt()
    return cnt++;
    And this is my simple client site servlet
    package rezaServlets;
    import java.io.*;
    import java.net.*;
    import javax.ejb.EJB;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import test.SecondSessionRemote;
    public class main extends HttpServlet
    @EJB
    private SecondSessionRemote secondSessionBean;
    protected void processRequest (HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    response.setContentType ("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter ();
    out.println("<html>");
    out.println("<head>");
    out.println("<title>Servlet main</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("<h1>Our count is " + Integer.toString (secondSessionBean.getCnt ()) + "</h1>");
    out.println("</body>");
    out.println("</html>");
    out.close ();
    protected void doGet (HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    processRequest (request, response);
    protected void doPost (HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    processRequest (request, response);
    }

    You are injecting a reference to a stateful session bean to an instance variable in the servlet. This bean instance is shared by all servlet request, and that's why you are seeing this odd behavior.
    You can use type-leve injection for the stateful bean, and then lookup the bean inside your request-processing method. You may also save this bean ref in HttpSession.
    @EJB(name="ejb/foo", beanName="SecondBean", beanInterface="com.foo.foo.SecondBeanRemote")
    public MyServlet extends HttpServlet {
    ic.lookup("java:comp/env/ejb/foo");
    }

  • Problem Calling Remote Session Bean Method

    Need help. I am trying to call a method in a remote stateless session bean in an EJB in my web application from a stateless session bean in a different EJB in the web application. I am getting a run-time error that says,
    "java.lang.NoClassDefFoundError: dtpitb.common.sb.reports.CommonReportsHome"
    ref = ctx.lookup( jndiName );
    // Cast to Local Home Interface using RMI-IIOP
    commonReportsHome = (CommonReportsHome)
    PortableRemoteObject.narrow(ref, CommonReportsHome.class);
    If while in a session bean of an EJB, I want to call a public method in the session bean of a totally different EJB, is there something in particular I am missing. I can make the call from the web application code. I can make a remote call from this session bean to itself in the exact same fashion. I just can't call a session bean in another EJB. All thoughts are welcome.
    Thanks,
    Pete

    Thanks for replying. That could very well be the case I suppose. I'm using JBuilder and WebLogic, and JBuilder pretty much does all of the deployment descriptor code for me. However, maybe this is something I need to incorporate manually.
    One EJB is in the same project as the web application code. The other EJB (common_ejb) is in another project. The calling session bean is in the project with the web app, and the remote session bean method that I'm targeting is in the common EJB session bean. Both EJBs are included in the web app's WEB-INF\lib dir and in the war file.
    So theoretically, this isn't an unconventional practice I assume?
    Thanks,
    Pete

  • Accessing Managed Session Bean in Servlet Filter

    I wrote a Servlet Filter to handle user authentication. Now I'm trying to access my Managed Session Bean in the filter in order to save the current user. Unfortunately the Session Bean is created after the Filter executes for the first time.
    I'm trying to access the Session Bean in this way:
    (SessionBean) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("sessionBean");
    In this case getExternalContext() is equals null.
    Is there any way to create the Session bean before the filter executes or any other ideas how to handle this?
    I already searched around the internet but couldnt figure out something.
    Thanks guys,
    Paul

    Ok, fixed it like this. Works perfect. JSF finds and uses the handmade Session Bean as well.
    if(request.getSession().getAttribute(BeanNames.SESSION_SCOPE_BEAN) == null) {
         SessionBean sessionBean = new SessionBean();
         request.getSession().setAttribute(BeanNames.SESSION_SCOPE_BEAN, sessionBean);
    }Thanks,
    Paul

  • Database access from session bean

    Hello,
    I have a stateless session bean which performs some complex
    calculations, and also does some database access.
    For the database access the bean class has a datasource as
    follows:
    public class TestBean implements SessionBean {
    private DataSource ds_;
    public void ejbCreate() {
         getDataSources();
    private void getDataSources() {
         try {
         Context ictx = new InitialContext();
         ds_ = (DataSource)ictx.lookup("java:comp/env/jdbc/TestDB");
         } catch (Exception e) {
         e.printStackTrace();
         throw new EJBException(e);
    Now this class has a method (which is also in the remote interface)
    calculateSomething(). This method constructs a number of other
    objects that do the actual calculation, and one of these objects
    does the actual database access. How would another object be able to
    use the datasource that was constructed in the bean class?
    I could pass the datasource reference to that object, but that would
    break my encapsulation. This is because that object does not get
    created directly by the bean object, but rather the way the objects
    interact is something like A -> B -> C, where A is the TestBean, and
    C is the object that does the DB access. If I passed the datasource,
    I would need to make B aware of the datasource, which doesn't
    seem good design, because B doesn't do any database access.
    Alternatively I could do the lookup in class C, but that would
    degrade the performance, as an object C gets created and destroyed
    every time the calculateSomething() method is called.
    A third option I have thought of, is to add a public method to the
    bean that returns a connection. Whenever another object gets
    created, a reference to the bean object will be passed along. Then,
    if another object needs to do database access, it will call back
    the bean to get a connection. This seems just as bad (if not worse)
    than the first option.
    Does anyone have an elegant solution for this situation? What is
    the best practice of handling datasources when a bean class doesn't
    do the database access itself? In all the examples I've seen so far,
    all the functionality was in the session bean class, but again that
    doesn't seem good OO design, and would result in a single huge class.
    regards,
    Kostas

    Thanks again to both for the replies. Here are my responses:
    Yi Lin: Yes, I know that an entity bean would solve this problem, however it has been decided not to use entity beans so this is not my call (I think the reason entity beans are not allowed in this project is that they are considered risky: there are other applications that access the same database, so if the container caches entity bean data as you describe, then the users might get inconsistent results).
    Gerard: Actually object B is the one that has the business logic and C is a peer object that only does database access and no calculaitons. For example B can be Customer, and C CustomerDB. This is why object B does not have any knowledge of datasources or connections. So my design does not appear to be that bad!
    As far as the factory you propose is concerned, I cannot understand how this would solve my problem. In order to solve this situation the factory would need to be persistent, i.e. get created by the ejbCreate() method, and destroyed whenever the container decides to destroy the bean. There would be no point in object C creating the factory, as I would have the overhead of doing the JNDI lookup every time I create a C.
    So the question remains the same: how would I pass a reference to the factory from A to C without making B aware of it?

  • Exception while accessing deployed session bean

    Hi,
    I am new to IPlanet AS 6.0 . I wrote a simple stateless session bean in Forte EE v 3.0 environment. The compilation and deployment went fine. When I try to use my bean through a client program using IIOP then it throws the following exception in kjs:
    javax.naming.NameNotFoundException: EjbContext: exception on getHome(), com.netscape.server.eb.UncheckedException: unchecked exception thrown by impl com.kivasoft.eb.boot.EBBootstrapImpl@71dc3d; nested exception is:
    java.lang.NullPointerException
    at com.netscape.server.ejb.EjbContext.createHomeRef(Unknown Source)
    at com.netscape.server.ejb.EjbContext.getHomeRef(Unknown Source)
    at com.netscape.server.ejb.EjbContext.lookup(Unknown Source)
    at com.netscape.server.jndi.RootContext.lookup(Unknown Source)
    at com.netscape.server.jndi.RootContext.lookup(Unknown Source)
    at javax.naming.InitialContext.lookup(InitialContext. java:357)
    at com.netscape.ejb.CorbaHomeFactoryImpl.ConstructEJBHome(Unknown Source
    at com.netscape.CosNaming.NamingContextImpl.resolve(Unknown Source)
    at org.omg.CosNaming._NamingContextImplBase.invoke(_N amingContextImplBas
    e.java:233)
    at com.sun.corba.ee.internal.corba.ServerDelegate.dis patch(ServerDelegat
    e.java:236)
    at com.sun.corba.ee.internal.iiop.ORB.process(ORB.jav a:227)
    at com.sun.corba.ee.internal.iiop.CachedWorkerThread. doWork(IIOPConnecti
    on.java:262)
    at com.sun.corba.ee.internal.iiop.CachedWorkerThread. run(IIOPConnection.
    java:230)
    My client program is:
    import java.util.*;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.rmi.PortableRemoteObject;
    public class MybeanClient {
    public static void main(String[] args) {
    try {
    Properties env = new Properties();
    env.put("java.naming.factory.initial","com.sun.jndi.cosnaming.CNCtxFactory");
    env.put("java.naming.provider.url", "iiop://localhost:9010");
    Context initial = new InitialContext(env);
    Object objref = initial.lookup("ejb/Mybean");
    MybeanHome home =(MybeanHome)PortableRemoteObject.narrow(objref,My beanHome.class);
    Mybean bean = home.create();
    String result = bean.test();
    System.out.println(result);
    } catch (Exception ex) {
    System.err.println("Caught an unexpected exception!");
    ex.printStackTrace();
    The j2eeguide.converter sample bundled with IPlanet works fine with the above code.
    The only difference is that the converter sample was deployed by the IAS deployment tool.
    Mybean was deployed by the Forte.
    What is the problem?
    Any help would be highly appreciated.

    1. Check that iiop is enabled in ias-ejb-jar.xml
    2. Check your naming in the xml files
    3. Check what has been deployed (filesystem & kregedit)
    4. Try it with the full qualified name ejb/'ejbfilename'/<ejb-name>

  • I have got problem to create Session Bean

    Hi
    I am new in j2ee. I have installed the eclipse 3.1, j2sdk1.4.2_07 and tomcat 5.0. I have created a ejb with a session bean and it gives me a error the program doesn't find the class javax.ejb.SessionBean. My question is Can this error happen because I don't have installed J2EE 1.4 SDK and Sun Java System Application Server Platform Edition 8.1?
    thank you

    Hi
    I have tried to put the classpath with j2ee in eclipse but it happens the same. it doesn't find the package javax.ejb.SessionBean.
    I am going to explain i have done from the beginning. Maybe I am wrong in something. I think which is that.
    I have create a proyect with Dynamic Web Proyect after i create a proyect with ejbModule. I attempt to create a file with session bean. In last proyect acceded to Run->Run here i select Apache Tomcat and Tomcat v5.0 Server _ localhost and i select the classpath in "bootstrap entries" i insert the file j2ee.jar. And I' ve got the same error.
    is it fine? I am bored trying to find the problem.
    thanks in advanced

  • Problems accessing Free WiFi while running 3.1OS on an iPhone3G

    I suddenly started experiencing problems accessing free public Wi-Fi networks (at places such as Starbucks, McD's, Corner Bakery Cafe, Noodles & Co, etc) a couple days ago.  I re-booted my phone several times; cleared the Safari history, cookies, & cache; AND reset the network settings back to factory default.  I'm still not able to successfully log on to any free public networks.  In fact, I stopped into an Apple store & could not even access their free "Apple Store" Wi-Fi network.
    Before scheduling a so-called "Genius Bar" appointment, I asked one of the Apple staff (many of whom are dressed in beach-bum attire these days) about my problem.  She suggested that I upgrade from my current 3.1 Operating System to the current version (which I believe is 4.3).
    Has anyone else experienced this phenomena AND did upgrading your software resolve the problem?
    (It's sorta bizzare in the sense that I've never experienced difficulty logging on to free public Wi-Fi networks prior to this "episode").

    As it would turn out...
    The next time I connected my iPhone 3G to my iTunes-synching-computer, iTunes yielded the following error message: "iTunes could not connect to this iPhone because an unknown error occurred (0xE800000A)."
    So I was forced to place the iPhone 3G in to "recovery mode" & to initiate a restoral process.
    Here are the prompts (or iTunes message updates) that I received as the iTunes restoral process was running:
    *I downloaded the most recent firmware (Version 4.2.1  8C148)
    *Extracting Software
    *Preparing iPhone for Restore
    *Waiting for iPhone
    *Preparing iPhone Software for Restore
    *Restoring iPhone Software
    *Verifying iPhone Software
    *Verifying iPhone Restore
    *Restoring iPhone Firmware
    Ultimately I got a message stating that iTunes had successfully restored the iPhone 3G, that I should leave the phone connected, & that it would soon appear in the iTunes "device pane."
    (I'm paraphrasing because I was unable to capture a screen-shot of the exact phrasing of that dialogue box).
    Now after all of that...
    The problem that led me into all of this mess still does NOT seem to be resolved.  The phone IS detecting/recognizing the presence of wireless networks (free public AND secured private ones).  However it is NOT allowing me to log on to those free public networks.  (In other words, the free networks'  "confirmation page" is not launching to then allow me to confirm my desire to log on to the free public network and to start my browsing session in Safari).
    I'm about to schedule an appointment with the so-called Apple "Genius Bar."  However, I decided to post here first to see if anyone had additional ideas/suggestions.  The problem remains as described above (except that the device is now running firmware Version 4.2.1 - 8C148).

  • Could not access Local Session Bean using JNDI lookup

    Hi EJB Guru,
    I am quite new to EJB 3.0 but have had a good deal of success including using JNDI to lookup Remote Stateless Session Bean in EJB 3.0. However, looking up local Stateless Session Bean prove more challenging with I had anticipated.
    Here is my code
    as follows:
    public interface Calculator {
        public int add(int x, int y);
        public int subtract(int x, int y);
    import javax.ejb.Remote;
    @Remote
    public interface CalculatorRemote extends Calculator {
    import javax.ejb.Local;
    @Local
    public interface CalculatorLocal extends Calculator {
    import javax.ejb.Local;
    import javax.ejb.Remote;
    import javax.ejb.Stateless;
    import bean.CalculatorLocal;
    import bean.CalculatorRemote;
    @Stateless
    public class CalculatorBean implements CalculatorRemote, CalculatorLocal {
        public int add(int x, int y) {
            return x + y;
        public int subtract(int x, int y) {
            return x - y;
    import bean.*;
    import bean.Calculator;
    import bean.CalculatorLocal;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    public class ClientAccessLocalCalculator {
        public static void main(String[] args) throws NamingException {
            InitialContext ctx = new InitialContext();
            CalculatorLocal calculator = (CalculatorLocal) ctx.lookup("CalculatorBean/local");
            System.out.println("1 + 1 = " + calculator.add(1, 1));
            System.out.println("1 - 1 = " + calculator.subtract(1, 1));    }
    import bean.Calculator;
    import bean.CalculatorRemote;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    public class ClientAccessRemoteCalculator {
        public static void main(String[] args) throws NamingException {
            InitialContext ctx = new InitialContext();
            CalculatorRemote calculator = (CalculatorRemote) ctx.lookup("CalculatorBean/remote");
            System.out.println("1 + 1 = " + calculator.add(1, 1));
            System.out.println("1 - 1 = " + calculator.subtract(1, 1));    }
    }Output when running ClientAccessRemoteCalculator gives
    1 + 1 = 2
    1 - 1 = 0
    Output when running ClientAccessLocalCalculator on JBoss AS 4.0.5 gives:
    Exception in thread "main" javax.ejb.EJBException: Invalid invocation of local interface (null container)
    at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:75)
    at $Proxy0.add(Unknown Source) at ClientAccessLocalCalculator.main(ClientAccessLocalCalculator.java:14)
    JNDIView in JMX-Console in JBoss:
    +- CalculatorBean (class: org.jnp.interfaces.NamingContext)
    | +- local (proxy: $Proxy84 implements interface bean.CalculatorLocal,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
    | +- remote (proxy: $Proxy83 implements interface bean.CalculatorRemote,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)
    Output when running ClientAccessLocalCalculator on SJSAS 9.0 gives:
    Exception in thread "main" javax.naming.NameNotFoundException: bean.CalculatorLocal not found
    C:\>asadmin
    Use "exit" to exit and "help" for online help.
    asadmin> list-jndi-entries
    Jndi Entries for server within root context:
    bean.CalculatorRemote: javax.naming.Reference
    jbi: com.sun.enterprise.naming.TransientContext
    jdbc: com.sun.enterprise.naming.TransientContext
    UserTransaction: com.sun.enterprise.distributedtx.UserTransactionImpl
    bean.CalculatorRemote__3_x_Internal_RemoteBusinessHome__: javax.naming.Reference
    bean.CalculatorRemote#bean.CalculatorRemote: javax.naming.Reference
    ejb: com.sun.enterprise.naming.TransientContext
    Command list-jndi-entries executed successfully.
    asadmin>I am using Application Client to lookup these Session Beans on Netbeans 5.5, JBoss AS 4.0.5 (EJB3 installer)/SJSAS
    9.0, SDK 1.5.0_11 on Windows XP platform.
    Any assistance would be much appreciated.
    Many thanks,
    Henry

    Hi Henry,
    Any direct global JNDI lookup is not portable. It works in some cases but not in others, which
    is why we recommend using the portable Java EE approach of declaring an ejb dependency
    and looking up that dependency via the bean's component environment (java:comp/env).
    This is true whether you're dealing with Remote or Local ejb dependencies.
    Local ejbs are not supported in the Application Client tier at all. In the server tier, there is no
    guarantee that a Local EJB even is assigned a global JNDI name since there's no requirement
    that it be available outside of the application in which the ejb is defined.
    You can find more information on these ejb access topics in our EJB FAQ :
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html

  • JDev 10.1.3: Problem deploying a session bean to embedded OC4J

    JDeveloper 10.1.3, TopLink, OC4J, WinXP, java 1.4.2_05.
    I used TopLink to create a set of Java objects from a DB Schema, then created a simple Session Bean to read some of the objects. Everything compiles fine.
    JAVA_HOME points to the JDK (not JRE) and CLASSPATH is empty (undefined).
    When I try to Run my session bean in the jdeveloper embedded oc4j, I get this message. Thanks in advance for your help.
    Milind
    ===============
    [Starting OC4J using the following ports: HTTP=8988, RMI=23891, JMS=9227.]
    C:\Tools\jdev_10_1_3\jdev\system\oracle.j2ee.10.1.3.3.51\oc4j-config>
    C:\Tools\jdev_10_1_3\jdk\bin\javaw.exe -ojvm -classpath C:\Tools\jdev_10_1_3\j2ee\home\oc4j.jar;C:\Tools\jdev_10_1_3\jdev\lib\jdev-oc4j-embedded.jar -Xverify:none -DcheckForUpdates=adminClientOnly -Doracle.j2ee.dont.use.memory.archive=true -Doracle.j2ee.http.socket.timeout=500 -Doracle.dms.sensors=NONE -Doc4j.jms.usePersistenceLockFiles=false oracle.oc4j.loader.boot.BootStrap -config C:\Tools\jdev_10_1_3\jdev\system\oracle.j2ee.10.1.3.3.51\oc4j-config\server.xml
    [waiting for the server to complete its initialization...]
    05/03/22 14:43:50 Node started with id=127765687050882
    05/03/22 14:43:52 Auto-deploying - applications/admin_ejb.jar (orion-ejb-jar.xml had been updated since the previous deployment)...
    05/03/22 14:43:52 Error initializing server: Error initializing ejb-module; Exception null
    05/03/22 14:43:53 Fatal error: server exiting
    Process exited with exit code 1.

    Error initializing ejb-module;
    Is the EJB Jar structured as
    META-INF/
    ejb-jar.xml
    Bean Class
    Home interface Class
    Remote interface Class
    Does the EJBdeploy in some other server?

  • How to realize timeout while invoking a method in remote sesssion bean using my session bean running on wls5.1

    I am using WL5.1 SP11 on a project. I have a stateless session bean inside which
    I will invoke a method defined in another stateless session bean in a remote weblogic
    server 5.1. The performance of the remote server is very low and sometimes when
    I invoke the method through RMI, I got to wait for a long time. So I want to set
    a timeout for my session bean while doing RMI call. The only parameter I could
    find in weblogic-ejb-jar.xml is the "transaction-timeout", but even if I set transaction
    attribute for my session bean, it always block there to wait for the response
    from the remote session bean. The configuation did not work.
    Is there any other solutions to my problem? Please give me some advice if anyone
    has experience on it, Thank you very much.

    I am using WL5.1 SP11 on a project. I have a stateless session bean inside which
    I will invoke a method defined in another stateless session bean in a remote weblogic
    server 5.1. The performance of the remote server is very low and sometimes when
    I invoke the method through RMI, I got to wait for a long time. So I want to set
    a timeout for my session bean while doing RMI call. The only parameter I could
    find in weblogic-ejb-jar.xml is the "transaction-timeout", but even if I set transaction
    attribute for my session bean, it always block there to wait for the response
    from the remote session bean. The configuation did not work.
    Is there any other solutions to my problem? Please give me some advice if anyone
    has experience on it, Thank you very much.

  • Problem when calling session bean from main.

    Hi everyone
    I get the following error when calling a session bean from main(String args[]).
    Sep 3, 2008 9:11:13 AM com.sun.enterprise.appclient.MainWithModuleSupport <init>
    WARNING: ACC003: Application threw an exception.
    java.lang.NullPointerException
    at databasetest.Main.main(Main.java:26)
    Here is my code beneath.
    I'm using netbeans and glassfish application server.
    Everything is in the same project, called DatabaseTest, I also have deployed the application before running the client.
    I'm running the client as follows, right click on the DatabaseTest-app-client and select run.
    The client:
    package databasetest;
    import com.test.UsersFacadeRemote;
    import javax.ejb.EJB;
    import com.test.Users;
    public class Main {
        @EJB
        private static UsersFacadeRemote usersFacade;
        public static void main(String[] args) {
            Users users = new Users(12, 34);
            usersFacade.create(users);
    }The remote facade I'm calling:
    package com.test;
    import java.util.List;
    import javax.ejb.Remote;
    @Remote
    public interface UsersFacadeRemote {
        void create(Users users);
        void edit(Users users);
        void remove(Users users);
        Users find(Object id);
        List<Users> findAll();
    }The stateless bean:
    package com.test;
    import java.util.List;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    @Stateless
    public class UsersFacade implements UsersFacadeRemote {
        @PersistenceContext
        private EntityManager em;
        public void create(Users users) {
            em.persist(users);
        public void edit(Users users) {
            em.merge(users);
        public void remove(Users users) {
            em.remove(em.merge(users));
        public Users find(Object id) {
            return em.find(com.test.Users.class, id);
        public List<Users> findAll() {
            return em.createQuery("select object(o) from Users as o").getResultList();
    }

    looks like you're banging your head against the same brick wall as [I have done|http://forums.sun.com/thread.jspa?forumID=13&threadID=5317110] and [others have in the past|http://forums.sun.com/thread.jspa?forumID=136&threadID=5259913] if that's any consolation.
    Funny thing is, mine did actually work in the debugger but not when running!
    Strange thing that.
    I did initially interest someone from the developers but they couldn't really help, ended up saying : try instantiating your beans the EJB 2.1 way and see where that gets you. Yes that works but they promised us "hey no more dopey xml deployment descriptors just some cool annotations" didn't they?
    I've got the feeling were' missing something really obvious!
    Edited by: sebthebike on 03-Sep-2008 12:21

  • Direct DB access from Session Bean w/o using Serialized Objects

    I am developing a system where I am receiving some messages (data ) inside session bean and I want to log that data into data base �.i.e inserting that data in to various tables. I am not showing that data to client ( that is taken care by another application).
    So I am directly calling insert methods on various tables instead of going for serialized classes for each of that tables and calling setter methods. Is this approach correct? Or this will create nightmares when millions of messages are to be logged? Do I have to make serialized objects? Please post the suggestions ..Thank you in advance.
    If session bean is making direct inserts in the DB using Helper classes as shown below �is there any problem of concurrency?? Means multiple session bean instances inserting data in the same table using the helper class will create any problems?? I am using MySql db presently. Or all will work fine coz I am using the data source and pool available in welogic app server?
    Is this a good approach if my application is doing inserts 90% of times? or I have to use entity beans or serialized objects encapsulating each class?
    public class Logger implements SessionBean
    DAO dao = getDAO();
    dao.insertXyzLog(�x�, �y�,�.);
    private DAO getDAO(){
    if(Dao == null) {
    oao = DAOFactory.getDAO();
    return Dao;
    //other std methods
    public interface DAO {
    // methods to directly insert data in to the tables
    //some methods to look for required value in another tables
    public abstract void insertXyzLog (String x, Stringy, ���.);
    public class DAOImpl implements DAO {
    // look up for JNDI data sourse
    //method to return connection
    public void insertXyzLog (String x, Stirng y�){
    //SQLs for inserting into Xyz table using connection obtained above.

    Hi,
    Nothing wrong in using Helper class to insert into table. It won't create problem as long as your database server able to handle that many request from client.
    If you use weblogic server and datasource, the server will take care of all connection pool management depending upon your configuration parameters.
    Moreover, insert won't lock the table. So you need not worry about those things.
    Best Luck,
    Senthil Babu
    Developer Technical Support
    SUN Microsystems
    http://www.sun.com/developers/support/

  • Problem accessing Facebook (Safari and Chrome w/ 2 different Macs)

    For over a week im having problems accessing facebook and netflix, the timeline does not seem to load properly and some links dont work, im having the same issue using the latest version of chrome and safari. im using two different macbook pros, and both have the same issue, a windows computer in the same network doesnt have those issues. my router is a apple extreme.

    Someone here with a similar problem seems to have fixed it by adding some DNS settings:
    https://discussions.apple.com/message/15783303#15783303
    To do it:
    System Preferences>Network, click on your WiFi connection on the left then click on the Advanced button, select the DNS tab. Under the panel DNS servers click on the '+' sign and insert the numbers 208.67.220.220 - click the '+' again and insert 208.67.222.222
    Alternatively to the numbers listed you can use 8.8.8.8 and 8.8.4.4
    Save the settings - hopefully it'll make a difference.

Maybe you are looking for

  • Cannot create a new project in iDVD

    Hi, Wondering if anyone can help with this? This was working fine but for some reason when I now open iDVD and try to create a new project,nothing appears on screen. When I click iDVD it gives me the options and I can click create new project and ent

  • Garageband/logic volume issue

    ok so.... i basically finished the pre-production of my album and everything sounds absolutely fantastic.... through garageband and logic that is. when i export the song to itunes or my desktop, everything is very distorted. i understand that this is

  • Simple image editor applet

    Hello! I am looking for an applet that can edit images in a simple way. I mean, add a background, add text, add some other image...but very easy to use. I also need the images to let me change the text once they have saved and reopened in the applet

  • Why Encrypted Local Store (ELS) data created is not available after upgrading to AIR 3.4?

    This is a known issue. Please see the official communication from Adobe.

  • Change language for Polish

    I know how to change language in the document. But always when I open pages I have to do that. I have to start working from change the language from english to polish. I checked my settings and in my system preferences I have polish everywhere. What