jndi

SSL connection to ldap using certitificates and custom ssl socket factory

两盒软妹~` 提交于 2019-12-06 12:07:00
问题 This is my scenario , i want to connect to ldap usign jndi , i am using custom SSLSOcketfactory which reads the truststore and keystore . The context is created successful but when i try to authenticate using the same credentials it throws an error telling that the authentication method is not supported. here is my code of the custom ssl socket - try { StringBuffer trustStore = new StringBuffer("c:/Temp/certs/TrustStore"); StringBuffer keyStore = new StringBuffer("c:/Temp/certs/keystore.arun"

How to obtain JNDI data source for JPA/JTA DAO integration test?

假装没事ソ 提交于 2019-12-06 11:58:43
问题 I have a JPA application that has specified JTA transactions in persistence.xml. For whatever reason, I have found that when using JTA, you MUST specify a JNDI data source within persistence.xml as well. This is fine, unless you are trying to go integration testing outside a container and JNDI is not available. My questions are: a) is there anyway to inject a jdbc datasource into my JTA transaction manager? b) if not, how do a handle a JNDI lookup during integration testing? Edit: The error I

How to lookup EJB into WildFly server to a client

六月ゝ 毕业季﹏ 提交于 2019-12-06 09:53:27
问题 I would like to know how to look up a EJB located into a WildFly server from a remote client using JNDI. Here is what I use to initialize the context jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); jndiProps.put(Context.PROVIDER_URL, "http-remoting://192.168.0.15:8080"); jndiProps.put("jboss.naming.client.ejb.context", true); Context ctx = new InitialContext(jndiProps); And this is the console output when I deploy the server: 21:08:29

Does SearchControls.setTimeLimit() handle read timeout?

扶醉桌前 提交于 2019-12-06 09:41:01
I'm having an issue where an LdapContext.search() against a directory will occasionally hang forever. I tried supplying a SearchControls object for which I've called setTimeLimit(10000), but the issue still happens. Given this, my thought now is that the SearchControls object is being used only as an advisory to the server and won't arrange a timeout on the client side read if no packets come back. I looked around but didn't find any wording in the class documentation to explicitly confirm this. Can anyone confirm my guess that SearchControls will not arrange a client side read timeout, and

How can you store credentials in a JNDI lookup?

断了今生、忘了曾经 提交于 2019-12-06 09:35:01
问题 I have an app with several properties files, and I was curious if it'd be easier to store these username / password / server-url-to-login-to combos in a JNDI lookup instead of this clear text file in a .jar. There are a couple questions: Can you store credentials that aren't databases using JNDI? How do you configure a new JNDI resource to store these properties? How would you retrieve these properties from the resource? Most of the documentation I read was how to set up JNDI for database

Can I use JPA by specifing the database during runtime?

最后都变了- 提交于 2019-12-06 08:28:28
I use MySQL on my production server, where every customer has its own database and its own database user to connect to his database. Each database has the exact same structure. Customers (and therefore databases) are added during the lifetime of the server. Currently I establish a MySQL database connection with the class java.sql.DriverManager , which works just fine. The databases url, user, password and driver name are stored in several properties-files. The servlet reads the properties-file from the current customer and creates the java.sql.Connection with the java.sql.DriverManager . I

Java DNSLookup get DNS attributes

笑着哭i 提交于 2019-12-06 08:09:49
I'm quite new to the network DNS records and need a program that can run lookup to get 3 main DNS records of a domain (A,MX,NS). I have been looking for a java solution here an there and my final class is as below: However, I will always get a NameException and can't find the reason for it. [EDIT]: The problem seem to be with our internet, because using other wifi, the program run just fine. Many thanks, import javax.naming.directory.Attributes; import javax.naming.directory.DirContext; import javax.naming.directory.InitialDirContext; import javax.naming.Context; import javax.naming

Jetty Bind DataSource in JNDI Context

安稳与你 提交于 2019-12-06 08:02:18
问题 I would like to bind DataSource object to (eclipse) jetty's JNDI context programatically. I need for testing purpose. Here's a piece of code I have now: server = new Server(SERVER_PORT); webAppContext = new WebAppContext(); webAppContext.setResourceBase("."); webAppContext.setContextPath("/" + SERVER_CONTEXT); webAppContext.addEventListener(prepareServletContextListener()); webAppContext.addFilter(GuiceFilter.class, "/*", null); webAppContext.addServlet(DefaultServlet.class, "/"); Resource r

How to get AD user's 'memberof' property value in terms of objectGUID?

吃可爱长大的小学妹 提交于 2019-12-06 07:54:48
'memberof' is the attribute on the Active Directory user account which describes user's group membership detail. If we use .Net or Java to get the users detail then we get the 'memberof' attribute value in terms of 'Distinguished Name' of the groups of which user is member of. So is there any way to get these group names in terms of objectGUID either in JAVA or .NET ? You can make use of the "Extended DN" LDAP extended control. It can be used only in AD search. C# code: // Here I get the user object and then do a AD search. // Instead, you may search for that user object directly.

Unable to access datasource remotely through JBoss

大憨熊 提交于 2019-12-06 07:20:20
问题 Context I have a JBoss where I have sucessfully deployed a datasource mydatasource-ds.xml . It's JNDI name is java:mydatasourceDS . JBoss claims that the datasource is succesfully deployed. The JMX console agress too. Problem I want to use this datasource from a client java app launched on a separate JVM. But I get an exception saying the java:mydatasourceDS cannot be found. java.lang.ClassCastException: javax.naming.Reference cannot be cast to javax.sql.DataSource Details Here is the