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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:11:32+00:00 2026-05-26T04:11:32+00:00

Code from Enterprise JavaBeans 3.1 chapter 4. If you need more code or information

  • 0

Code from Enterprise JavaBeans 3.1 chapter 4. If you need more code or information just ask!

public class SimpleCalculatorIntegrationTest {

    private static SimpleCalculatorBean calc;
    private static Context namingContext;
    private static final String JNDI_NAME_CALC = "java:global/SimpleCalculatorEJB/SimpleCalculatorBean";

    @BeforeClass
    public static void obtainProxyReferences() throws NamingException {
        namingContext = new InitialContext();

        calc = (SimpleCalculatorBean) namingContext.lookup(JNDI_NAME_CALC);
    }

    @Test
    public void testAddition() {

        int expectedSum = 1 + 2 + 3 + 4; // 10

        assertEquals(expectedSum, calc.add(1, 2, 3, 4));
    }
}

Stacktrace:

11.okt.2011 20:41:28 com.sun.enterprise.v3.server.CommonClassLoaderServiceImpl
findDerbyClient INFO: Cannot find javadb client jar file, derby jdbc
driver will not be available by default. java.lang.RuntimeException:
Orb initialization erorr at
org.glassfish.enterprise.iiop.api.GlassFishORBHelper.getORB(GlassFishORBHelper.java:180)
at
com.sun.enterprise.naming.impl.SerialContext.getORB(SerialContext.java:365)
at
com.sun.enterprise.naming.impl.SerialContext.getProviderCacheKey(SerialContext.java:372)
at
com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:402)
at
com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:347)
at
com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:504)
at
com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
at javax.naming.InitialContext.lookup(InitialContext.java:392) at
no.breakpoint.ejbbook.calculator.test.SimpleCalculatorIntegrationTest.obtainProxyReferences(SimpleCalculatorIntegrationTest.java:24)
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
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.NullPointerException at
org.glassfish.enterprise.iiop.api.GlassFishORBHelper.getORB(GlassFishORBHelper.java:152)
… 23 more

  • 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-26T04:11:33+00:00Added an answer on May 26, 2026 at 4:11 am

    Just to sum up our chat conversation for other interested users:

    You can write tests that works on your EJB’s in two ways:

    1. Testing outside-of-the-container. It means that your tests run as a different application on different JVM. In this case you need to use the Remote interface EJB view and JNDI to locate your EJB. The JNDI coordinates are construct as written in EJB 3.1 specification regarding portable JNDI syntax (p. 81). In case of Glassfish you just need to:
      • add the remote interface to your classpath (to be able to use it),
      • add the gf-client.jar to your classpath.

    Then you will be able to locate your EJB’s remote interface by invoking code somewhat similar to this:

    public class Main {
    
        private static final String JNDI = 
                        "java:global/yourApp/YourEJBBean!com.test.YourEJBBeanRemote";
    
        public static void main(String[] args) throws NamingException {
            Context ctx = new InitialContext();
    
            YourEJBBeanRemote sr = (YourEJBBeanRemote)ctx.lookup(JNDI);
    
            // Invoke some method on 'sr'
        }
    }
    

    2. Testing inside-of-the-container. It means that your tests are executed within the container and, very likely, together with your application. This allows you to use dependency injection, EntityManagers, local/no-interface EJB’s view and so on. With JBoss Arquillian, you write your tests just assuming that all the services are provided for you.

    The EJB 3.1 new no-interface view is just like local view, so it cannot be used for clients residing outside of the application.

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

Sidebar

Related Questions

I created a enterprise system model from a class diagram and converted it php
I would like to create class diagram from existing source code using rational rose.
I'm logging exceptions to a database using a DatabaseTraceListener from Enterprise Library (code is
I need to distribute some TCL code as part of an enterprise application, and
Porting code from 32bit to 64bit. Lots of places with int len = strlen(pstr);
Here's the code from the ascx that has the repeater: <asp:Repeater ID=ListOfEmails runat=server >
Here is my sample code: from xml.dom.minidom import * def make_xml(): doc = Document()
I copied some Delphi code from one project to another, and found that it
Given the code from the Complex Form part III how would you go about
Taking over some code from my predecessor and I found a query that uses

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.