jndi

What is a validationQuery with respect to databases and JNDI?

一曲冷凌霜 提交于 2019-12-18 08:29:09
问题 I seem to be having the same exact problem as the poster of this original SO question. The problem is, he answered his own question with the following comment: I solved my problem, I added a validationQuery to my JNDI datasource. Unfortunately, that doesn't mean anything to me, and doesn't help me solve my problem. So I ask: what is a " validationQuery " with respect to my database (Sybase) and the JNDI entry used to hold the server lookup info? Thanks in advance. 回答1: The validation query is

Portable JNDI Syntax lookup for EJB on Glassfish

为君一笑 提交于 2019-12-18 07:23:19
问题 Previous attempts were to have Netbeans deploy an EJB module, which builds as a JAR rather than an EAR, onto the Glassfish server which Netbeans has access to. However, deploying that JAR to Glassfish through the CLI with asadmin possibly runs into a bug. The EAR deploys through the CLI without issue -- however, the JNDI names for the EJB doesn't appear to work. What is the discrepancy? 32.4.1.1 Portable JNDI Syntax Three JNDI namespaces are used for portable JNDI lookups: java:global, java

Using a JNDI datasource created by another application with Tomcat

天涯浪子 提交于 2019-12-17 20:34:10
问题 I have a .properties file in my application which contains dataSource properties. I set up a JNDI reference to this dataSource using the following code : // first I create MyDataSource from the properties found in the .properties file //then : Context initContext = new InitialContext(); initContext.createSubcontext("jdbc"); initContext.createSubcontext("jdbc/oracle"); initContext.rebind(jdbc/oracle/myDataSource, MyDataSource); If I use a lookup in this application, the dataSource is found :

MongoDb via jndi

为君一笑 提交于 2019-12-17 19:02:22
问题 Do you know if it is possible to setup mongodb instance in spring like any other db via datasource from jndi? Thx 回答1: If you mean like regular RDBMS with JDBC access, then the answer is no. 回答2: Yes it is possible, why relying in someone elses code when you can create your own JNDI factory? just create a class that implements javax.naming.spi.ObjectFactory and a bean that pulls mongo from the JNDI context, I configured this for spring data-mongo MongoTemplate object. public class

Setting up JNDI Datasource in jUnit

让人想犯罪 __ 提交于 2019-12-17 10:49:25
问题 I am trying to set up some jUnit testing. Our database is connected by the server using JNDI. We have an xml describing the setup in root.xml. How do I set up jUnit to hook up to the database? I'd prefer to have it just read the the stuff off of root.xml, but I'm open to setting it up anyway that works. 回答1: I've found this Blog: https://blogs.oracle.com/randystuph/entry/injecting_jndi_datasources_for_junit About H2 Datasource: http://www.h2database.com/javadoc/org/h2/jdbcx/JdbcConnectionPool

Spring的JNDI数据源连接池配置

北战南征 提交于 2019-12-17 10:43:19
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 在使用 Tomcat服务器 + SpringFramework 进行JavaEE项目的开发部署的时候可以在Tomcat的配置文件中进行JDBC数据源的配置,具体步骤如下(这里省略了工程的建立步骤): 1) 添加如下代码到tomcat的conf目录下的server.xml中: Xml代码 <Context> <Resource name="jdbc/demoDB" auth="Container" type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/demo" username="root" password="123" maxActive="50" maxIdle="30" maxWait="10000" /> </Context> 完成上述步骤数据源的连接池配置已经完成,但是为了提高项目的可移植性,最好将上述第二步的内容放入到工程的META-INF目录的context.xml中(这个文件需要自行建立): Xml代码 <?xml version="1.0" encoding="UTF-8"?> <Context> <Resource name="jdbc

Should you set up database connection properties in server.xml or context.xml

帅比萌擦擦* 提交于 2019-12-17 10:08:19
问题 I am trying to set up the database connection properties using JNDI for a Spring web application. I am considering two approaches as below: Approach 1: In your Spring configuration you may have something like: <jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/facs"/> Then in your webapp /META-INF/context.xml file you should have something similar too: <?xml version='1.0' encoding='utf-8'?> <!-- antiResourceLocking="true" --> <Context path="/podd-apn" reloadable="true"

What does java:comp/env/ do?

人盡茶涼 提交于 2019-12-17 07:59:54
问题 I just spent too much time of my day trying to figure out some errors when hooking up some JNDI factory bean. The problem turned out to be that instead of this... <bean id="someId" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="java:comp/env/jdbc/loc"/> </bean> I had actually written this... <bean id="someId" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="jdbc/loc"/> </bean> I infer that the java:comp/env/

Configure hibernate to connect to database via JNDI Datasource

為{幸葍}努か 提交于 2019-12-17 04:46:52
问题 Hi all I'm using Hibernate+Struts2+Tomcat6+Mysql as my J2EE framework. I've been using hibernate's built-in connection pooling mechanism but it turned out to be problematic where mysql closes it's connections after 8 hours. Anyway I googled around a little bit and found that I should get my connections through JNDI datasource but I couldn't reach a good and complete tutorial on this. What steps should I take to do so? please provide me enough of details, I'm kinda new on this. here is my

JNDI does not work with HornetQ and tomcat

坚强是说给别人听的谎言 提交于 2019-12-14 04:18:02
问题 I'm trying running JMS application using hornetq on tomcat! I tried following this article. I put jndi.properties in my client class path; jndi.properties: java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory java.naming.factory.url.pkgs=org.apache.naming I added these dependencies to pom.xml: <dependency> <groupId>tomcat</groupId> <artifactId>naming-factory</artifactId> <version>5.5.23</version> <scope>test</scope> </dependency> <dependency> <groupId>tomcat</groupId>