EJB Context

All

Intro

Reviewing some EJBs I started to play with some attributes of the Context.

//this returns java.naming.factory.initial:
System.out.println(Context.INITIAL_CONTEXT_FACTORY.toString());
//this returns java.naming.provider.url:
System.out.println(Context.PROVIDER_URL.toString());

 

EJB Port

The default http port is 8080, given in .

So if you use an offset <port-offset=”${jboss.socket.binding.port-offset:100}”> change Context.PROVIDER_URL,”remote+http://localhost:8180″);  the otherwise, you will get a connection refused:

javax.naming.CommunicationException: WFNAM00018: Failed to connect to remote host [Root exception is java.net.ConnectException: Connection refused]
at (…)

org.wildfly.naming.client.WildFlyRootContext.listBindings(WildFlyRootContext.java:300)
at javax.naming.InitialContext.listBindings(InitialContext.java:472)
at StandaloneJNDI.main(StandaloneJNDI.java:27)
Caused by: java.net.ConnectException: Connection refused

EJB context

Listing

GettingProperties

Unbinding

context.unbiding will return:

21:26:16,717 INFO [org.wildfly.naming] (default task-1) WildFly Naming version 1.0.11.Final-redhat-00001
21:26:16,746 WARN [org.wildfly.naming] (default task-2) WFNAM00036: Unexpected internal error: java.lang.UnsupportedOperationException:  : Naming context is read-only
at org.jboss.as.naming.WritableServiceBasedNamingStore.requireOwner(WritableServiceBasedNamingStore.java:160)
at org.jboss.as.naming.WritableServiceBasedNamingStore.unbind(WritableServiceBasedNamingStore.java:131)
at org.jboss.as.naming.NamingContext.unbind(NamingContext.java:318)

The code is on Github

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s