jndi

How to use jndi datasource in dao?

て烟熏妆下的殇ゞ 提交于 2019-12-13 05:12:56
问题 I'm trying to do my first web project using tomcat, jsp, servlets and log4j. I have TO like: User, Subject, Faculty etc, and DAO objects like: UserRepository, SubjectRepository, FacultyRepository etc. With repositories I have the following hierarchy (not all entities placed): The initialization of DataSource in AbstractRepository goes this way: public abstract class AbstractRepository<T> implements Repository<T> { private final static Logger LOG = Logger .getLogger(AbstractRepository.class);

how use jndi settings in web.xml via hard coding?

岁酱吖の 提交于 2019-12-13 03:41:55
问题 there is this property which must be in web.xml <resource-ref> <description>DB Connection</description> <res-ref-name>jdbc/cms</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> how use jndi settings in web.xml via hard coding by annotation? 回答1: I'm assuming here that you have configured the JNDI connection in context.xml. Assuming you have, then the answer is as simple as declaring a DataSource field and annotating it with an @Resource

How to use log4j2 JMSAppender with ActiveMQ

时光毁灭记忆、已成空白 提交于 2019-12-13 00:53:52
问题 I am struggling to write a simple POC program that logs messages to a Queue. All tutorials and Q&As I find (here and here) use log4j version 1.2 and they put messages onto a Topic and not onto a queue. My requirement is to log to a queue. I followed the documentation mentioned on the official site, but was not able to get it working. I have log4j2 and ActiveMQ JARs on my classpath, I have created the queue "logQueue", I am able to see the queue in the ActiveMQ web console and when I try

JNDI Lookup on JBoss AS 6.0

旧巷老猫 提交于 2019-12-13 00:48:28
问题 I have an application deployed at localhost on JBoss 6.0 AS. This application has one remote EJB bean called ExampleEJB. Now I'm trying to code a simple client application that consumes ExampleEJB. This client application will not be deployed at any application server. The idea is to code a simple Java SE client program. I've written the following trying to perform a lookup: Properties env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");

Unable to build Spring Boot project having datasource lookup from jndi

假装没事ソ 提交于 2019-12-13 00:16:56
问题 I am building an application in Spring Boot and deploying in JBoss AS. I have removed the embedded tomcat in pom.xml: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </exclusion> </exclusions> </dependency> For connecting to database, the project is running correctly when I am connecting via jdbc by providing the

JNDI name for EJB 3.1 running on JBoss 7

↘锁芯ラ 提交于 2019-12-12 23:30:13
问题 I'm trying to run this EJB example on JBoss 7 but it always throws NameNotFoundException. The EJB that I try to test is: Calculator. When I deploy it on JBoss 7 show this next lines in the server console: java:global/CalculadoraProject/Calculator!demo.CalculatorRemote java:app/CalculadoraProject/Calculator!demo.CalculatorRemote java:module/Calculator!demo.CalculatorRemote java:jboss/exported/CalculadoraProject/Calculator!demo.CalculatorRemote java:global/CalculadoraProject/Calculator java:app

Too many connections , tomcat7 on AWS EC2

落爺英雄遲暮 提交于 2019-12-12 21:13:38
问题 I signed up for a new AWS free account, and I am trying to to connect the Tomcat to the RDS database through JNDI Pool connection. The war deployed on the Beanstalk is the default one (which does not have any database connection or queries) Here is how my context.xml looks like <Context> <WatchedResource>WEB-INF/web.xml</WatchedResource> <!-- Uncomment this to disable session persistence across Tomcat restarts --> <Manager pathname="" /> <!-- Uncomment this to enable Comet connection tacking

Externalizing Spring Security configuration?

…衆ロ難τιáo~ 提交于 2019-12-12 20:02:10
问题 I have a web application that works with several different configurations of Spring Security already. However, these difference configuration are all setup within my applicationContext configuration file. Therefore, in order to tweak these at a customer site, these would have to be modified INSIDE the WAR file. If customers manually modify the WAR file, then they'll lose their changes after redeploying a new WAR. Is there a way to externalize this configuration? Is there a way I can load the

Assign unique UID value dynamically based upon 3 character of sn and givenname

久未见 提交于 2019-12-12 19:33:25
问题 How to check whether the UID are present already. If it's present increment one value for the new user with 3 letters of first name and last name. If UId are not present Assign the value of UID ...and store in eDirectory.. public class searchattribute { public static void main (String[] args) { Hashtable env = new Hashtable(); String adminName = "cn=admin,o=novell"; String adminPassword = "Happiest1"; String ldapURL = "ldaps://10.18.26.192:636"; //Access the keystore, this is where the Root

How does the Resource name attribute in Tomcat's context.xml work?

主宰稳场 提交于 2019-12-12 15:28:03
问题 We are using JNDI to lookup our database connection. In Tomcat's global context.xml file, we have something similar to the following: <context> <Resource ... name="jdbc/mysql" .... /> </context> (I have just displayed the 'name' attribute above I'm interested in). This works fine for an application. We now want to add another resource for a different application. Our context.xml then looked as follows: <context> <Resource ... name="jdbc/mysql" .... /> <Resource ... name="jdbc/mysql/otherapp"