jndi

What is the purpose of JNDI

£可爱£侵袭症+ 提交于 2019-11-28 02:47:32
How can you realize the usage of JNDI , with an example if possible? JNDI is the Java Naming and Directory Interface. It's used to separate the concerns of the application developer and the application deployer . When you're writing an application which relies on a database, you shouldn't need to worry about the user name or password for connecting to that database. JNDI allows the developer to give a name to a database, and rely on the deployer to map that name to an actual instance of the database. For example, if you're writing code that runs in a Java EE container, you can write this to

Getting org.hibernate.exception.JDBCConnectionException: could not execute query even through JNDI

我的梦境 提交于 2019-11-28 01:56:22
问题 I use Struts2+JSP+Tomcat6+Hibernate+Mysql as my J2EE application framework.Following to this topic, I've had the problem of getting this error: org.hibernate.exception.JDBCConnectionException: could not execute query It appears to be due to the fact that mysql closes it's connections after n hours. As people answered there I changed the hibernate config to get my db connections through JNDI.here is the course of actions which I've taken to do this: my hibernate.cfg.xml: <hibernate

Trying to configure LDAP as JNDI Resource in Tomcat

笑着哭i 提交于 2019-11-27 23:10:27
I have an ldap server that I'm using to authenticate users within a tomcat web application. I'm using the JNDIRealm and it's configured within a context file and this works great. I'll also need to search the ldap for user information. I've figured out how to do this with the "jndi method" and I have it working fine outside of tomcat by creating my own jndi context using a hashtable. However, instead of configuring the jndi properties in code, I'd like to create a JNDI Rsource in my context file right next to the Realm configuration. I'm thinking I would do something like this: <Resource name=

how to put(bind) object to jndi in spring declaratively?

落爺英雄遲暮 提交于 2019-11-27 23:06:49
We have a plain standalone spring application and we need to put jdbc datasource in jndi. (we use jboss treecache and it need datasource to be in the jndi). Some googling found most of all jndi-lookup examples with spring, where an object is already put in jndi (by tomcat or application server etc), but we need otherwise: I have a plain datasource Spring bean, which I inject to other services, but I can't inject it to TreeCache, because it needs it only from jndi. Found org.springframework.jndi.JndiTemplate , which can be declared as bean, e.g.: <bean id="fsJndiTemplate" class="org

Jmeter-JMS Test Plan

杀马特。学长 韩版系。学妹 提交于 2019-11-27 21:24:03
参考:https://blog.csdn.net/fanxiyanhong/article/details/51479532 https://www.cnblogs.com/Owen-ET/p/8986348.html#no0 MOM 作为消息数据交换的平台,也是影响应用执行效率的潜在环节。在 Java 程序中,是通过 JMS 与 MOM 进行交互的。作为 Java 实现的压力测试工具,JMeter 也能使用 JMS对应用的消息交换和相关的数据处理能力进行测试。这一点应该不难理解,因为在整个测试过程中,JMeter 测试的重点应该是消息的产生者和消费者的本身能力,而不是 MOM本身。 JMS提供了两种消息通信模型: Ø 点到点(P2P)模型 Ø 发布/订阅(Pub/Sub)模型 在ClientA、C、D之间的消息是点对点模型,使用这种模型,客户端发送消息到队列目的地(Queue),从这个队列里面只有一个消息接收者可以收到那个消息,其他访问同一目的地的接收者不会接收到该消息。如ClientC接收Queue中的Msg1消息,ClientD接收Queue中的Msg2消息。 在ClientB、E、F之间的消息是发布/订阅模型。使用这种广播模型,一个客户端发送消息给主题目的地(Topic),任何数量的消费订阅者可以从这个主题目的地来接收它们。如

Connection cannot be cast to oracle.jdbc.OracleConnection

大城市里の小女人 提交于 2019-11-27 20:39:27
Why java.sql.Connection cannot be cast to oracle.jdbc.OracleConnection in code below? My main goal is to pass to Oracle connection new user name and save it in 'SESSION' table in for example 'osuser' column because I want to trace in DB user changes and display it in the table. @Repository public class AuditLogDAOImpl implements AuditLogDAO { @PersistenceContext(unitName="myUnitName") EntityManager em; @Resource(name = "dataSource") DataSource dataSource; public void init() { try { Connection connection = DataSourceUtils.getConnection(dataSource); OracleConnection oracleConnection =

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

百般思念 提交于 2019-11-27 18:51:52
问题 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 SessionFactory in the hibernate.cfg.xml file so I removed the name tag and i'm still getting the same error. This is my hibernate.cfg.xml <?xml version="1.0" encoding="utf-8"?>

Code to list all the entries in jndi on remote machine

让人想犯罪 __ 提交于 2019-11-27 17:41:50
Can any one tell or point me to code to list all the jndi entries in a remote machine It is possible to list all entries of an InitialContext. You can use this snippet: InitialContext ctx = new InitialContext(); NamingEnumeration<NameClassPair> list = ctx.list(""); while (list.hasMore()) { System.out.println(list.next().getName()); } If you are using an application server, there is usually the option to browse the JNDI tree. The previous answers didn't give me the "full picture" (on Tomcat7), so I've thrown together the following amalgamation, which converts the JNDI values to a Tree Map (with

How do a LDAP search/authenticate against this LDAP in Java

倖福魔咒の 提交于 2019-11-27 17:03:41
I am playing with LDAP and Java search. Here's my LDIF export with a simple organization version: 1 dn: dc=example,dc=com objectClass: organization objectClass: dcObject objectClass: top dc: example o: MyOrganization description: Test Description dn: ou=people, dc=example,dc=com objectClass: organizationalUnit objectClass: top ou: people description: All users in demo company dn: cn=Johnny Doe,ou=people,dc=example,dc=com objectClass: organizationalPerson objectClass: person objectClass: inetOrgPerson objectClass: top cn: Johnny Doe sn: Johnny homephone: 123-456-7890 mail: johnny@johnny.com ou:

How to activemq in ssl

左心房为你撑大大i 提交于 2019-11-27 16:36:53
问题 I'm trying to send messages via jms (activemq) but I want it to be in ssl protocol. It actuality works in tcp for now. I use jndi, with a virtual topic and 2 queues. Could somebody help me, I tryed this but I get stuck the server won't start : http://activemq.apache.org/how-do-i-use-ssl.html thx edit : The log says : "The reference to entity "needClientAuth" must end with the ';' delimiter." 回答1: I will answer my own question : First of all inside ..../apache-activemq-5.11.1/conf/activemq.xml