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 8891233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:41:16+00:00 2026-06-14T22:41:16+00:00

I am trying to connect to the ejb service in glassfish server through Java

  • 0

I am trying to connect to the ejb service in glassfish server through Java Web start.
I am getting the following error while getting the initial context. I have also added the code snippet for getting the initial context.

One interesting is when I run the program as a simple java program outside of java web start in a netbeans IDE, it is working fine.

I added all the relevant jar files from the glassfish modules folder into the java web start.

java.lang.NullPointerException
    at com.sun.enterprise.naming.impl.SerialContext.<init>(SerialContext.java:275)
    at com.sun.enterprise.naming.impl.SerialContext.<init>(SerialContext.java:334)
    at com.sun.enterprise.naming.impl.SerialInitContextFactory.createInitialContext(SerialInitContextFactory.java:358)
    at com.sun.enterprise.naming.impl.SerialInitContextFactory.getInitialContext(SerialInitContextFactory.java:353)
    at com.sun.enterprise.naming.SerialInitContextFactory.getInitialContext(SerialInitContextFactory.java:69)
    at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.init(Unknown Source)
    at javax.naming.InitialContext.<init>(Unknown Source)
    at gov.ca.lc.util.ServiceLocator.getInitialContext(ServiceLocator.java:140)
    at gov.ca.lc.util.ServiceLocator.getVotesEJB(ServiceLocator.java:103)
    at gov.ca.lc.scenemanagement.AbstractVotingScene.getCommitteeList(AbstractVotingScene.java:143)
    at gov.ca.lc.scenemanagement.AbstractVotingScene.<init>(AbstractVotingScene.java:65)
    at gov.ca.lc.scenes.MenuScene.<init>(MenuScene.java:56)
    at gov.ca.lc.menu.StartVoting.startUp(StartVoting.java:47)
    at org.mt4j.MTApplication.setup(MTApplication.java:328)
    at processing.core.PApplet.handleDraw(PApplet.java:1580)
    at processing.core.PApplet.run(PApplet.java:1502)
    at java.lang.Thread.run(Unknown Source)
Exception in thread "Animation Thread" java.lang.NullPointerException
    at gov.ca.lc.scenemanagement.AbstractVotingScene.getCommitteeList(AbstractVotingScene.java:143)
    at gov.ca.lc.scenemanagement.AbstractVotingScene.<init>(AbstractVotingScene.java:65)
    at gov.ca.lc.scenes.MenuScene.<init>(MenuScene.java:56)
    at gov.ca.lc.menu.StartVoting.startUp(StartVoting.java:47)
    at org.mt4j.MTApplication.setup(MTApplication.java:328)
    at processing.core.PApplet.handleDraw(PApplet.java:1580)
    at processing.core.PApplet.run(PApplet.java:1502)
    at java.lang.Thread.run(Unknown Source)


Following is my code to get the initial context

    private static InitialContext getInitialContext()
            throws NamingException {
            Properties props = null;
            try{  
    //            props=new Properties();   
    //            props.load(new FileInputStream(new File("jndi.properties")));
    //            System.out.println(props.get("java.naming.factory.initial"));
                 props=new Properties();   


    props.setProperty("java.naming.factory.initial","com.sun.enterprise.naming.SerialInitContextFactory");  
        props.setProperty("java.naming.factory.url.pkgs ", "com.sun.enterprise.naming");//ur server ip  
        props.setProperty("java.naming.factory.state ", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");//ur server ip  
        props.setProperty("org.omg.CORBA.ORBInitialHost", "165.107.33.181");//ur server ip  
        props.setProperty("org.omg.CORBA.ORBInitialPort","3700"); //default is 3700  


            }catch(Exception ex){
                ex.printStackTrace();
            }
            return new InitialContext(props);
        }
  • 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-14T22:41:17+00:00Added an answer on June 14, 2026 at 10:41 pm

    I would like to add that all these set up will work only if you have the glassfish installed in your machine. If you deploy the java webstart app in a machine which doesn’t have the glassfish server then we will end up getting the same exception. The reason is that if you open the appserv-rt.jar it points to the gf-client.jar and if you look into the gf-client.jar it points to a whole bunch of jar files in modules folder. So I suppose, essentially we need the all the jar files pointed by the gf-client.jar.

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

Sidebar

Related Questions

Trying to connect to a SQL Server 2005 instance remotely but getting the following
When trying to connect to a web service using the following $client = new
I trying to connect to a Java Service with some special security requirements It
I am trying to connect to a MySQL Server using JDBC tool in java
Trying to connect to sql server 2005 with delphi 2010 gives me the following
When trying to connect to EC2 over SSH I get the following error: joshua-scotts-macbook-pro:.ec2
Im trying to connect to a mysql database on my web server, but I
i am trying to connect with sql server 2008 using java connection string but
I'm trying connect me to database MySQL server but the console show me ERROR
When trying to connect to mysql I always get this error: java.sql.SQLException: No suitable

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.