This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 179008 - javax.ejb.EJBException: No EJBContainer provider available: no provider names had been found.
Summary: javax.ejb.EJBException: No EJBContainer provider available: no provider names...
Status: RESOLVED INCOMPLETE
Alias: None
Product: javaee
Classification: Unclassified
Component: EJB (show other bugs)
Version: 6.x
Hardware: All Linux
: P3 normal (vote)
Assignee: Andrey Yamkovoy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-23 10:53 UTC by dhcavalcanti
Modified: 2010-08-29 21:11 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dhcavalcanti 2009-12-23 10:53:25 UTC
Hi, I have an EJB project that contains a set of singleton EJB (3.1) beans.
I'm trying to write unit tests for them, but I just can get the EJBContainer properly created.

I'm using all the default options from NetBeans 6.8.

Here is the unit test:

public class YahooGeocodingServiceTest {

    private static final String LOCATION = "Miami, FL";
    private EJBContainer container;

    @Before
    public void init()
    throws IOException, NamingException {
        container = EJBContainer.createEJBContainer();
    }

    @After
    public void finish() {
        container.close();
    }

    @Test
    public void resolveLocation()
    throws Exception {

        Context context = container.getContext();
        YahooGeocodingService yahooGeocodingService = (YahooGeocodingService) context.lookup("java:global/classes/YahooGeocodingService");

        Geocode geocode = yahooGeocodingService.resolveLocation(LOCATION);
        System.out.println("Geocode: " + geocode);

    }

}

However, I get the following exception:
Testcase: resolveLocation(com.localmatters.fleximessage.processor.service.YahooGeocodingServiceTest):        Caused an ERROR
No EJBContainer provider available: no provider names had been found.
javax.ejb.EJBException: No EJBContainer provider available: no provider names had been found.
        at javax.ejb.embeddable.EJBContainer.reportError(EJBContainer.java:186)
        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:121)
        at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:78)
        at com.localmatters.fleximessage.processor.service.YahooGeocodingServiceTest.init(YahooGeocodingServiceTest.java:45)

The corresponding line in the code is in the @Before init() method: container = EJBContainer.createEJBContainer();

I searched google and the glassfish mailing lists, and there is nothing there to indicate that this unit test is incorrect.
Comment 1 Andrey Yamkovoy 2010-04-23 08:57:26 UTC
I have tried the following scenario:
- Create EJB module with Singleton Session bean.
- Create JUnit test for the bean.
- Remove fail() from the test and run it.
The test is passed. 

I am using NB dev build with Glassfish V3 b73.

Could you please provide the following info:
- AppServer specified for the tested project.
- attach test output log.
- if possible attach the project.
Comment 2 msukkar 2010-08-29 21:11:10 UTC
(In reply to comment #1)
> I have tried the following scenario:
> - Create EJB module with Singleton Session bean.
> - Create JUnit test for the bean.
> - Remove fail() from the test and run it.
> The test is passed. 
> 
> I am using NB dev build with Glassfish V3 b73.
> 
> Could you please provide the following info:
> - AppServer specified for the tested project.
> - attach test output log.
> - if possible attach the project.

Hi Andrey,

If you try the same scenario you mentioned but when creating the project specify a dedicated folder for libraries and copying the server jars it will fail with the error described. The problem is also found when using an EJB in a web application. I just tried it on both 6.9 and 6.9.1.