jndi

What is the difference between mappedName and lookup attributes of @Resource annotation in EJB?

蹲街弑〆低调 提交于 2019-12-22 05:23:36
问题 I'm confused between two attributes of @Resource annotation. Java Documentations says : mappedName : A product specific name that this resource should be mapped to. The name of this resource, as defined by the name element or defaulted, is a name that is local to the application component using the resource. (It's a name in the JNDI java:comp/env namespace.) Many application servers provide a way to map these local names to names of resources known to the application server. This mapped name

Eclipse: Overriding JNDI Resource in Tomcat

匆匆过客 提交于 2019-12-22 05:14:08
问题 I'm working on a Java web application in Eclipse and deploying to an instance of Tomcat that is run by Eclipse. I'm trying to get this application to talk to a database on another host via a JNDI Resource element. The context.xml file included in the application attempts to connect to a MySQL server running on localhost, like so: <?xml version="1.0" encoding="UTF-8"?> <Context> <Environment name="log4j.configuration" value="/path/to/installed/log4j.properties" type="java.lang.String" />

How to specify SSL/TLS version on Java LDAP connection?

久未见 提交于 2019-12-22 01:37:35
问题 Im working on an java LDAP-Client and I'm still missing some information or knowledge on how to do this properly. My Code looks like this: LdapContext ctx = null; Hashtable<String, String> env = new Hashtable <String, String>(); try{ env.clear(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "url"); env.put(Context.SECURITY_PRINCIPAL, "user"); env.put(Context.SECURITY_CREDENTIALS, "password"); env.put(Context.SECURITY_PROTOCOL,

How to lookup ejb on JBoss AS 7.x

*爱你&永不变心* 提交于 2019-12-22 00:17:12
问题 I try ejb lookup for jndi name. That ejb is same jboss server then is success. But ejb is other jboss server then is failed. My source code: Hashtable<String, String> env = new Hashtable<String, String>(); env.put("java.naming.provider.url","jnp://192.168.100.10:8484"); env.put("java.naming.factory.initial", "org.jboss.as.naming.InitialContextFactory"); env.put("java.naming.factory.url.pkgs", "org.jboss.as.naming.interfaces.java"); env.put("java.naming.security.principal", "Admin"); env.put(

@Remote JNDI Communication: Wildfly to JBoss AS 5.1.0.GA

只愿长相守 提交于 2019-12-21 21:03:31
问题 Architecture: Windows Client -> Wildfly JAX-RS Services -> JBoss 5.1.0.GA legacy system. I am getting a java.lang.ClassCastException: javax.naming.Reference cannot be cast to com.interfaces.GroupBookingManagerRemote when communicating here between Wildfly JAX-RS Services and JBoss 5.1.0.GA legacy system. As I am communicating from Wildfly to JBoss AS 5.1.0.GA I am attempting to connect using JNDI. In my Wildfly Server Maven pom I include: <dependency> <groupId>jboss</groupId> <artifactId>jnp

Authenticate on LDAP with current user in JNDI/Java

只谈情不闲聊 提交于 2019-12-21 06:57:38
问题 I thought I'd find more about this topic but I didn't. I have to write a java application that checks which ou a specific user is part of. But to authenticate with the server I can't ask for username and password and also can't store it in the source (or some other file). Is there a way with JNDI and Java to authenticate with the user who is currently logged in? 回答1: All you can do is check if there is some user with the same username than the user that is currently logged in your Java

Adding LDAP entries using JNDI

五迷三道 提交于 2019-12-21 05:18:10
问题 I am trying to add an entry to an LDAP server using JNDI. I could successfully read the entries from the LDAP server. But when I try to add a new entry I am getting the errors. I checked various ways but I failed. private String getUserAttribs (String searchAttribValue) throws NamingException{ SearchControls ctls = new SearchControls(); ctls.setSearchScope(SearchControls.OBJECT_SCOPE); Attributes matchAttrs = new BasicAttributes(true); matchAttrs.put(new BasicAttribute("uid",

java.sql.SQLException: Connection has already been closed

偶尔善良 提交于 2019-12-21 02:44:09
问题 We are getting java.sql.SQLException: Connection has already been closed. exception intermittently while performing a transaction. We are using tomcat 7.X and below is the configuration. <Context docBase="ROOT" reloadable="true" antiJARLocking="true"> <Resource name="jdbc/DS" auth="Container" type="javax.sql.DataSource" driverClassName="org.postgresql.Driver" url="jdbc:postgresql://XXXXXXX" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" username="XXXXXX" password="XXXXXX" maxActive=

How do I make JNDI names compatible with both GlassFish and WildFly

旧时模样 提交于 2019-12-20 15:23:17
问题 I am developing a Java EE 7 application and have a requirement for the application to be deployed onto application servers running either GlassFish 4.0 or WildFly 8.1.0. The issue I've got is GlassFish and WildFly use slightly different formats for JNDI names but I can't see how to make my application compatible with both. In GlassFish my persistence.xml file references the data source jdbc/myDataSouce, but in WildFly the data source needs to be java:/jdbc/myDataSource. The same is also true

Java EE 6 - Embedded container EJB tests

≡放荡痞女 提交于 2019-12-20 10:57:16
问题 This questiong is regarding Java EE 6 , using glassfish v3 embedded-all . I have a unit test that uses EJBContainer to test my stateless EJB. Problem is I'm having trouble looking up the EJB (remote) using JNDI: setup() { ctx = EJBContainer.createEJBContainer().getContext(); } ... test() { BookService bookService = (BookService)ctx.lookup("java:global/BookServiceEJB!com.something.service.BookService"); ... } @Stateless public class BookServiceEJB implements BookService { ... } @Remote public