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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:06:40+00:00 2026-05-24T06:06:40+00:00

I am trying to JUnit Test a J2EE Web Application with NB 7.0, JUnit

  • 0

I am trying to JUnit Test a J2EE Web Application with NB 7.0, JUnit and the embedded Glassfish Server in a Win7Professional machine.

I broke it down to just test a plain simple Hello-World Web App with a single Session Bean.

I have the glasfish-embedded-static-shell.jar in my classpath, and also tried to use the glassfish-embedded-all-3.1 but it also didn’t work.

Now here’s the code I use to test the bean:

import javax.ejb.embeddable.EJBContainer;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

public class SimpleBeanTest {

private static EJBContainer container;

public SimpleBeanTest() {
}

@BeforeClass
public static void setUpClass() throws Exception {
    container = javax.ejb.embeddable.EJBContainer.createEJBContainer();
}

@AfterClass
public static void tearDownClass() throws Exception {
    container.close();
}

@Test
public void testCountToThree() throws Exception {
   System.out.println("countToThree");
   SimpleBean instance = (SimpleBean) container.getContext().lookup("java:global/classes/SimpleBean");
   int expResult = 0;
   int result = instance.countToThree();
   assertEquals(expResult, result);

}
}

And here’s what comes out of it:

19.06.2011 09:31:56 com.sun.enterprise.v3.server.CommonClassLoaderServiceImpl findDerbyClient
INFO: Cannot find javadb client jar file, derby jdbc driver will not be available by default.
19.06.2011 09:31:56 org.glassfish.flashlight.impl.provider.FlashlightProbeProviderFactory processXMLProbeProviders
SCHWERWIEGEND: MNTG0301:Cannot process XML ProbeProvider, xml = META-INF/gfprobe-provider.xml
java.lang.IllegalStateException: Provider already mapped glassfish:javamail:smtp-transport

(StackTrace here)

19.06.2011 09:31:57 org.glassfish.flashlight.impl.provider.FlashlightProbeProviderFactory processXMLProbeProviders
SCHWERWIEGEND: MNTG0301:Cannot process XML ProbeProvider, xml = META-INF/mojarra-jsf-api-probe-provider.xml
java.lang.IllegalStateException: Provider already mapped glassfish:jsf:faces-servlet

(StackTrace here)

19.06.2011 09:31:57 org.glassfish.flashlight.impl.provider.FlashlightProbeProviderFactory processXMLProbeProviders
SCHWERWIEGEND: MNTG0301:Cannot process XML ProbeProvider, xml = jersey-gf-server-probe-provider.xml
java.lang.IllegalStateException: Provider already mapped glassfish:jersey:server-hidden

(StackTrace here)

19.06.2011 09:31:57 org.glassfish.flashlight.impl.provider.FlashlightProbeProviderFactory processXMLProbeProviders
SCHWERWIEGEND: MNTG0301:Cannot process XML ProbeProvider, xml = jersey-gf-statsprovider-probe-provider.xml
java.lang.IllegalStateException: Provider already mapped glassfish:jersey:server

(StackTrace here)

19.06.2011 09:31:57 org.glassfish.ha.store.spi.BackingStoreFactoryRegistry register
INFO: Registered org.glassfish.ha.store.adapter.cache.ShoalBackingStoreProxy for persistence-type = replicated in BackingStoreFactoryRegistry
19.06.2011 09:31:57 org.glassfish.ha.store.spi.BackingStoreFactoryRegistry register
INFO: Registered org.glassfish.ha.store.adapter.cache.ShoalBackingStoreProxy for persistence-type = replicated in BackingStoreFactoryRegistry
19.06.2011 09:31:57 com.sun.enterprise.v3.server.AppServerStartup run
SCHWERWIEGEND: Startdienst konnte nicht gestartet werden: com.sun.enterprise.naming.GlassFishNamingBuilder
19.06.2011 09:31:57 com.sun.enterprise.v3.server.AppServerStartup run
INFO: GlassFish Server Open Source Edition 3.1 (43) Startzeit: Embedded (597ms), Startdienste(929ms), gesamt(1.526ms)
19.06.2011 09:31:57 org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread run
INFO: JMXStartupService: JMXConnector system is disabled, skipping.

UPDATE:
And this is the exception which would be thrown by any test:

No EJBContainer provider available
Provider named org.glassfish.ejb.embedded.EJBContainerProviderImpl threw unexpected exception at create EJBContainer: 
java.lang.RuntimeException
java.lang.RuntimeException: java.lang.IllegalStateException: AMX Booter MBean is already registered: amx-support:type=boot-amx
    at org.glassfish.internal.embedded.Server.<init>(Server.java:290)
    at org.glassfish.internal.embedded.Server.<init>(Server.java:66)
    at org.glassfish.internal.embedded.Server$Builder.build(Server.java:176)

(Stack Trace here)

Caused by: java.lang.IllegalStateException: AMX Booter MBean is already registered: amx-support:type=boot-amx

I have reinstalled NetBeans twice and it doesn’t works either.

  • 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-24T06:06:41+00:00Added an answer on May 24, 2026 at 6:06 am

    I had the same issue and I did the following:

    1) I installed Glassfish 3.1.1 and linked it to my project. First I added the server with Tools – Servers – Add Server… Then I right-clicked my EJB project and selected Properties – Run – Glassfish 3.1.1
    2) In my EJB pom.xml I use this dependency (make sure the systemPath variable points to the correct file):

    <dependency>
        <groupId>org.glassfish.extras</groupId>
        <artifactId>glassfish-embedded-static-shell</artifactId>
        <version>3.1.1</version>
        <scope>system</scope>
        <systemPath>${glassfish.embedded-static-shell.jar}</systemPath>
    </dependency>
    

    3) In my EJB pom.xml I removed the dependency other people said I have to add it if I get the errors “Provider already mapped…”

    <dependency>
        <groupId>org.glassfish.extras</groupId>
        <artifactId>glassfish-embedded-all</artifactId>
        <version>3.1.1</version>
        <scope>test</scope>
    </dependency>
    

    That’s it! Now my EJB JUnit tests with JPA 2 work like a charm! Hope this helps!

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

Sidebar

Related Questions

I've been trying to test my web app by starting a Jetty server in
When trying to start my JUnit-Test out of Eclipse, I get a ClassNotFoundException. When
I'm trying to run a particular JUnit test by hand on a Windows XP
I am trying to run JUnit test with a 1.5 JRE, but get the
I'm trying to run Jettys ServletTester in my JUnit test. I created a simple
I'm trying to run my junit test (to verify that a properties file loads
I'm trying to come up with an efficient way to index my JUnit test,
I am trying to debug a junit test in eclipse but my breakpoints are
I'm trying to run some JUnit test units in Eclipse 3.5, but with no
I'm trying to test my hibernate project with junit tests and I keep on

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.