Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring 3+ Weblogic and JNDI issue
    primarykey
    data
    text
    <p>This is my second question here, hope someone will answer this time. I am using weblogic 10 and EJB 2 but now I am to creating a new module in Spring 3.</p> <p>Everything is working fine but I am not able use the existing datasource object provided by JNDI in spring context xml ....</p> <p>Here are the files</p> <p>Weblogic config.xml</p> <pre><code>&lt;jdbc-system-resource&gt; &lt;name&gt;EOrderDataSource&lt;/name&gt; &lt;target&gt;adeccoClubServer&lt;/target&gt; &lt;descriptor-file-name&gt;jdbc/EOrderDataSource-jdbc.xml&lt;/descriptor-file-name&gt; &lt;/jdbc-system-resource&gt; &lt;jdbc-system-resource&gt; </code></pre> <p>EOrderDataSource-jdbc.xml</p> <pre><code>&lt;?xml version='1.0' encoding='UTF-8'?&gt; &lt;jdbc-data-source xmlns="http://www.bea.com/ns/weblogic/90" xmlns:sec="http://www.bea.com/ns/weblogic/90/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wls="http://www.bea.com/ns/weblogic/90/security/wls" xsi:schemaLocation="http://www.bea.com/ns/weblogic/920 http://www.bea.com/ns/weblogic/920.xsd"&gt; &lt;name&gt;EOrderDataSource&lt;/name&gt; &lt;jdbc-driver-params&gt; &lt;url&gt;jdbc:oracle:thin:@dicmdb01:1512:o2ks1&lt;/url&gt; &lt;driver-name&gt;oracle.jdbc.OracleDriver&lt;/driver-name&gt; &lt;properties&gt; &lt;property&gt; &lt;name&gt;user&lt;/name&gt; &lt;value&gt;asd&lt;/value&gt; &lt;/property&gt; &lt;/properties&gt; &lt;password-encrypted&gt;asd&lt;/password-encrypted&gt; &lt;/jdbc-driver-params&gt; &lt;jdbc-connection-pool-params&gt; &lt;initial-capacity&gt;2&lt;/initial-capacity&gt; &lt;max-capacity&gt;2&lt;/max-capacity&gt; &lt;capacity-increment&gt;2&lt;/capacity-increment&gt; &lt;test-frequency-seconds&gt;7200&lt;/test-frequency-seconds&gt; &lt;test-connections-on-reserve&gt;true&lt;/test-connections-on-reserve&gt; &lt;test-table-name&gt;DUAL&lt;/test-table-name&gt; &lt;/jdbc-connection-pool-params&gt; &lt;jdbc-data-source-params&gt; &lt;jndi-name&gt;EOrderDataSource&lt;/jndi-name&gt; &lt;global-transactions-protocol&gt;EmulateTwoPhaseCommit&lt;/global-transactions-protocol&gt; &lt;/jdbc-data-source-params&gt; &lt;/jdbc-data-source&gt; </code></pre> <p>And my dispatcher servlet</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:jee="http://www.springframework.org/schema/jee" xsi:schemaLocation="http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"&gt; &lt;mvc:annotation-driven/&gt; &lt;context:annotation-config /&gt; &lt;context:component-scan base-package="com.adecco.spring" /&gt; &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt; &lt;property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /&gt; &lt;property name="prefix" value="/WEB-INF/jsp/" /&gt; &lt;property name="suffix" value=".jsp" /&gt; &lt;/bean&gt; &lt;jee:jndi-lookup id="dataSource" jndi-name="weboDataSource" expected-type="javax.sql.DataSource"/&gt; &lt;/beans&gt; </code></pre> <p>Dispatcher Servet with Manual connection, which works fine</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"&gt; &lt;mvc:annotation-driven/&gt; &lt;context:annotation-config /&gt; &lt;context:component-scan base-package="com.adecco.spring" /&gt; &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt; &lt;property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /&gt; &lt;property name="prefix" value="/WEB-INF/jsp/" /&gt; &lt;property name="suffix" value=".jsp" /&gt; &lt;/bean&gt; &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt; &lt;property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" /&gt; &lt;property name="url" value="jdbc:oracle:thin:@dicmdb01:1512:o2kd1" /&gt; &lt;property name="username" value="abcd" /&gt; &lt;property name="password" value="xyz" /&gt; &lt;/bean&gt; &lt;/beans&gt; </code></pre> <p>Even on the Java side its very simple to get the datasource object and its working fine:</p> <pre><code>Context ctx = new InitialContext (); DataSource ds = (DataSource) ctx.lookup ("EOrderDataSource"); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload