jndi

Using bonecp as Tomcat 5.5 datasource

与世无争的帅哥 提交于 2019-12-07 09:09:00
问题 I try to get Tomcat to use BoneCP as a connection pool because DBCP doesn't work correctly here. I tried to add it to the context.xml that defines my webapp like this: <Context path="/reports" privileged="true" crossContext="true"> <Resource name="jdbc/IKOffice" type="com.jolbox.bonecp.BoneCPDataSource" auth="Container" username="ik" password="******" jdbcUrl="jdbc:postgresql://localhost:5434/IKOffice_Core" lazyInit="true" partitionCount="1" ... more properties ... logStatementsEnabled="false

Forward slashes in the names returned by JNDI query to LDAP server

心不动则不痛 提交于 2019-12-07 08:32:13
问题 I need to make several queries to LDAP directory server and I'm using JNDI directory facilities for it. Then I need to do some work with the objects from the query result using their distinguished names. Some of the entries returned by the server contain forward slash character, and because of this JNDI escapes the whole name with double quotes: NamingEnumeration<SearchResult> results = dirContext.search(queryRoot, queryFilter, controls); for (SearchResult result : Collections.list(results))

How to Create Data Source without Pooling in Tomcat

余生颓废 提交于 2019-12-07 07:26:26
I use JNDI context to create datasource for JDBC drivers in Tomcat's context.xml file like this, <Resource name="db/test" type="javax.sql.DataSource" driverClassName="com.test.jdbc.Driver" url="jdbc:fastdb://localhost:3306/session_db?autoReconnect=true&connectTimeout=5000&socketTimeout=5000" zeroDateTimeBehavior="convertToNull" username="dbuser" password="password" maxActive="100" maxWait="2" removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true" /> By default, Tomcat will use DBCP data source factory and created pooling data sources. The specific database and driver we use

How to configure JNDI Realm with Tomcat 7 for PKI User Certificate Authentication?

社会主义新天地 提交于 2019-12-07 07:23:26
List, I have actually searched extensively on this topic and either a) I don't know how to configure something and/or b) I don't quite understand what a JNDI Realm actually is supposed to do. I am using Tomcat 7.0.32 with jdk 1.7.0_15. Here is what I want to do. I work with customers that use PKI User Certificates. The user certificates have a cn like "Joe Smith". What I need to be able to do is look up this CN in LDAP and get the users id, which may be something like "jsmith23", and populate the Principal user in the request header. The reason for this is I have an application deployed in

What do I need to do to integrate JTA into a Java SE application?

安稳与你 提交于 2019-12-07 07:04:54
问题 Suppose I want to implement an application container. Not a full-on Java EE stack, but I need to provide access to JDBC resources and transactions to third party code that will be deployed in an application I'm writing. Suppose, further, that I'm looking at JBossTS for transactions. I'm not settled on it, but it seems to be the best fit for what I need to do, as far as I can tell. How do I integrate support for providing connection resources and JTA transactions into my Java SE application?

Autowire JNDI Resource in Spring

こ雲淡風輕ζ 提交于 2019-12-07 06:36:56
问题 I would like to know how to autowire JNDI resource in Spring controller using annotation. Currently I can retrieve the resource using <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="my/service"/> </bean> Is there any way, I can do the same thing using annotation? Something like @Resource(name="my/service") ? 回答1: I use this configuration to inject a JNDI resource spring config <?xml version="1.0" encoding="UTF-8"?> <beans xmlns=

How to do jndi lookup of MQ connection factory defined in Websphere app Server from Spring

纵然是瞬间 提交于 2019-12-07 04:45:17
问题 I am trying to connect to a MQ connection factory defined in Websphere app Server 7.0. But I couldnt find a right connectionfactory interface for the MQ to define in Spring. However when I tried to hardcode the connection details in the spring config file, I am able to connect to the Queue Manager. What is the right interface/format to use in Spring beans to load the MQ connection factory defined in Websphere appl server? Working Code <bean id="mqConnectionFactory" class="com.ibm.mq.jms

Getting Internal Attributes of LDAP Object

扶醉桌前 提交于 2019-12-07 03:16:37
问题 I am trying to fetch LDAP User internal attributes, but couldn't find how to fetch them DirContext ctx = this.getDirContext(); List<Employee> list = new ArrayList<Employee>(); NamingEnumeration<SearchResult> results = null; try { SearchControls controls = new SearchControls(); controls.setSearchScope(SearchControls.SUBTREE_SCOPE); results = ctx.search("", "(objectclass=person)", controls); while (results.hasMore()) { SearchResult searchResult = results.next(); Attributes attributes =

How does java LoginContext.login() work?

为君一笑 提交于 2019-12-07 02:22:48
问题 I have this code to create a configuration of a java client to connect to a JBoss application server: System.setProperty( "java.security.auth.login.config", "auth.conf" ); LoginContext auth = new LoginContext( "myAuth", new LoginCallbackHandler( username, password ) ); auth.login(); The file auth.conf contains the following lines: myAuth { org.jboss.security.ClientLoginModule required; }; Now, somewhere else in the code (the LoginContext auth isn't known there) I have an EJB that does a

Java EE Exception: Name java:comp is not bound in this Context

亡梦爱人 提交于 2019-12-07 02:07:42
问题 I have the Java EE app in Netbeans 7.2.1. Trying to deploy it (building ends OK), I get the error in Tomcat log: Caused by: javax.naming.NameNotFoundException: Name java:comp is not bound in this Context at org.apache.naming.NamingContext.lookup(NamingContext.java:770) at org.apache.naming.NamingContext.lookup(NamingContext.java:153) at javax.naming.InitialContext.lookup(InitialContext.java:392) at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154) at org