jndi

Datasource in jdbc connection pooling not returning connection [duplicate]

牧云@^-^@ 提交于 2019-12-02 10:17:11
This question already has an answer here: Is it safe to use a static java.sql.Connection instance in a multithreaded system? 2 answers I have a jsp web application. I'm using jdbc connection pooling to use mysql database located at the server side. My web application hangs sometimes, when i checked debugging i found that it hangs at ds.getConnection(); It does not return any exception/error. Browser will be simply in loading state. I have included my DBConnection class which i use to create dadasource and getconnection from datasource.I'm calling getConnection(); method to get connection from

java.lang.IllegalStateException: Could not locate SessionFactory in JNDI

笑着哭i 提交于 2019-12-02 10:13:05
Good evening, i get the above exception when using Hibernate with JSF, i saw it many times in the past and the root cause was that like this <session-factory name="sessionFactory"> so i removed the name and change the generated code for creating the SessionFactory from that: protected SessionFactory getSessionFactory() { try { return (SessionFactory) new InitialContext() .lookup("SessionFactory"); } catch (Exception e) { log.error("Could not locate SessionFactory in JNDI", e); throw new IllegalStateException( "Could not locate SessionFactory in JNDI"); } } to that: protected SessionFactory

Change AD user expired password in Java

人盡茶涼 提交于 2019-12-02 10:10:31
I'm using JNDI to change LDAP user's password. In most cases (when user's password isn't expired) this code works just fine: public InitialLdapContext connect(String url, String securityPrincipal, String password) throws AuthenticationException, NamingException { System.setProperty("javax.net.ssl.trustStore", truststore); Properties env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, url); env.put(Context.SECURITY_PRINCIPAL, "EE\\" + securityPrincipal); env.put(Context.SECURITY_CREDENTIALS, password); env.put

How do Migrate Java, Spring Project to use JNDI datasources

馋奶兔 提交于 2019-12-02 09:14:37
I have a Java project that runs from the command line. It is using Spring. At the current time my project is mySQL. Use can see from the config.xml below <bean id="mysqldataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="mysqldataSource.url" /> <property name="username" value="mysqldataSource.username" /> <property name="password" value="mysqldataSource.password" /> </bean> My firm is asking me to change the project from using MySQL to use a JNDI Data source. Below is my

JNDI No EJB receiver available for handling

别来无恙 提交于 2019-12-02 08:55:56
I have a problem with my EJBTest. I have installed WildFly and configured user management and application management. I wrote an EJB 3.0 and deployed it: @Stateless @Remote(NewSessionBeanRemote.class) public class NewSessionBean implements NewSessionBeanRemote { List<String> bookShielf; /** * Default constructor. */ public NewSessionBean() { bookShielf = new ArrayList<String>(); } @Override public void addBook(String bookName) { bookShielf.add(bookName); } @Override public List getBook() { return bookShielf; } } Afterwards, I wrote a simple client to connect it: private static void

How to configure a String value in Websphere 7 JNDI?

我是研究僧i 提交于 2019-12-02 06:20:52
问题 In fact I found such message before: Configuring and looking up a simple String via JNDI in WebSphere I want to do the "clean" way (http://www.ibm.com/developerworks/websphere/library/techarticles/0611_totapally/0611_totapally.html). Maybe I am simply too green on WebSphere, my mind is totally messed up by the article because it is showing a more complicated example. Can someone give me a brief steps on how to configure WebSphere so that I can bind a String value in JNDI? Thanks so much 回答1:

JNDI在Spring和tomcat下的使用

好久不见. 提交于 2019-12-02 04:43:52
1. 是什么 JNDI是 Java 命名与目录接口(Java Naming and Directory Interface),在J2EE规范中是重要的规范之一。JNDI 在 J2EE 中的角色就是“交换机” —— J2EE 组件在运行时间接地查找其他组件、资源或服务的通用机制。在多数情况下,提供 JNDI 供应者的容器可以充当有限的数据存储,这样管理员就可以设置应用程序的执行属性,并让其他应用程序引用这些属性(Java 管理扩展(Java Management Extensions,JMX)也可以用作这个目的)。JNDI 在 J2EE 应用程序中的主要角色就是提供间接层,这样组件就可以发现所需要的资源,而不用了解这些间接性。 2. 为何用 程序员可以不用关心“具体的数据库后台是什么?JDBC驱动程序是什么?访问数据库的用户名和口令是什么?”等等这些问题,而是把这些问题交给J2EE容器来配置和管理,程序员只需要对这些配置和管理进行引用即可。 3. 怎么用 3.1 整体思路 在在J2EE容器如Tomcat中配置一个数据源,给这个数据源设置一个名称; 在项目程序中,通过数据源名称引用这个数据源从而访问后台数据库 3.2 示例 下面在Tomcat6.0+spring+springMVC+mybatis项目中演示用法。 Tomcat 方法一:非全局的Resource,只更改context

Connection Azure service bus via Java client

我们两清 提交于 2019-12-02 04:12:26
问题 I am trying to connect Azure service bus from Java client with AMQP protocol I follow the instruction in the following link: http://azure.microsoft.com/en-us/documentation/articles/service-bus-java-how-to-use-jms-api-amqp/ 1) created service bus in Azure portal with the name space ' availo ' and a queue named ' queue1 ' 2) from service bus connection information I've got the following: SharedAccessKeyName=RootManageSharedAccessKey SharedAccessKey={key} 3) created "servicebus.properties" file

Connection Azure service bus via Java client

半世苍凉 提交于 2019-12-02 01:43:04
I am trying to connect Azure service bus from Java client with AMQP protocol I follow the instruction in the following link: http://azure.microsoft.com/en-us/documentation/articles/service-bus-java-how-to-use-jms-api-amqp/ 1) created service bus in Azure portal with the name space ' availo ' and a queue named ' queue1 ' 2) from service bus connection information I've got the following: SharedAccessKeyName=RootManageSharedAccessKey SharedAccessKey={key} 3) created "servicebus.properties" file for the JNDI lookup connectionfactory.SBCF = amqps://RootManageSharedAccessKey:encoded(key)@availo

How to configure a String value in Websphere 7 JNDI?

蓝咒 提交于 2019-12-02 01:28:38
In fact I found such message before: Configuring and looking up a simple String via JNDI in WebSphere I want to do the "clean" way ( http://www.ibm.com/developerworks/websphere/library/techarticles/0611_totapally/0611_totapally.html ). Maybe I am simply too green on WebSphere, my mind is totally messed up by the article because it is showing a more complicated example. Can someone give me a brief steps on how to configure WebSphere so that I can bind a String value in JNDI? Thanks so much Well, assuming that what you want to store is a "configuration" element, I'd actually take the time and