Question

I cannot access remote EJB beans of our application server within a web application running on Glassfish 3 web-profile using jndi lookup.

Using full profile for our web-application or even testing with a console application we have no problem accessing jndi remote beans.

Exception:

Unable to acquire SerialContextProvider for SerialContext

We just hoped to make our web servers more lightweight.

Was it helpful?

Solution

The Web Profile version of Glassfish only contains EJB Lite, which doesn't support @Remote interfaces. You need the Full Profile which supports the full EJB 3 spec.

From the oracle docs:

The Web Profile of the GlassFishTM Server supports the EJB 3.1 Lite specification, which allows enterprise beans within web applications, among other features. The full GlassFish Server supports the entire EJB 3.1 specification. For details, see JSR 318.

You can find a comparision of features included in Web Profile and Full Profile here (It was made for Glassfish 3.1.1 but it should be nearly the same for Glassfish 4 except some newer versions of some features). You can find a nice feature comparision between EJB 3.1 Lite and Full in this article.

Update:

As you wrote in the comment (and the initial question) you are not using any enterprise beans directly in your web application, but you are retrieving bean instances via JNDI. This doesn't work with the Web Profile of Glassfish because the functionality for remote lookups is not there, e.g. the CORBA and ORB modules are missing (there are some basic CORBA OMG APIs but only because they are needed by other modules).

As your goal was to make the server more lightweight, maybe this is another option for you:

You can remove unused components and modules with the pkg command-line-tool or with the graphical utility updatetool. You could install the Full Profile of Glassfish and then remove obsolete components step by step to make the server more lightweight. More details about the tools can be found in the oracle docs.

See also:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top