Search code examples
javajakarta-eeglassfishosgiaries

OSGi client + Apache Aries => connect to GlassFish 4


I am trying to use aries to connect to my glassfish 4 server. I installed all modules and started org.apache.aries.jndi-1.0.0.jar

I created initial context like this

InitialContext ctx = new InitialContext();

But got such error

Caused by: javax.naming.NoInitialContextException at org.apache.aries.jndi.DelegateContext.getDefaultContext(DelegateContext.java:233)

How to set initial context to connect to GF4? What properties to use to connext to server x.x.x.x to port NN?


Solution

  • Aries is not needed to connect to glassfish. Try to install gf-client-module.jar from the glassfish modules dir into the OSGi container and follow this howto to set up jndi: https://glassfish.java.net/javaee5/ejb/EJB_FAQ.html#StandaloneRemoteEJB

    Aries jndi is only needed if you want to access a local OSGi service using jndi. This is for example needed to access a jpa data source using the persistence.xml.