jndi

Maintaining JNDI across multiple instances of Tomcat

I am wondering how people manage maintaining JNDI resources across multiple instances of their Tomcat Application server. Lets take, for example, my database JNDI resource. It is declared within my /conf/context.xml file and references from my apps web.xml file. That JNDI resource has to be independently defined on my development box, s...

How to map a datasource for a java web service

I'm trying to figure out how to use datasources for my web service. I have the oracle-ds.xml deployed on my jboss 4.2.3 server, and the datasources are showing as bounded to JNDI names java:TestDS, java:WeatherDS, etc. I try doing an initialcontext.lookup but I can't find it. I tried referencing the resource in the web.xml but I get "...

Deploying multiple versions of same EJBs and classes to same JBoss server

I have a few separate application projects (EARs) with multiple EJBs that I want to deploy to the same JBoss server. Now, some of the projects may have the same EJBs, but different versions. In similar circumstances, some projects may use different versions of the same "ordinary" classes (i.e. classes loaded within VM, without JNDI looku...

What is stored in the JNDI cache?

We are using WebSphere 6.1 on Windows connecting to a DB2 database on a different Windows machine. We are using prepared statements in our application. While tuning a database index (adding a column to the end of an index) we do not see the performance boost we saw on a test database with the same query, after changing the index the pr...

How to initialize JNDI in struts to use Java Persistence?

We have two applications a legacy struts app and and a new Seam application. We are using Hibernate and JPA on the Seam side and want to try to do so on the Struts side. I am trying to do: EntityManagerFactory emf = Persistence.createEntityManagerFactory("foo"); on the struts side, but I am seeing the following error: o...

How to Create Data Source without Pooling in Tomcat

I use JNDI context to create datasource for JDBC drivers in Tomcat's context.xml file like this, <Resource name="db/test" type="javax.sql.DataSource" driverClassName="com.test.jdbc.Driver" url="jdbc:fastdb://localhost:3306/session_db?autoReconnect=true&amp;connectTimeout=5000&amp;socketTimeout=5000" ...

Tomcat-6.0.18, expanded directory structure, datasource in context.xml

Environment: Tomcat-6.0.18 Oracle-Db JDK-1.6.0_1 -1- context.xml i a war file - works fine my-application.war/META-INF/context.xml: <Resource auth="Container" driverClassName="oracle.jdbc.OracleDriver" maxActive="5" maxIdle="1" maxWait="-1" name="jdbc/dataource-name" password="pwd" type="javax.sql.DataSourc...

JMS without JNDI?

We are running portlets in WebSphere 6.01, using Java 1.4. We want to send JMS messages to a JBoss 5 queue, running Java 5 (or maybe 6, but it's certainly newer than 1.4). Trying to connect using JNDI is not working, since we have to include the JBoss client jars in the classpath of the portlet, and they are Java 1.5. So I get an unsuppo...

How to get hibernate-entitymanager to work with JTA out of JBoss?

I am building a tool for out-of-container EJB testing. I have managed to run Hibernate's EntityManager in it successfully. Now I want to integrate it with JTA to enable strict control of transactions. The problem I am faced with is the following: Hibernate seems to require JNDI to work correctly with JBossTS (JBoss's JTA implementation)...

How to initialize ConnectionFactory for remote JMS queue when remote machine is not running?

Using JBoss 4.0.5, JBossMQ, and Spring 2.0.8, I am trying to configure Spring to instantiate beans which depend on a remote JMS Queue resource. All of the examples I've come across depend on using JNDI to do lookup for things like the remote ConnectionFactory object. My problem is when trying to bring up a machine which would put messag...

Do I need a synchronized Map in implementing the EJBHomeFactory Pattern?

When you want to call an EJBBean from the client, first you need to get hold of an EJBHome object reference through JNDI lookup. This code needs to be executed each time you need to work with the EJBBean so is gets redundant and expensive. To solve this problem, you can cache the EJBHome object references and reuse them again and again...

Why is my JNDI lookup for a QueueConnectionFactory returning null?

I am trying to look up a QueueConnectionFactory and Queue via Geronimo's JNDI. The Queue gets returned fine, but the QueueConnectionFactory lookup always returns null. It doesn't throw a NamingException, which is what I'd expect if the JNDI name was incorrect. Can anyone see what I'm doing wrong? The test code below outputs: true fals...

Do Tomcat JDBC Connection pools get shared between instances?

We have a web application right now that we deploy a copy for each client. Our current deployment strategy is to create a uniquely named jdbc connection pool for each instance. so say jdbc/client. They are specified like this... < Context path="/" reloadable="true" docBase="\home\client\ROOT" debug="5" > ...

Resolve JNDI lookups from Spring application context?

In our Spring application we use clustered Hibernate Search with ActiveMQ which sets up some objects via JNDI. These objects are configured via the Spring application context and I am looking for a way to resolve JNDI calls to these objects. All I could find was the JNDI lookups from the Spring context. We need it the other way around...

Why does calling close() on an InitialContext break JNDI for all future lookups (Glassfish)?

The second JNDI lookup in the code below fails with an exception when running as a standalone application against Glassfish (which has been configured to expose a QueueConnectionFactory and a DataSource via JNDI). However, the code works fine when the line jndiContext.close() is removed. In the real code, the call to close() is being ma...

Can I use ObjectChangeListener to listen for changes on any object?

I've got an Integer called x; if it changes then i would like to update my table in a GUI. To listen to "x" I have tried ChangeEvent y = new javax.swing.event.ChangeEvent(x); and I implement javax.naming.event.ObjectChangeListener: class HDIManagementView extends FrameView implements ObjectChangeListener, ActionListener, T...

What is the purpose of JNDI

How can you realize the usage of JNDI , with an example if possible? ...

Apache Tomcat: adding/deleting/editing JNDI resources

Is there a facility in Tomcat (version 6) to add/delete/edit JNDI resources? If it's possible, how would I update a JDBC data source (as an example)? Note that I'm looking for a possibility to update a JNDI resource without redeploying an application. Apparently Glassfish let's you do this, unfortunately using another application server...

JNDI lookup when two WAS profile share same machine

Hi, I have two profiles in my machine and in one profile I have deployed an EJB which can be looked up from a POJO in another profile. But the profile from which I am doing the lookup ends up doing the lookup in its own node. If I deploy this two application in two different machine I can perform the lookup. Some one has told me that cr...

GWT 1.7 - Configuring a DataSource in Jetty (Hosted Mode)

Hello, I'm new to GWT (1.7) and tried to establish a connection to my MySQL database from the servlet. Because I got some errors, I googled them and found out, that I have to configure a DataSource in Jetty to get it working in Hosted Mode. I followed this tutorial: Tutorial I created my own JettyLauncher class as described and added th...