jndi

jndi database connection with jpa and eclipselink

拈花ヽ惹草 提交于 2019-12-03 13:46:45
I try to setup a database connection in java with JNDI in combination with eclipseLink/JPA on Tomcat 5.5. I already configured the JNDI resource in web.xml and context.xml. The db connection works with JNDI without using JPA and eclipseLink. After configuring the persistence.xml for eclipseLink, I got the following exception. I don't know how to configure the persistence.xml correctly to use JNDI datasource for the db connection. The exception WicketMessage: Method onFormSubmitted of interface org.apache.wicket.markup.html.form.IFormSubmitListener targeted at component [MarkupContainer

why use JndiObjectFactoryBean to config JNDI datasource did not work?

…衆ロ難τιáo~ 提交于 2019-12-03 13:21:23
问题 when I uss Java-base to config my JNDI. Spring 4.2.5. But If I use JndiObjectFactoryBean to config.when I want to get the datasource ,the object will be null. @Bean public DataSource dataSource(){ JndiObjectFactoryBean jndiObjectFactoryBean =new JndiObjectFactoryBean(); jndiObjectFactoryBean.setJndiName("jdbc/SpittrDS"); jndiObjectFactoryBean.setResourceRef(true); jndiObjectFactoryBean.setProxyInterface(DataSource.class); return (DataSource) jndiObjectFactoryBean.getObject(); //NULL!!! } But

JNDI Service provider for the file system

早过忘川 提交于 2019-12-03 13:11:58
I was looking for the Java Naming and Directory Interface (JNDI) service provider for the file system. As far as I know, Oracle ships bundled with the JDK only service providers for RMI, DNS, LDAP and COS. It looks like Sun used to provide one, because my Google search returned a number of Web-sites and forums including Coderanch where people suggested downloading the file system SP from Sun's JNDI page , but that page now redirects to Java Technetwork's main page. Also, Oracle's JNDI page gives no information about the file system SP while somewhere in the JNDI trail of the Java tutorial they

Running web app in both Jetty and Tomcat

久未见 提交于 2019-12-03 12:40:31
I have a web app which in production I run on Tomcat. It uses the MySQL connector, however it is not bundled up with the war, rather it is included under Tomcat's common lib directory, so that I can access the data source through JNDI. I would like to do something similar with Jetty (while developing), and more precisely Jetty + Maven. Is there a way for me to include the mysql-connector jar in the classpath when running Jetty through Maven (i.e. not have it bundled in the war file)? Also I should note that I am using Maven for my build process and have the mysql-connector specified as

How to get driver class name (not driver name) from jdbc connection

时间秒杀一切 提交于 2019-12-03 12:23:11
I have a context.xml file in the below format <Context shallowOutput="true" path="/"> <WatchedResource>WEB-INF/web.xml</WatchedResource> <Resource name="jdbc/myDataSource" auth="Container" type="javax.sql.DataSource" factory="org.apache.commons.dbcp.BasicDataSourceFactory" driverClassName="oracle.jdbc.driver.OracleDriver" username="OMITTED" password="OMITTED" url="OMITTED" maxActive="20" maxIdle="10" maxWait="-1"/> From this contex.xml I need to get my Driver CLASS name. Everytime I try like DataSource ds = (DataSource)context.lookup("java:/jdbc/myDataSource") and try to like get the the

Does OSGI JNDI allow coexistence with JNDI calls from non-OSGI code?

无人久伴 提交于 2019-12-03 11:47:09
问题 Chapter 126 of the OSGI Enterprise Release 5 specification mentions compatibility: "Support the traditional JNDI programming model used by Java SE and Java EE clients." and use of OSGI-unaware code: "Clients and JNDI Context providers that are unaware of OSGi use static methods to connect to the JRE JNDI implementation. The InitialContext class provides access to a Context from a provider and providers use the static NamingManager methods to do object conversion and find URL Contexts. This

Setting up a URL resource on WebSphere Application Server 7.0?

人走茶凉 提交于 2019-12-03 11:04:31
问题 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

Tomcat: use FTP connection via JNDI [closed]

匿名 (未验证) 提交于 2019-12-03 10:24:21
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I need to access an FTP server from my Web Application which runs on Tomcat 6. I want to use JNDI to do this. How can I configure this FTP connection in Tomcat using JNDI? What do I have to write into web.xml and context.xml to configure the resource? And how can I then access this connection from the Java source code? 回答1: From this post : http://codelevain.wordpress.com/2010/12/18/url-as-jndi-resource/ Define your FTP URL in your context.xml like this : <Resource name="url/SomeService" auth="Container" type="java.net.URL" factory="com

Simple JNDI ContextFactory?

匿名 (未验证) 提交于 2019-12-03 10:10:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: My WAR application is deployed to Amazon Elastic Beanstalk. They don't support JNDI, but I need it for JPA and unit tests. What JNDI context factory I can use as a workaround? I need a simple open source solution, that would allow me to configure entire factory through jndi.properties . I tried GuiceyFruit, but looks like it doesn't allow data source configuration inside one file. Any suggestions? ps. OpenEJB will work, but it's an overkill for such a simple task 回答1: Try Simple-JNDI. It gives you an in-memory implementation of a JNDI

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

二次信任 提交于 2019-12-03 09:53:26
问题 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? 回答1: With the help of Spring SimpleNamingContextBuilder