jndi

Tomcat: what is the init context params to use for making an external client connection to Tomcat 5.5 JNDI tree?

懵懂的女人 提交于 2019-12-04 04:21:03
问题 Currently I am using this for JBoss, but I need something also for an external Tomcat: Properties props = new Properties(); props.put(Context.PROVIDER_URL, "jnp://localhost:1099"); props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming.client"); props.put("j2ee.clientName", "abtest"); Searching with Google I find this ones, but I am not able to figure out what Tomcat's port configuring to accept JNDI

Can I make a WAR depend on a JNDI entry in JBoss 5.1?

≯℡__Kan透↙ 提交于 2019-12-04 03:44:09
问题 As part of an upgrade from JBoss 4.0.4 to 5.1, I am trying to get a WAR to deploy after an EAR is successfully deployed. JBoss 5.x does not support PrefixDeploymentSorter like 4.x did, which means that I have to use <depends> in the WAR's jboss-web.xml. It seems I cannot depend on the EAR itself, so I pick the last deployed EJB instead. This EJB provides a JNDI entry that the WAR needs. Here's the EJB as it deploys when the WAR is absent from the deploy directory: 2010-03-25 10:47:30,348 INFO

Is javax.naming.InitialContext ThreadSafe

房东的猫 提交于 2019-12-04 02:33:32
Currently I am use following code to lookup EJB3 sateless session beans for normal POJO class. (We are in JEE5 so we can not inject Stateless Session Beans in normal POJO class I have to use look up) import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import org.apache.log4j.Logger; public Object getEJB(String jndiName) { logger.debug("WEBSPHERE EJB Lookup : " + jndiName); String modifiedJndiName = ""; Hashtable<Object, Object> properties = new Hashtable<Object, Object>(); properties.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere

JNDI lookup works fine using lookUp but not when used in persistence.xml of JPA

大城市里の小女人 提交于 2019-12-04 01:14:19
I am using tomcat connection pool, jpa, hibernate. The datasource i created in context.xml of tomcat works fine if I try to get it using : source = (DataSource) ((Context) c.lookup("java:comp/env")).lookup("jdbc/kids"); but if i specify this jndi datasource in persistence.xml <persistence-unit name="kids-tomcat" transaction-type="JTA"> <jta-data-source>jdbc/kids</jta-data-source> </persistence-unit> I am getting following exception: org.hibernate.service.jndi.JndiException: Unable to lookup JNDI name [jdbc/kids] Any idea why it could happen ! Finally it worked today after i specified the

Should I close JNDI-obtained data source?

谁说我不能喝 提交于 2019-12-04 00:53:51
问题 Update: Apparently Tomcat, starting with 7.0.11, closes the DataSource for you, so it's not available in the webapp's contextDestroyed. See: https://issues.apache.org/bugzilla/show_bug.cgi?id=25060 Hi, I'm using Spring 3.0 and Java 1.6. If I get a data source this way: <bean id="dataSource" class="my.data.Source" destroy-method="close"> <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/> <property name="url" value="jdbc:oracle:thin:@localhost:1521:home"/> <property name

JNDI with Active Directory PartialResultException

早过忘川 提交于 2019-12-03 23:22:59
I am basically walking the LDAP tree in Active Directory. At each level I query for "(objectClass=*)" . When I do this on the root eg "dc=example,dc=com" I get the exception below. This works fine on our other LDAP instances. For some reason only on our Active Directory server I get this exception. I also get the same exception when using JXplorer on our Active Directory server. From reading around online I found people saying you should turn on following, not sure what that means... So on my controls object ( javax.naming.directory.SearchControls ) that I pass with the query I call

jndi LDAPS custom HostnameVerifier and TrustManager

时光毁灭记忆、已成空白 提交于 2019-12-03 18:05:28
问题 We are writing an application that shall connect to different LDAP servers. For each server we may only accept a certain certificate. The hostname in that certificate shall not matter. This is easy, when we use LDAP and STARTTLS, because we can use StartTlsResponse.setHostnameVerifier(..-) and use StartTlsResponse.negotiate(...) with a matching SSLSocketFactory . However we also need to support LDAPS connections. Java supports this natively, but only if the server certificate is trusted by

java.sql.SQLException: Connection has already been closed

拥有回忆 提交于 2019-12-03 17:25:21
We are getting java.sql.SQLException: Connection has already been closed. exception intermittently while performing a transaction. We are using tomcat 7.X and below is the configuration. <Context docBase="ROOT" reloadable="true" antiJARLocking="true"> <Resource name="jdbc/DS" auth="Container" type="javax.sql.DataSource" driverClassName="org.postgresql.Driver" url="jdbc:postgresql://XXXXXXX" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" username="XXXXXX" password="XXXXXX" maxActive="20" maxIdle="3" minIdle="3" maxWait="10000" removeAbandoned="true"/> </Context> Probably we are missing

JndiException when using Hibernate 4.0 with Tomcat 7 when using persistence.xml

谁说胖子不能爱 提交于 2019-12-03 15:30:50
I'm using Hibernate 4.0 with a JPA persistence.xml file on Tomcat 7. No Struts, just straight Hibernate with some Jersey services. Here is the exception I'm running into: Caused by: org.hibernate.service.jndi.JndiException: Unable to lookup JNDI name [jdbc/MyDB] at org.hibernate.service.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:68) at org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl.configure(DatasourceConnectionProviderImpl.java:116) at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java

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

人盡茶涼 提交于 2019-12-03 14:56:06
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 expected. Context env = null; DataSource pool = null; Hashtable ht = new Hashtable(); ht.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); ht.put(Context.PROVIDER_URL,"t3://myserver:7777"); env = new InitialContext(ht); pool = (DataSource) env.lookup(