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

  • SEARCH
  • Home
  • 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 8354995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:43:33+00:00 2026-06-09T09:43:33+00:00

i’m developing an application on top of netbeans API using Glassfish 3.1.2. My netbeans

  • 0

i’m developing an application on top of netbeans API using Glassfish 3.1.2. My netbeans application is supposed to be my standalone java client that have to connect to the EJB.

I have packaged my EJB into an EAR (enterprise application). The problem i’m facing of is that i got an exception when i try to lookup for available EJBs.

Here is my bean session:

@Stateless
@EJB(name = "java:global/AltServer", beanInterface = AltServerRemote.class)
public class AltServer implements AltServerRemote {

The remote interface:

@Remote
public interface AltServerRemote {

And finally the lookup call:

props.setProperty("org.omg.CORBA.ORBInitialHost", getGlassfishHostname());
props.setProperty("org.omg.CORBA.ORBInitialPort", getServerPort());
ctx = new InitialContext(props)

ctx.lookup("java:global/AltServerEnt/AltServer-ejb/AltServer")

About how to lookup an EJB packaged into an EAR, i have followed this : http://glassfish.java.net/javaee5/ejb/EJB_FAQ.html#CosNaming and foud the jndi syntax:

java:global[/<app-name>]/<module-name>/<bean-name>

So in my case my enterprise application is AltServerEnt, my EJB module is AltServer-ejb and my session bean is called AltServer (see above).

Note: I have used the @EJB annotation to my session bean to specify a name like explained in FAQ i linked above, i’m not sure it’s suitable when the EJB is part of an EAR. Anyone know?

And here the exception i got, raised at the line of the lookup:

java.lang.ClassNotFoundException: com.sun.ejb.codegen.GenericEJBHome_Generated

There are a lot of “Caused” clauses but here is the first one:

javax.naming.NamingException: Lookup failed for 'java:global/AltServerEnt/AltServer-ejb/AltServer' in SerialContext[myEnv={org.omg.CORBA.ORBInitialPort=3700, java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, org.omg.CORBA.ORBInitialHost=127.0.0.1, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl} [Root exception is javax.naming.NamingException: ejb ref resolution error for remote business interfaceorg.altanis.remote.AltServerRemote [Root exception is java.lang.RuntimeException: Could not invoke defineClass!]]

So i guess my session bean is not found but why? My JNDI syntax isn’t right?

EDIT: Just to notice my project organization:

  • AltServerEnt: Enterprise Application – contains the EJB module
  • AltServer-ejb: EJB Module – contains the sessions bean and includes a netbeans plugin that contains the remote interface (AltServerRemote).

Thanks for reading.

  • 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-06-09T09:43:34+00:00Added an answer on June 9, 2026 at 9:43 am

    The EAR/EJB apparently deployed. So bring up the Glassfish Admin console, something like https://<host>:4848 and login. On the left, navigate through Applications and click on your application to bring up the ‘Edit Application’ screen. Examine Application’s name & Component names displayed – and compare to what your expectations are.

    I don’t have any remote EJBs deployed at the moment, so I can’t confirm – but I think that for remote EJBs there may be a link under the Action column to display the URL.

    Naming Options

    1. Use the name AltServer as the EJB’s name: name="EJB(name = "AltServer" ...). With a "simple name", the bean can be found in various JNDI namespaces (global/app/module); your lookup ctx.lookup("java:global/AltServerEnt/AltServer-ejb/AltServer") should work.

    2. If you add the prefix java:global then you’ve declared a name directly in the JNDI global namespace; you would be able to lookup your bean directly in that namespace using the same name: java:global/AltServer. Yes, you should still be able to access it in other namespaces – see first paragraph.

    Also

    You ask: "I have used the @EJB annotation to my session bean to specify a name like explained in FAQ i linked above, i’m not sure it’s suitable when the EJB is part of an EAR. Anyone know?"

    It’s fine, it all depends on what you want. Like all name-spaces, one might think towards avoiding overpopulating a namespace – particularly the global namespace. Give it a few moments of thought, and just make a decision – and be ready to rethink it if needed 🙂

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

Sidebar

Related Questions

I have thousands of HTML files to process using Groovy/Java and I need to
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't

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.