Domanda

We are three developers all working with Netbeans and Java. One developer can access the remote DB2 server just fine (using the same code). The other two (which includes me) can not.

Here is the context.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/app_web">
    <Resource name="jdbc/admin"
              auth="Container"
              type="javax.sql.DataSource"
              maxActive="500"
              initialSize="10"
              maxIdle="50"
              maxWait="10000"
              username="theusername"
              password="xxxxxxxxx"
              driverClassName="com.ibm.as400.access.AS400JDBCDriver"
              removeAbandoned="true"
              removeAbandonedTimeout="60"
              logAbandoned="true"
              url="jdbc:as400://192.168.1.1;prompt=false;naming=system;prompt=false;naming=system;libraries=*libl;date format=iso;time format=iso"
              />

Here are the exceptions we are getting:

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (The application requester cannot establish the connection. (Permission denied: connect))
Caused by: java.sql.SQLException: The application requester cannot establish the connection. (Permission denied: connect)
    at com.ibm.as400.access.JDError.throwSQLException(JDError.java:528)
WARNING: Failed to register in JMX: javax.naming.NamingException: Cannot create PoolableConnectionFactory (The application requester cannot establish the connection. (Permission denied: connect))
WARNING: Unexpected exception resolving reference
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (The application requester cannot establish the connection. (Permission denied: connect))
Caused by: java.sql.SQLException: The application requester cannot establish the connection. (Permission denied: connect)
    at com.ibm.as400.access.JDError.throwSQLException(JDError.java:528)
WARNING: Failed to register in JMX: javax.naming.NamingException: Cannot create PoolableConnectionFactory (The application requester cannot establish the connection. (Permission denied: connect))

I have put the jt400.jar file in the C:\Program Files\Apache Software Foundation\apache-tomcat-6.0.35\lib folder, put it in the ...\web\WEB-INF\lib folder, etc. Nothing seems to work.

È stato utile?

Soluzione

I was able to find a solution. Apparently, I had to open port 449 on my firewall. I looked there before but since this is a corporate machine, I didn't catch the fact there is ANOTHER firewall configured (F-Secure) that was blocking it.

Altri suggerimenti

The message Permission denied: connect in the log makes me think it is a a Java policy problem. Most likely the other developer has a more permissive Java policy configured.

See http://docs.oracle.com/javase/6/docs/technotes/guides/security/PolicyFiles.html

Do both of you use the same user (username="theusername") to connect? Maybe there a policty associated with the user on the IBM i (aka AS/400) that doesn't allow multiple connections

I'm not sure about DB2, but in some databases such as MySQL you can restrict which IPs (clients) can connect to the database, are you sure this is not such a problem? May be it is a security policy which has been set on the database itself, that only allows some IPs (including your partner's) to connect.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top