jndi

JBoss Class cast exception while accessing EJB3

Hi Java Gurus, I am having a weird problem here with EJB3. Deployed and EJB3 and am trying to access the business method from the deployed instance. I get the following error when the lookup is executed: UserAuthenticationRemote is the remote i/face UserAuthenticationBean is the Bean Code (which fails): UserAuthenticationRemote rem...

ejb lookup failing with NamingException

I've added the following in my web.xml: <ejb-ref> <ejb-ref-name>ejb/userManagerBean</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <home>gha.ywk.name.entry.ejb.usermanager.UserManagerHome</home> <remote>what should go here??</remote> </ejb-ref> The following java code is giving me NamingException: ...

Persisting byte array on the JNDI tree in JBoss

As part of a Java EE application I'm developing on JBoss, I need to persist the contents of a file on the JNDI tree. I'm doing this by reading the contents of the file into a by byte array, then binding it to JNDI as follows. getInitialContext().rebind("customers_datafile", byteArray); This works fine, but the binding is lost when th...

can not import inbuilt java class file (javax.naming.ldap.SortControl)

I have downloaded Openfire sources and started to run it on Eclipse. I got a error saying javax.naming.ldap.SortControl class is not there, as illustrated on the following image: . Since it is inbuilt Java class , what can i do to solve this problem. Full source has about 5 error messages, all of them are saying the same. ...

JNDI lookup of EJB3 inside an EAR file on Glassfish

I have an EAR file with a bunch of JARs in it, and one of these JARs contains Local Session Beans (EJB3). I need to perform a JNDI lookup of these Session Beans from within an unmanaged POJO, also contained in the EAR (and in this case in the same JAR as the EJBs as well). I tried following the Glassfish EJB FAQ, but I keep on receiving ...

NoInitialContextException errorI

I am writing a client for my EJB and when trying to execute it, I get the following exception : javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file. I just can't understand what the problem is. I've been at this f...

Accessing a Queue from standalone code

I have a Queue configured in the Rational Application Developer for WebSphere, using a "V5 default messaging provider" and a Websphere6.1 I now try to access it using a standalone app (JUnit Test), in order to put some messages in it. I currently use the following code: Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTE...

What are the JNDI dependencies?

Hi, we are wanting to use a JNDI service with our client applications (all written in Java SE 6) and here is our doubt: what are the dependencies? Does the JVM already comes with all the classes that we'll need to access these services? If not, where can we get them? ...

jndi.properties in JBoss and GlassFish deployment

Currently an EJB / Web Application project uses a JBoss-specific JNDI configuration file, placed either in the conf directory or in the Jar file (both works fine). How can I make this project portable between JBoss (4.2.3 or 5) and GlassFish 3? Is there a recommended way to set different JNDI configuration parameters depending on the co...

Java connection pool without JNDI?

Hi, I've a connection pool to access a MySQL DB from a servlet. I get the data source using a JNDI, which is defined on my META-INF/context.xml file. Everything is working fine, but I have to place the MySQL driver JAR within Tomcat's /common/lib folder, instead of webapp's WEB-INF/lib; otherwise the JNDI will not work (ClassNotFoundEx...

[Geronimo 2.1] add a Queue JNDI ref in ejb-jar.xml? sending JMS Msg in a EJB/MDB

hi, I have an EAR application which contains an MDB and a WAR. In this EAR application I would send a message into an another Queue from other EAR application. Say jms/anotherQueue If the message sending happens in web context, it works. I have such setup in web.xml <message-destination-ref> <message-destination-ref-name>jms/another...

Out of container JNDI data source

I would like to configure a DataSource using JNDI in a Java SE app. What is the best way to do this? So far, I've come across 2 projects: Apache Naming. The project page has a specific example for configuring a data source, but it looks like the project is super old and no longer active. JBossNS. It looks like it's easy to configure a...

Problems using eclipse Hibernate plugin - could not locate sessionfactory in JNDI

Hi Guys, I'm using the reverse engineering capabilities built into the eclipse hibernate plugin to generate dao's and hbm.xml files for each table. It does it quite well but when I try to use the generated Objects I get a Could not locate SessionFactory in JNDI error. I saw a post that suggested this happens when you name your Session...

Accesing an remote enterprise bean within a simple Java class

Here's my Java class import endpoint.NewSessionRemote; import javax.naming.Context; import javax.naming.InitialContext; public class HelloClient { public static void main(String[] args) { try { Context ctx = new InitialContext(); NewSessionRemote hello = (NewSessionRemote) ctx.lookup("endpoint.NewSe...

Nexus and LDAP - JNDI-Problem while authenticating users against OpenLDAP Server

I am using Nexus repository manager (nexus.sonatype.org) with the open source LDAP plugin (code.google.com/p/nexus-ldap/) and I get an error indicating that the wrong protocol version is used (details below). All the plugin does is using the JNDI LDAP service provider to connect to my LDAP Server. If you look at the stack trace in the ne...

Making .NET configuration environment-neutral

I want to get some thoughts on best practices around making .NET app configuration environment-neutral. Background. Some background first. I come from the Java world, not the .NET world, and in Java there are certain things that we can do to build packages that are environment-neutral. They are generally based on abstracting the configu...

JNDI and javax.sql.DataSource

I'm someone that used to do some J2EE coding in the past and I'm coming back into the fold to work on a new J2EE project. A lot has changed since 2001, so I need to ask this very basic question. I'm using syntax like this in my database class: @Resource(name = "jdbc/MyDatabase") private javax.sql.DataSource dataSource; I understa...

Testing ServiceLocator using JUnit

This is a follow up question to my previous question. I am trying to write test case for my ServiceLocator class but it gives me the following error: com/iplanet/ias/admin/common/ASException java.lang.NoClassDefFoundError: com/iplanet/ias/admin/common/ASException at java.lang.ClassLoader.defineClass1(Native Method) My test ca...

how to create initialcontext to connect to sql server

I am having difficulty connecting my java code to sql server database. I can connect from App server just fine..but now I want to try to connect with app server out of the picture and using InitialContext with some env properties. So a stand alone java class connecting to sql server using InitialContext I have mssqlserver.jar in my pro...

JNDI Names -- Is Prefix "jdbc/" needed?

What's up with JNDI names? I'm trying to get a javax.sql.DataSource using the new annotations feature of Java 5. It's not working for me, so I want to ask... I have a in my web.xml, inside of it is an element. I'm switching between "jdbc/MyDB" and "MyDB". Neither makes my class-based DataSource work (it's always null) but in another e...