I have successfully bound a DataSource to the naming service:
[WrapperDataSourceService] Bound connection factory for resource adapter for
ConnectionManager 'jboss.jca:name=MySqlDS,service=DataSourceBinding to JNDI
name 'java:MySqlDS'
Objects from applications deployed within the Application Server are able to
look this up properly using:
| private String initialContextFactory =
org.jnp.interfaces.NamingContextFactory;
|
| private String url = localhost:1099;
|
| private String namingFactoryURLPackages =
org.jboss.naming:org.jnp.interfaces;
|
| private String principal = ;
|
| private String credentials = ;
|
| public AbstractJndiLocator() throws ServiceLocatorException {
| env = new Properties();
| env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
initialContextFactory);
| env.setProperty(Context.PROVIDER_URL, url);
| env.setProperty(Context.URL_PKG_PREFIXES,
namingFactoryURLPackages);
| // env.put(Context.SECURITY_PRINCIPAL, principal);
| // env.put(Context.SECURITY_CREDENTIALS, credentials);
| try {
| ctx = new InitialContext(env);
| // ctx = new InitialContext();
| } catch (NamingException e) {
| throw new ServiceLocatorException(Unable to create
AbstractJndiLocator; + e.getMessage(), e);
| }
| }
|
| /**
| * If this returns null, caller should deal with it
| */
| public Object lookup(String name) throws NamingException {
| System.out.println(NAME + + ctx.getNameInNamespace());
|
|
|
| to java:MySqlDS. My understanding is that any application should now be
able to look this DataSource up given the correct InitialContext.
View the original post :
http://www.jboss.org/index.html?module=bbop=viewtopicp=3860813#3860813
Reply to the post :
http://www.jboss.org/index.html?module=bbop=postingmode=replyp=3860813
---
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almosthttp://www.thinkgeek.com/sfshirt
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user