I know this question has been asked several times. I found some links here and here as an example of what I found. But I try their solutions and my problem is not solved yet...
So I copy what I have:
- A J2EE project in Eclipse. I built a new .war to install in an application server
- I created a
Tomcat 7 Server
in Eclipse and added my .war to it to deploy it locally
So phisically in my project I have a .war
project and the Servers
project that auto-creates when you create a new Server in Eclipse.
I tried to connect to a local as400 db
but when I did so, I found this error:
Error com.myprojectpackage.xxx: Name XXX is not bound in this Context
I tried to add a ResourceLink
as said in one of the links I attach:
<ResourceLink name="jdbc/mydb"
global="jdbc/mydb"
type="javax.sql.DataSource" />
First I tried to create it in my application like this:
In my
web.xml
<resource-ref> <description>Datasource for my db</description> <res-ref-name>jdbc/mydb</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref>
I created a custom
context.xml
file and added
<ResourceLink name="jdbc/mydb"
global="jdbc/mydb"
type="javax.sql.DataSource" maxActive="50" maxIdle="30" maxWait="10000"
username="myuser" password="mypass" auth="Container"
driverClassName="com.ibm.as400.access.AS400JDBCDriver" url="jdbc:as400://192.168.1.1;naming=system;errors=full;" />
This first try didn't work. So I went to the server side, and added the following:
- In
context.xml
file:
<ResourceLink name="jdbc/mydb"
global="jdbc/mydb"
type="javax.sql.DataSource" maxActive="50" maxIdle="30" maxWait="10000"
username="myuser" password="mypass" auth="Container"
driverClassName="com.ibm.as400.access.AS400JDBCDriver" url="jdbc:as400://192.168.1.1;naming=system;errors=full;" />
- In
server.xml
I added the sameResourceLink
insideContext
This second try failed too.
So, what the problem is? How can I solve this?