jndi

How to setup JNDI lookup in a Spring-JUnit test?

匿名 (未验证) 提交于 2019-12-03 03:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using Maven 3.0.3, Spring 3.1.0.RELEASE, and JUnit 4.8.1. How do I create JNDI functionality outside the container (which in my case would be JBoss)? I thought Spring's jndiTemplate would do the trick (from my testApplicationContext.xml file): <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate" lazy-init="true"> <property name="environment"> <props> <prop key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop> <prop key="java.naming.provider.url">localhost:1099</prop> </props> </property> </bean

Glassfish v3 / JNDI entry cannot be found problems!

左心房为你撑大大i 提交于 2019-12-03 03:06:53
I've been having problems trying to call an EJB's method from a Java Application Client. Here is the code. EJB Remote Interface package com.test; import javax.ejb.Remote; @Remote public interface HelloBeanRemote { public String sayHello(); } EJB package com.test; import javax.ejb.Stateless; @Stateless (name="HelloBeanExample" , mappedName="ejb/HelloBean") public class HelloBean implements HelloBeanRemote { @Override public String sayHello(){ return "hola"; } } Main class (another project) import com.test.HelloBeanRemote; import javax.naming.Context; import javax.naming.InitialContext; public

Spring Boot with JNDI Data Source

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a new Spring Boot web application that I want to connect to a JNDI data source (a MySQL database defined in Tomcat's context.xml). However when I attempt this, I always get the following exception; org.springframework.beans.factory.BeanCreationException: Cannot determine embedded database url for database type NONE. If you want an embedded database please put a supported on on the classpath. This is despite my pom.xml containing the MySQL connector <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0

how to convert jndi lookup from xml to java config

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Currently I'm converting the xml to java config. But I stuck at some part that I have been research for several days. Here the problem: Xml config: <jee:jndi-lookup id="dbDataSource" jndi-name="${db.jndi}" resource-ref="true" /> <beans:bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate" > <beans:property name="dataSource" ref="dbDataSource"></beans:property> </beans:bean> So far I managed to convert this code: <jee:jndi-lookup id="dbDataSource" jndi-name="${db.jndi}" resource-ref="true" /> to this : @Bean(name =

Setting up a URL resource on WebSphere Application Server 7.0?

[亡魂溺海] 提交于 2019-12-03 01:36:32
I need to setup a URL resource in WebSphere and is following this tutorial. However, the tutorial requires the modification of WebSphere's web.xml and ibm-web-bnd.xml using WebSphere Studio. I don't have a WebSphere Studio so I need to modify those files manually using a text editor. I tried to "search" for the 2 files but the "search results" are so many that I don't know which one is the right file. Where can I find the 2 files? Also what value do I need to set for the resource-ref 's id? I notice that WebSphere Studio doesn't have any text field for setting the resource-ref 's but it has a

How can I spoof a jndi lookup for a datasource without a app server

本秂侑毒 提交于 2019-12-03 01:30:11
I want to test some new functionality which is part of an internal web app. This new code uses a database connection normally provided by an app server (tomcat). I do not want to recreate the entire web app on my local machine to test the new code, since I only need to run one function. Does anyone know how I can 'spoof' a Context, or Datasource, to retrieve the database config, without actually creating a web app instance on a server? With the help of Spring SimpleNamingContextBuilder and Apache BasicDataSource , you can do something like this (I usually have this in a static block in test

Howto use JNDI database connection with Spring Boot and Spring Data using embedded Tomcat?

匿名 (未验证) 提交于 2019-12-03 01:18:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: When I try to use a JNDI datasource with Spring Boot and Spring Data JPA using an embedded Tomcat server, I get the following error message when running the application with SpringApplication.run: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory

Spring boot JNDI datasource lookup failure - Name comp/env/jdbc not found in context “java:”

匿名 (未验证) 提交于 2019-12-03 01:18:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have setup a spring boot (v 1.1.9) application to deploy as a WAR file. And I'm trying to integrate this web application with an existing data service module (added as a maven dependency). Environment trying to deploy: WebSphere Application Server 8.5.5.4 The issue I'm facing is an application start-up failure when try to look-up a JNDI dataSource ( jdbc/fileUploadDS ) as below within the dependent data service module. @Configuration @Profile("prod") public class JndiDataConfig implements DataConfig { @Bean public DataSource dataSource()

Inject CDI managed bean in custom Shiro AuthorizingRealm

匿名 (未验证) 提交于 2019-12-03 01:10:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In an app I'm building we're using straight Java 6 EE and JBoss (no Spring, etc), with JPA/Hibernate, JSF, CDI and EJBs. I haven't found many good general security solutions (recommendations are welcome), but the best bet I found is Apache Shiro. However this seems to have a number of shortcomings. Some of which you can read about at Balus C's site: http://balusc.blogspot.com/2013/01/apache-shiro-is-it-ready-for-java-ee-6.html But I've stumbled on another big problem which is already mentioned here regarding dependency injection and proxying

Java EE 6 - Embedded container EJB tests

穿精又带淫゛_ 提交于 2019-12-03 00:46:50
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 interface BookService { ... } gives the exception: javax.naming.NamingException: Lookup failed for