FAQ Database Discussion Community
java,tomcat,datasource,jndi
From JNDI Resources HOW-TO <Context ...> ... <Resource name="jdbc/EmployeeDB" auth="Container" type="javax.sql.DataSource" username="dbusername" password="dbpassword" driverClassName="org.hsql.jdbcDriver" url="jdbc:HypersonicSQL:database" maxActive="8" maxIdle="4"/> ... </Context> The type is javax.sql.DataSource and this is an interface. The code below retrieves an instance of DataSource and get a connection out of it. Context initCtx = new InitialContext(); Context envCtx...
java,ldap,jndi,openldap
I would like to set the relax control (as defined in https://tools.ietf.org/html/draft-zeilenga-ldap-relax-03) on a javax.naming.ldap.LdapContext, but I don't know how to construct the control correctly: LdapContext context = new InitialLdapContext(...); Control[] controls = { new BasicControl(/* What to put here? */) }; context.setRequestControls(controls); ...
java,spring,jdbc,jndi,sqldatasource
I'm getting an error - org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'netLogsDao': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'abcDataSource' defined in com.kinsale.submclrmgr.config.DataConfig: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'abcDataSource' threw...
java,unit-testing,datasource,jndi,dao
I'm doing my project using Tomcat 7, JSP, Servlets, Log4j and MySQL. I've googled this question for hours with no proper answer. How can I test my DAO's using DataSource and JUnit ? I found this article recently, but don't know how to configure it for my purposes and don't...
java,ldap,jndi
I was trying to implement a program to do JNDI lookup for LDAP. I saw there is open source LDAP from Apache viz: apacheds-2.0.0-M20 The below is the program that i wrote: import java.util.Hashtable; import javax.naming.Context; import javax.naming.NamingException; import javax.naming.ldap.InitialLdapContext; import javax.naming.ldap.LdapContext; import javax.naming.directory.InitialDirContext; class JndiLDAPLookup { public static void...
java,ejb-3.0,jndi,wildfly-8,ejb-3.2
@LocalBinding(jndiBinding="sample/student") in EJB 3.0 is used to give preferred JNDI name to EJB bean. And to lookup using defined JNDI name, the code used is Context c = new InitialContext(); studentBean = (studentlBean) c.lookup("sample/student"); How this can be performed in EJB 3.2 as @LocalBinding is not supported in EJB3.2 wildfly...
java,tomcat,jdbc,jndi
Trying to set up a couple of JDBC connections in the context.xml of my tomcat instance but struggling to understand why some names seem to clash. With some combinations of name I get the folllowing: java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp2.BasicDataSource cannot be cast to javax.naming.Context Can someone explain why it doesn't work if...
java,tomcat,jndi
I have tomcat and JNDI point in system. I need to use this point for connecting remote consumers. I read that tomcat doesn't share its JNDI, if so, how to set up a separate JNDI server on my network or is there any way to configure tomcat to share JNDI?...
java,active-directory,ldap,jndi
I added an LDAP entry which has an Attribute given by BasicAttributes basicAttributes = new BasicAttributes(); BasicAttribute basicAttribute = new BasicAttribute("objectclass"); basicAttribute.add("top"); basicAttribute.add("Adapter"); basicAttributes.put(basicAttribute); basicAttributes.put(new BasicAttribute("Name","testname")); basicAttributes.put(new BasicAttribute("Topic", "testtopic")); if (locid.length != 0) { basicAttribute = new BasicAttribute("LocID"); for (int i = 0; i < locationid.length; i++)...
jms,jndi,spring-jms,initial-context
I am trying to connect to MQ using JNDI lookup defined in context.xml of tomcat. While starting the application, i am getting a NamingException and a NullPointer in FFDC. Below is what logged. I am not able to make out what is wrong. Any indication on how to debug this...
java,ejb,jndi,openejb,tomee
I'm trying to integrate TomEE 1.7.2 to an embedded tomcat server instance along with OpenEJB 4.7.2 and OWB 1.2.7. I have created an OSGi bundle which contains them and CXF. I'm trying to test the TomEE integration using the ejb-example which is provided with TomEE. I tested the JNDI dump...
java,spring,tomcat,jndi
I am just configuring tomcat for JNDI using the externalized. I have done some thing wrong, but no clue. In Context.xml <Resource name="jdbc/AppDB" auth="Container" type="javax.sql.DataSource" driverClassName="org.postgresql.Driver" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" url="${app.env.database.url}" username="${app.env.database.user}" password="${app.env.database.password}" maxActive="100" maxIdle="50" minIdle="10" suspectTimeout="60" timeBetweenEvictionRunsMillis="30000" minEvictableIdleTimeMillis="60000"...
java,jndi
I've just started to learn JNDI. As I understood it's an INTERFACE for different naming services. I decided to use it as a registry for objects I have. For example, I have object configuration and I want to get it from another object by JNDI. Of course I could use...
java,authentication,ldap,jndi
I'm using JNDI library to access to an AD from Java Webapp. I authenticate agaisnt the AD via LDAP using a technical user as follows: Hashtable<String, String> ldapEnv = new Hashtable<String, String>(11); ldapEnv.put(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT); ldapEnv.put(Context.PROVIDER_URL, providerUrl); ldapEnv.put(Context.SECURITY_AUTHENTICATION, SECURITY_AUTHENTICATION_SIMPLE); ldapEnv.put(Context.SECURITY_PRINCIPAL, principal); ldapEnv.put(Context.SECURITY_CREDENTIALS, credentials); return new...
java,jndi
I am trying to clear my doubts on JNDI by writing some examples, by searching on the net. I came across the following link (tutorial from oracle on this topic) http://docs.oracle.com/javase/jndi/tutorial/getStarted/examples/naming.html In this link, it says: "This example shows you how to write a program that looks up an object...
java,jms,jndi,mq
My question is about the use of the following 2 factories: ConnectionFactory QueueConnectionFactory At the moment I just use a ConnectionFactory to initialize everything: Connection conn = factory.createConnection(user, pw); Session session = conn.createSession() Destination dest = session.createQueue('xyz') ... If I understand correctly, the QueueConnectionFactory works pretty much the same way....
oracle,tomcat7,jndi,liferay-6,portlet
For a Liferay 6.2 custom portlet accessing a non liferay Oracle database we are running into an issue where the data source returned is null. We have configured the tomcat/conf/context.xml <!-- Adding custom New non liferay datasource --> <Resource name="jdbc/NewPool" auth="Container" type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST...
spring,websphere,jndi,websphere-liberty
I'm fairly new with WebSphere (mainly worked with Tomcat) and am trying to host a Struts/Spring/Hibernate website. The website is supposed to be able to look up data from an Oracle database and display that information. I'm currently not able to get the website running and it seems to be...
java,tomcat,jdbc,jndi
I try to configure a jsbc data source for my app within -tomcat_home-\conf\Catalina\localhost My app is "reportExport".war so i created reportExport.xml with this content: <Context> <Resource name="jdbc/mssql" auth="Container" type="javax.sql.DataSource" username="user" password="pass" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://localhost:52015;databaseName=rewe;integratedSecurity=false;" maxActive="20" maxIdle="10" validationQuery="select 1" /> </Context> I added to web.xml...
java-ee,jndi,wildfly,java-ee-7,managedthreadfactory
I'm migrating an old application (uses no beans or dependency injection) from Weblogic to WildFly. For the most part, it now works fine. However, it also creates threads in "traditional way" (new Thread()), and these threads cannot lookup JNDI names, meaning database and mailing is not available to them. It...
java,jdbc,glassfish,jndi,glassfish-4
In Glassfish admin, I setup a JDBC connection pool that I can ping ok. Also in Glassfish admin, I have setup a JNDI JDBC resource called jdbc/myDb However I'm unable to connect to it from Java. I have tried both injection style: @Resource (mappedName="jdbc/myDB") private DataSource datasource; I have also...
cluster-computing,jndi,wildfly,hibernate-search,hornetq
Previously 2 JBoss 6 servers (master & slave) were started with 2 different IP addresses (127.0.0.1 and 127.0.0.2) and those 2 server instances were run in domain mode. The instances used HornetQ to communicate index jobs for Hibernate Search. I'm trying to create a similar configuration using Wildfly instead of...
java,mysql,jndi,wildfly
I have searched for days now and cant get any further. I am trying to assign a MySQL datasource to my Wildfly 9 server via web console. If I add the resource I'll get an error in testing the resource due a bug in wildfly 9 which creates the resource...
java,spring,jetty,jndi,hikaricp
I am using HikariCP 2.3.3 with Spring and Jetty 9 and am trying to resolve the fact that when I hot deploy a new war file, all of the Hikari database pool connections to MySQL are left open and idle. I am using a JNDI lookup in my spring applicationContext...
java,jboss,ejb,jndi,lookup
I try to look up and EJB under jboss EAP6. I have 2 mavenized projects : Interfaces where I have justeinterfaces. Implementations where I have only the implementations of interfaces and my tests classes (I use testNG) My question is: Do I have to deploy on the server the interfaces...
java,jndi
I am new to JNDI and i read the online material by oracle: http://docs.oracle.com/javase/jndi/tutorial/getStarted/overview/index.html It says JNDI has two API's viz: 1) JNDI API 2) JNDI SPI Further, it says to use JNDI we should have JNDI classes as well as Service providers. From what I understand, Service provider is...
database,timestamp,jetty,jndi,hikaricp
I'm trying to connect to multiple data sources by a grails application. What I tried worked in a development environment correctly. Initially there was a timestamp error which got resolved with 'zeroDateTimeBehavior=convertToNull' adding to a url. But now in production environment, I don't understand how to add this variable. My...
jboss,jboss7.x,jndi,jboss6.x,java-ee-7
We migrated from Jboss EAP 5 to EAP 6 in our development environment. I now see the following in my JBOSS logs. I am trying to understand how this binding happens. I have read JBOSS docs on JNDI namespace binding. Still I am not totally clear how it works. Here...
java,jms,activemq,jndi,log4j2
I am struggling to write a simple POC program that logs messages to a Queue. All tutorials and Q&As I find (here and here) use log4j version 1.2 and they put messages onto a Topic and not onto a queue. My requirement is to log to a queue. I followed...
java,mysql,maven,jdbc,jndi
I am not to sure why I am unable to connect to my database. I am using JNDI, and maven to help handle the dependencies. In my context.xml in my server folder in eclipse looks like: Could not get JDBC Connection; nested exception is java.sql.SQLException: Cannot load JDBC driver class...