jndi

Using JNDI for distributed configuration

We're looking at how to do distributed configuration within our primarily Java based deployment. We have a number of applications and it makes sense to centralise the configuration of the applications. JNDI appears to be the standard choice, probably backing off to something like ApacheDS (that way we can store non Java config in there a...

How to use Java to connect to JBossMQ server by JNP Protocal?

I would like to create java client project to connect to JBossMQ server by use JNP Protocal. but It have error "org.jboss.jms.exception.MessagingNetworkFailureException " when it start to create connection. Could you help me by give any suggestion or guide me to any resource? I think it has some point I'm missing but I can't recognize....

jndi encoding in url

i've the following in my context.xml <Resource name="jdbc/SomeDataSource" auth="Container" type="javax.sql.DataSource" username="foo" password="bar" driverClassName="net.sourceforge.jtds.jdbc.Driver" url="jdbc:jtds:sqlserver://localhost:1433/MyDatabase" initialSize="100" maxActive="500" maxIdle="50" min...

How do I run range queries on LDAP

I am trying to retrieve data about groups on LDAP. As I need to paginate results, I need to run range queries. My setup uses JNDI to connect to LDAP. I am trying to run this query (&(objectclass=group)(range=1-500)) What am I doing wrong? I know there are range based queries for LDAP,how do I modify this query for get the same? ...

Glassfish v3 / JNDI entry cannot be found problems!

I've been having problems trying to call an EJB's method from a Java Application Client. Here is the code. EJB Remote Interface package com.test; import javax.ejb.Remote; @Remote public interface HelloBeanRemote { public String sayHello(); } EJB package com.test; import javax.ejb.Stateless; @Stateless (name="HelloBeanExamp...

Storing properties in JNDI? Environment specific locations.

I want access to a storage folder but its actual location can vary with environments. Could I store properties into JNDI or do something similar to a datasource in JBOSS? How would I go about it? Thanks. ...

Weblogic: Call DB2 stored procedure without schema name (property currentSchema)

Hello, I have a Java application that runs on Weblogic. The application needs to access a stored procedure in a DB2 data base, therefore a JDBC data source is configured and accessed by its JNDI name. Data source: ClassDriver: com.ibm.db2.jcc.DB2Driver Properties: user=MYUSER DatabaseName=MYDB The following example works as expecte...

Java, LDAP, ADAM - How do I create a container with a forward slash in the name

Hi, I am having trouble writing some Java code, which will create a container/folder in ADAM, where the container name and distinughed name contain a forward slash. e.g. cn=test/test dn=CN=test/test,CN=TestStore,DC=MyCompany,DC=COM LdapContext _ctx = getNewContext(valid_userName, valid_userName, valid_userName); // uses Initi...

Need help understanding JNDI and a particular ClassCastException in J2EE

Hi! I have an enterprise application A and B deployed (in WLS 10.0). A is the "framework", B is a client app. The client issues the following calls: Object o = ctx.lookup(jndiName); // line 1 cf = (ConnectionFactory) o; // line 2 ConnectionFactory is an interface, defined as: public interface ConnectionFactory extends java.io.S...

Space in search base OU causes error in Active Directory

Recently, while putting together some code to page Active Directory results beyond sizeLimit=1000, we ran into a strange behavior/bug of AD. Specifically, if we had an OU with a space in the search base, it caused an error: String base = "OU=Area X,OU=myserver,DC=my,DC=ad,DC=myserver,DC=com"; env.put(Context.PROVIDER_URL, "ldap://my.ad....

Commons configuration - JNDIConfiguration - How to?

I usually use Commons Configuration for manage my applications configs. I have used properties files configuration. Now I'm interested in using a JNDIConfiguration but I'm not able to understand how this works reading the documentation or googling it. Contextualizing, I'm working in webapps running in an JBoss AS. Where will be the pro...

JNDI Obtain the size of a LDAP search without retrieving all the data

I need to know how many users and groups are in my LDAP directory. The search looks fairly simple: (| (objectClass=group)(objectClass=user)) The problem is that the API is very limited. I can only get a NamingEnumeration<SearchResult> and it doesn't have a count. I didn't find any functions we can use, like the count in SQL. Is th...

Object reference lookup from JNDI results in ClassCastException

I'm having problems calling EJB3 stateless bean outside the container. Code for getting the object reference: Context envCtx = (Context) context.lookup("ejb"); MyObject o = (MyObject) envCtx.lookup(MyObject); The second row results in exception: java.lang.ClassCastException: javax.naming.Reference I use JBoss.org 5.1.0 GA. Based ...

EJB JNDI lookup from GWT development mode into glassfish v3

Hi! I am trying to perform a JNDI-lookup from within the GWT devmode. I have a local glassfishv3 running the EJBs I want to look up. If i deploy the GWT-Webapp into said glassfish everything works as expected. But if I try to look up the EJBs from within devmode I get this Exception: javax.naming.NamingException: Lookup failed for 'my...

iBatis 3 - JNDI configuration example

The iBatis framework has been significantly tweaked between versions 2 & 3, so much that even the config file (now often referred to as MapperConfig.xml) is different. That being said, there are lots of examples online on how to create a JDBC connection pool with iBatis, but I couldn't find one example on how to do it with JNDI. There ...

LDAP: using a filter to avoid a sub CN in Active Directory

I am trying to query nearly all users in Active Directory. My normal users are in various OUs, and I want to retrieve those. But my system users are stored in the Users CN, and I don't want to retrieve those. It looks a lot like another question, but their answer didn't help me. I'm using the hint provided here, but its not helping out ...

JNDI Access from a Django app on Jython

Is it possible to access a JNDI value from Tomcat's config from a Django app running on Jython? My config has a web service URL, accessible via JDNI, that I need to get into the Django App at runtime. It's not a database connection, it's just the URL to a web service deployment. It might or might not be on the same Tomcat instance. ...

JNDI over HTTP on JBoss 4.2.3GA

I've got a remote server on eapps.com that I'm using as my "production" server. I have my own computer at home that I'm using as my "development" server. I'm trying to use JNDI over HTTP to do some batch processing. The following works at home, but not on the eapps machine. I'm connecting to some EJBs (stateless session), and have my jn...

JNDI Add Users to Groups with ADS

We have been trying to add users to groups using JNDI. Our directory server is Active Directory on Windows 2003. We were able to create users and groups just fine. However, making these users part of any group is a problem. Here is what the code looks like (inspired by this): ModificationItem mod[] = new ModificationItem[1]; mod[0] = n...

Common JNDI resources in Tomcat

Hi, I’m running a couple of servlet applications in Tomcat (5.5). All of the servlets use a common factory resource that is shared out using JNDI. At the moment, I can get everything working by including the factory resource as a GlobalNamingResource in the /conf/server.xml file, and then having each servlet’s META-INF/context.xml file ...