I've created a resource context for mysql connection pooling in a file
named context.xml & i puted it into META-INF directory of my web gwt
eclipse application (my project does NOT use google app engine) . its
my context.xml content :
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/TestDB" docBase="DBTest"
debug="5" reloadable="true" crossContext="true">
<Resource name="jdbc/TestDB" auth="Container"
type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="root" password="mypass"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/mydb"
removeAbandoned="true" removeAbandonedTimeout="60"
/>
</Context>
and i've add a reference to this resource into web.xml (in WEB-INF
directory of my application) :
<resource-ref>
<description>MySQL DB Connection</description>
<res-ref-name>jdbc/TestDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
I want to test my gwt2 application in development mode , its part of
my java code :
InitialContext ctx = new InitialContext();
Context envContext = (Context)ctx.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/TestDB");
but when second line of this code executes, i get this exception :
NoInitialContextException:Need to specify class name in environment or
system property, or as an applet parameter, or in an application
resource file: java.naming.factory.initial
I googled the web & i know i need add some properties into my
initialcontext , but i dont know where, what & how ??? Please tell me
what i should to do while runing in development mde & what i should to
do when i want running my application in a local tomcac 5.5 server ???
Thanks