[jboss-jira] [JBoss JIRA] (WFLY-2898) JNDI Name lookup of the DataSource returns NULL
Igor Shulika (JIRA)
issues at jboss.org
Thu Feb 13 13:03:28 EST 2014
[ https://issues.jboss.org/browse/WFLY-2898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12944387#comment-12944387 ]
Igor Shulika edited comment on WFLY-2898 at 2/13/14 1:02 PM:
-------------------------------------------------------------
Eduardo, the issue exist even with very simple default datasource - java:jboss/datasources/ExampleDS.
Please see the attached test project.
web.xml
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_3_0.xsd"
version="3.0">
<description>Test</description>
<display-name>Test</display-name>
<filter>
<filter-name>monitoring</filter-name>
<filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
<init-param>
<param-name>quartz-default-listener-disabled</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>monitoring</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Java Melody Listener -->
<listener>
<listener-class>net.bull.javamelody.SessionListener</listener-class>
</listener>
<servlet>
<servlet-name>TestServer</servlet-name>
<servlet-class>org.test.TestServer</servlet-class>
<init-param>
<param-name>dataSourceName</param-name>
<param-value>java:jboss/datasources/ExampleDS</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Mapped to the /admin folder for security -->
<servlet-mapping>
<servlet-name>TestServer</servlet-name>
<url-pattern>/test</url-pattern>
</servlet-mapping>
<!-- The Welcome File List -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
was (Author: eagleigor):
Eduardo, the issue exist even with very simple default datasource - java:jboss/datasources/ExampleDS.
Please see the attached test project.
> JNDI Name lookup of the DataSource returns NULL
> -----------------------------------------------
>
> Key: WFLY-2898
> URL: https://issues.jboss.org/browse/WFLY-2898
> Project: WildFly
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: Naming, Web (Undertow)
> Affects Versions: 8.0.0.CR1, 8.0.0.Final
> Reporter: Igor Shulika
> Assignee: Eduardo Martins
> Attachments: 1.PNG, 2.PNG, 3.PNG, jaffa-oracle-driver-6.0.0.Alpha2-SNAPSHOT.jar, server.log, standalone.conf.bat, standalone.xml, test.zip
>
>
> Hi,
> I'm having a problem to obtain DataSource using JNDI Name lookup.
> Please see my code below:
> Connection connection = null;
> DataSource dataSource = null;
> try {
> final Context initContext = new InitialContext();
> dataSource = (DataSource) initContext.lookup("java:/MyDataSource"); connection = dataSource.getConnection();
> } catch (Exception e) {
> LOGGER.error(e);
> }
> I'm doing initContext.lookup from a servlet, everything is working on JBoss EAP 6.2.0.GA (AS 7.3.0.Final-redhat-14).
> Also I can find and test connection of my “java:/MyDataSource” under the “Datasources” section of the WildFly Administration Console just fine(anoter word the datasource is there).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list