Application Server 7 DataSource Problem please help me

<resources>

<jdbc-resource enabled="true" pool-name="sunpool" jndi-name="jdbc/sundatastore"/>

<jdbc-connection-pool steady-pool-size="25" max-pool-size="32" max-wait-time-in-millis="60000" pool-resize-quantity="15" idle-timeout-in-seconds="300" is-isolation-level-guaranteed="false" is-connection-validation-required="true" connection-validation-method="auto-commit" fail-all-connections="false" datasource-classname="oracle.jdbc.pool.OracleDataSource" name="sunpool">

<property value="hr" name="user"/>

<property value="1111" name="password"/>

<property value="jdbc:oracle:thin:@localhost:1521:XE" name="url"/>

</jdbc-connection-pool>

</resources>

Context objInitialContext =new InitialContext();

DataSource datasource = (DataSource) objInitialContext.lookup(<jndi-name>);

Connection objConnection = datasource.getConnection();

javax.naming.NameNotFoundException

Help me please...

[1549 byte] By [1_si_TerraNa] at [2007-11-27 3:01:42]
# 1

From which component are you doing the lookup (EJB / web) ?

you can do lookup as "java:comp/env/jdbc/DATASOURCE_NAME"

DATASOURCE_NAME is defined in your "resource-ref" of descriptor.

http://docs.sun.com/source/816-7153-10/djjdbc.html#31097

What other exceptions do you see in log ?

Jagadish.Prasatha at 2007-7-12 3:43:54 > top of Java-index,Application & Integration Servers,Application Servers...
# 2

I'm korean..

enlish poor..

so ..

I can't free use english

I enumerate keyword below..

I'm trying DataSource lookup

[environment]

Datsabase : Oracle Xpression Edition

WAS : Application Server 7

[server.xml]

<resources>

<jdbc-resource enabled="true" pool-name="sunpool" jndi-name="jdbc/sundatastore"/>

<jdbc-connection-pool steady-pool-size="25" max-pool-size="32" max-wait-time-in-millis="60000" pool-resize-quantity="15" idle-timeout-in-seconds="300" is-isolation-level-guaranteed="false" is-connection-validation-required="true" connection-validation-method="auto-commit" fail-all-connections="false" datasource-classname="oracle.jdbc.pool.OracleDataSource" name="sunpool">

<property value="hr" name="user"/>

<property value="1111" name="password"/>

<property value="jdbc:oracle:thin:@localhost:1521:XE" name="url"/>

</jdbc-connection-pool>

</resources>

[javacode]

Context objInitialContext = new InitialContext();

DataSource datasource = (DataSource) objInitialContext.lookup("jdbc/sundatastore");

Connection objConnection = datasource.getConnection();

should I do anything more?

you said "resource-ref"...

where location "resource-ref"

http://docs.sun.com/source/816-7153-10/djjdbc.html#31097

"resource-ref" --> "resource-ref". not exsist

any help approciate

thank you

1_si_TerraNa at 2007-7-12 3:43:54 > top of Java-index,Application & Integration Servers,Application Servers...
# 3
http://docs.sun.com/source/816-7153-10/djjndi.html#18124 explains about resource-ref.Is lookup done in web component or EJB component ?When your lookup fails, exceptions will be logged in your server.log. Can you please post the exceptions ?
Jagadish.Prasatha at 2007-7-12 3:43:54 > top of Java-index,Application & Integration Servers,Application Servers...
# 4

Thnk you very much for your reply

I tried "resource-ref".

but..

it did not worked

[my configure]

[C:Sun/AppServer7/domains/domain1/server1/config/sever.xml]

<resources>

<jdbc-resource enabled="true" pool-name="OraXE Connection Pool" jndi-name="jdbc/oraXE"/>

<jdbc-connection-pool steady-pool-size="25" max-pool-size="32" max-wait-time-in-millis="60000" pool-resize-quantity="15" idle-timeout-in-seconds="300" is-isolation-level-guaranteed="false" is-connection-validation-required="true" connection-validation-method="auto-commit" fail-all-connections="false" datasource-classname="oracle.jdbc.pool.OracleDataSource" name="OraXE Connection Pool">

<property value="hr" name="user"/>

<property value="1111" name="password"/>

<property value="jdbc:oracle:thin:@localhost:1521:XE" name="url"/>

</jdbc-connection-pool>

</resources>

[C:Sun/AppServer7/domains/domain1/server1/docroot/WEB-INF/web.xml]<web-app>

.......

.....

<resource-ref>

<description/>

<res-ref-name>jdbc/oraXE</res-ref-name>

<res-type>javax.sql.DataSource</res-type>

<res-auth>Container</res-auth>

</resource-ref>

</web-app>

[C:Sun/AppServer7/domains/domain1/server1/docroot/WEB-INF/sun-web.xml]

<sun-web-app>

.......

.....

<resource-ref>

<res-ref-name>jdbc/oraXE</res-ref-name>

<jndi-name>jdbc/oraXE</jndi-name>

</resource-ref>

</sun-web-app>

[C:Sun/AppServer7/domains/domain1/server1/docroot/test.jsp]

<%@ page import="java.sql.Connection" %>

<%@ page import="javax.naming.Context" %>

<%@ page import="javax.naming.InitialContext" %>

<%@ page import="javax.sql.DataSource" %>

<%

try

{

//-

// direct connection (it works good)

//-

// Class.forName(AppConfig.getString("DRIVER"));

// conn = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:XE", "hr", "1111");

//-

// datasource connection (it did not work)

//-

InitialContext ctx = new InitialContext();

out.print(ctx.lookup("java:comp/env/jdbc/oraXE"));

}

catch(Exception e)

{

out.print(e);

}

%>

[error]

javax.naming.NameNotFoundException: No object bound for java:comp/env/jdbc/oraXE

I don't know really

I'm crazing to die

help me please

Thank you

1_si_TerraNa at 2007-7-12 3:43:54 > top of Java-index,Application & Integration Servers,Application Servers...
# 5
Your configurations/decriptors, lookup code are fine. You might see some exceptions in server.log, can you post the exceptions ?You can also see http://javahowto.blogspot.com/2006/07/fix-namenotfoundexception-reference.html
Jagadish.Prasatha at 2007-7-12 3:43:54 > top of Java-index,Application & Integration Servers,Application Servers...
# 6

thank you much Jagadish.Prasath

but... none error in server.log

if configuration is fine

why do that java code not work

Did you ever heard Oracle XE problem or error or incompatible

in relation with Sun One version 7.

or.... firewall? datasource use speciall port internally?

sorry.

foolish thinking...

what can I do something more.

any help approciate

thank you

1_si_TerraNa at 2007-7-12 3:43:54 > top of Java-index,Application & Integration Servers,Application Servers...