To get JMS connection and JDBC connection we will define some JNDI's in JBOSS management . In order to get those connections we use the belo Initial Context method . which is useful while getting JDBC connection by looking up JNDI and other defined JNDI .
JBOS Initial context can be achieved by using following logic . You can define those in server .properties and load hose properties as mntioned below .
public static Context getInitialContext() throws Exception {
String contextProviderURL = null;
contextProviderURL = "localhost:1299";
Properties jbossProperties = new Properties();
jbossProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
jbossProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
jbossProperties.put(Context.PROVIDER_URL, contextProviderURL);
return new InitialContext(jbossProperties);
}
Props Loading
---------------
serverProperties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("META-INF/ServerProperties.properties"));
|
Comments