Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5847283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:41:47+00:00 2026-05-22T12:41:47+00:00

I have an Enterprise Application with an EJB implementing a @Remote business interface that

  • 0

I have an Enterprise Application with an EJB implementing a @Remote business interface that I would like to access from a JSF managed bean on a different machine. They are both development machines with Netbeans 7 and Glassfish 3.1. I believe the answer lies with CORBA, but I do not think I am doing it right.

Is there a better option then CORBA for this?

Here is where I found how to use corbaname:iiop http://download.oracle.com/docs/cd/E19798-01/821-1752/beanv/index.html

This is my EJB Interface:

package remote.ejb;

import javax.ejb.Remote;

@Remote
public interface HelloRemote {
    public String getHello();
}

Enterprise Application: RemoteEJBTest
Java EE Module: RemoteEJBTest-ejb

EJB:

package remote.ejb;

import javax.ejb.EJB;
import javax.ejb.Remote;
import javax.ejb.Stateless;

@Stateless
public class HelloBean implements HelloRemote {

    @Override
    public String getHello() {
        return "Hello World!";
    }
}

Web Application: RemoteWebTest

package hello.web;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
import remote.ejb.HelloRemote;

@ManagedBean
@RequestScoped
public class Hello {
    private HelloRemote helloBean;

    private String hello;

    public Hello() throws NamingException {

        InitialContext ctx = new InitialContext();

        Object obj = ctx.lookup("corbaname:iiop:remote_ip:3700#RemoteEJBTest/RemoteEJBTest-egb/HelloBean");
        helloBean = (HelloRemote) PortableRemoteObject.narrow(obj,HelloRemote.class);
    }

    public String getHello(){
        return helloBean.getHello();
    }
}

Here is the stack trace http://pastebin.com/PxNCKCg4

relavent parts of stack trace:

com.sun.faces.mgbean.ManagedBeanCreationException: Cant instantiate class: hello.web.Hello.
    at com.sun.faces.mgbean.BeanBuilder.newBeanInstance(BeanBuilder.java:193)
    at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:102)

Caused by: javax.naming.NameNotFoundException [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
    at com.sun.jndi.cosnaming.ExceptionMapper.mapException(ExceptionMapper.java:44)
    at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:485)

Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
    at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72)
    at org.omg.CosNaming._NamingContextStub.resolve(_NamingContextStub.java:251)
    at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:471)
... 59 more

What is the best way to split EJBs over multiple remote machines?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T12:41:48+00:00Added an answer on May 22, 2026 at 12:41 pm

    Hum… I think you missed a couple of steps here.

    First you need to create a ejb-ref entrance in glassfish-web.xml like this:

    <ejb-ref>
       <ejb-ref-name>ejb/Foo</ejb-ref-name>
       <jndi-name>corbaname:iiop:host:port#a/b/Foo</jndi-name>
    <ejb-ref>
    

    Second you reference your ejb name directly.

    Context ic = new InitialContext();
    Object o = ic.lookup("java:comp/env/ejb/Foo");
    

    And since you are using a Java EE container with EJB 3.1 support, why don’t you inject the EJB directly at the managed bean using @EJB (I think it is a lot cleaner than JNDI lookup):

    @EJB(name="your-ref-name")
    BeanRemoteInterface beanRemoteInterface; 
    

    Take a look here for further info: http://glassfish.java.net/javaee5/ejb/EJB_FAQ.html#cross-appserverremoteref

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read in Patterns of Enterprise Application Architecture that a Unit Of Work
I have an old (around 5 years) enterprise application that I manage. Recently we
We have an enterprise web application where every bit of text in the system
I have an internal enterprise application I've developed for my company built on .Net
I have an internal enterprise app that currently consumes 10 different web services. They're
I have custom coded several enterprise applications for mid to large organizations to use
I have been programming in Java since 2004, mostly enterprise and web applications. But
CFMX 8 Enterprise I have turned on the Use J2EE session variables setting under
I have been building enterprise software for the last 10 years. In this time
We have a large enterprise consisting of many apps both old and new backed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.