users@glassfish.java.net

Lookup / discover JNDI names in Glassfish 3.1.2

From: <forums_at_java.net>
Date: Fri, 13 Apr 2012 05:45:28 -0500 (CDT)

Hello, i try to lookup an EntityManager using the following piece of code
without success: EntityManager em = null; try { Context ic = new
InitialContext(); em = (EntityManager)
ic.lookup("java:comp/env/persistence/em"); } catch (NamingException e) {
logger.log(Level.SEVERE, "shit happens"+e); } which lead me to the question
how i can find out what resources are available via JNDI. I saw there is an
asadmin command list-jndi-entries, but there is a lot of information i dont
really understand: ... adding inhabitant:
LazyInhabitant-10805987(org.glassfish.gms.GMSAdapterImpl, active: null) to
habitat org.jvnet.hk2.component.Habitat_at_cec0c5 adding index for inhabitant:
LazyInhabitant-10805987(org.glassfish.gms.GMSAdapterImpl, active: null) with
typeName org.glassfish.gms.bootstrap.GMSAdapter and name null to habitat
org.jvnet.hk2.component.Habitat_at_cec0c5 adding inhabitant:
LazyInhabitant-19642336(org.glassfish.gms.GMSConfigUpgrade, active: null) to
habitat org.jvnet.hk2.component.Habitat_at_cec0c5 adding index for inhabitant:
LazyInhabitant-19642336(org.glassfish.gms.GMSConfigUpgrade, active: null)
with typeName org.glassfish.api.admin.config.ConfigurationUpgrade and name
gmsupgrade to habitat org.jvnet.hk2.component.Habitat_at_cec0c5 adding
inhabitant:
LazyInhabitant-20248218(org.glassfish.gms.admin.GMSAnnounceBeforeStartClusterCommand,
active: null) to habitat org.jvnet.hk2.component.Habitat_at_cec0c5 adding index
for inhabitant:
LazyInhabitant-20248218(org.glassfish.gms.admin.GMSAnnounceBeforeStartClusterCommand,
active: null) with typeName org.glassfish.api.admin.AdminCommand and name
_gms-announce-before-start-cluster-command to habitat
org.jvnet.hk2.component.Habitat_at_cec0c5 adding index for inhabitant:
LazyInhabitant-20248218(org.glassfish.gms.admin.GMSAnnounceBeforeStartClusterCommand,
active: null) with typeName org.glassfish.api.admin.Supplemental and name
null to habitat org.jvnet.hk2.component.Habitat_at_cec0c5 adding inhabitant:
LazyInhabitant-2758093(org.glassfish.gms.admin.GMSAnnounceAfterStopClusterCommand,
active: null) to habitat org.jvnet.hk2.component.Habitat_at_cec0c5 adding index
for inhabitant:
LazyInhabitant-2758093(org.glassfish.gms.admin.GMSAnnounceAfterStopClusterCommand,
active: null) with typeName org.glassfish.api.admin.AdminCommand and name
_gms-announce-after-stop-cluster-command to habitat
org.jvnet.hk2.component.Habitat_at_cec0c5 adding index for inhabitant:
LazyInhabitant-2758093(org.glassfish.gms.admin.GMSAnnounceAfterStopClusterCommand,
active: null) with typeName org.glassfish.api.admin.Supplemental and name
null to habitat org.jvnet.hk2.component.Habitat_at_cec0c5 adding inhabitant:
LazyInhabitant-16607409(org.glassfish.gms.admin.ValidateMulticastCommand,
active: null) to habitat org.jvnet.hk2.component.Habitat_at_cec0c5 adding index
for inhabitant:
LazyInhabitant-16607409(org.glassfish.gms.admin.ValidateMulticastCommand,
active: null) with typeName com.sun.enterprise.admin.cli.CLICommand and name
validate-multicast to habitat org.jvnet.hk2.component.Habitat_at_cec0c5 adding
inhabitant:
LazyInhabitant-14962806(org.glassfish.gms.bootstrap.GMSAdapterService,
active: null) to habitat org.jvnet.hk2.component.Habitat_at_cec0c5 adding index
for inhabitant:
LazyInhabitant-14962806(org.glassfish.gms.bootstrap.GMSAdapterService,
active: null) with typeName org.glassfish.api.Startup and name null to
habitat org.jvnet.hk2.component.Habitat_at_cec0c5 proceedTo(-1) - curr=null,
act=null, plan=-1, env=class java.lang.Void, thrd=Thread[main,5,main] event
PROGRESS - curr=-1, act=-1, plan=-1, env=class java.lang.Void,
thrd=Thread[main,5,main] sun.net.www.MessageHeader_at_1d256fa8 pairs: {GET
/__asadmin/list-jndi-entries?Xhelp=true HTTP/1.1: null}{Content-type:
application/octet-stream}{User-Agent: metadata}{Cache-Control:
no-cache}{Pragma: no-cache}{Host: localhost:4848}{Accept: text/html,
image/gif, image/jpeg, *; q=.2, */*; q=.2}{Connection: keep-alive}
sun.net.www.MessageHeader_at_1ec89094 pairs: {null: HTTP/1.1 200
OK}{Content-Type: text/xml}{Transfer-Encoding: chunked}{Date: Fri, 13 Apr
2012 10:45:22 GMT} sun.net.www.MessageHeader_at_1774b9b8 pairs: {GET
/__asadmin/list-jndi-entries HTTP/1.1: null}{Content-type:
application/octet-stream}{User-Agent: hk2-agent}{Cache-Control:
no-cache}{Pragma: no-cache}{Host: localhost:4848}{Accept: text/html,
image/gif, image/jpeg, *; q=.2, */*; q=.2}{Connection: keep-alive}
sun.net.www.MessageHeader_at_104c5754 pairs: {null: HTTP/1.1 200
OK}{Content-Type: text/html}{Transfer-Encoding: chunked}{Date: Fri, 13 Apr
2012 10:45:22 GMT}
com.sun.enterprise.container.common.spi.util.InjectionManager:
com.sun.enterprise.container.common.impl.util.InjectionManagerImpl jdbc:
com.sun.enterprise.naming.impl.TransientContext java:global:
com.sun.enterprise.naming.impl.TransientContext ejb:
com.sun.enterprise.naming.impl.TransientContext UserTransaction:
com.sun.enterprise.transaction.TransactionNamingProxy$UserTransactionProxy
com: com.sun.enterprise.naming.impl.TransientContext Command
list-jndi-entries executed successfully. What does all this habitant /
inhabitant stuff mean?

--
[Message sent by forum member 'chris.joelly']
View Post: http://forums.java.net/node/885070