Home » Archived » EGL Development Tools » JDBC driver error message from EGL on Tomcat 6 on iSeries(Deploying the EGL tutorial to Tomcat on iSeries produces "cannot create JDBC driver..." message)
JDBC driver error message from EGL on Tomcat 6 on iSeries [message #919248] |
Fri, 21 September 2012 16:51  |
Eclipse User |
|
|
|
Problem:
When the exported war file for the "Access a Database with EGL Rich UI" tutorial is deployed on Tomcat 6 on the iSeries, the following runtime error message is produced:
Failure: An exception occurred during a service call. Service:services.SQLService, Function:services.SQLService
Detail 1:
Detail 2:
Detail 3: Exception: SQLService, getAllPayments, SQLSTATE = , message = Cannot create JDBC driver of class '' for connect URL 'null': [sqlstate:null][sqlcode:0]
Background:
I worked back through the tutorial changing database access from the Derby database to the DB2 database on my iSeries. I set up the connection profile to access the iSeries with my userid and password. I qualified all references to the file/table on the iSeries (pending my default schema and library list question elsewhere in this forum).
- The application functions without errors, correctly accessing the file on the iSeries using the Preview tab.
- Copying the jt400.jar file from the EDT program files directory to the "Tomcat6.0.20/lib" directory on my PC allowed the application to "Run as/Run on server" within the IDE.
- I exported the application to a war and deployed it into Tomcat running on my PC. It runs correctly.
- I copied the jt400Native.jar from the QIBM directory into the "Tomcat6.0.20/lib" in the IFS of the iSeries and deployed the same war file to that Tomcat installation. (That installation directory is a copy of what is on my PC with a few modifications to configuration files to make Tomcat run on the iSeries). When I run the application from that server, it produces the error.
I tried using jt400.jar instead (just to make sure) and the error message is the same. Even with neither jar file in the lib directory, the same message.
The iSeries java version is the new /QOpenSys/QIBM/ProdData/JavaVM/jdk60/32bit
Any ideas?
|
|
| | | |
Re: JDBC driver error message from EGL on Tomcat 6 on iSeries [message #922114 is a reply to message #921996] |
Mon, 24 September 2012 14:57   |
Eclipse User |
|
|
|
I had tried jt400.jar, but I gave it one more try. Same message. I get the same message even with neither of the two jar files in the /lib directory. Here's the common.loader line from the catalina.properties file (it is the same in my PC's Tomcat configuration.):
common.loader=${catalina.home}/lib,${catalina.home}/lib/*.jar
I appended a specific ",${catalina.home}/lib/jt400.jar" to the end which still did not work.
Just for jollies I copied jt400Native.jar to my PC's Tomcat (and got rid of the jt400.jar). It works fine there...(?!) Then, I took both jt400*.jar out of /lib on my PC and I get a completely different message when I run the application:
Failure: An exception occurred during a service call. Service:services.SQLService, Function:services.SQLService
Detail 1:
Detail 2:
Detail 3: Exception: SQLService, getAllPayments, SQLSTATE = , message = Cannot load JDBC driver class 'com.ibm.as400.access.AS400JDBCDriver': [sqlstate:null][sqlcode:0]
So, somehow my iSeries Tomcat is not getting the information it needs (from the EGL application?) to look for a driver named 'com.ibm.as400.access.AS400JDBCDriver' because the message says it is trying to create one. This seems especially so since the class name is blank and the url is null. (But, what do I know...)
And JNDI? I don't know. I don't see anything like your code sample in any of the /conf files, nor do I see it in the files on my PC. So both my installations are at least set up the same.
I don't know if it is material or not (since it has no database access), but the EGL HellowWorld tutorial does indeed work on the iSeries.
|
|
| | |
Re: JDBC driver error message from EGL on Tomcat 6 on iSeries [message #922251 is a reply to message #922163] |
Mon, 24 September 2012 17:51   |
Eclipse User |
|
|
|
Well, bummer. I don't know what to tell you.
I happen to have a clean Tomcat 7 install here (on an IBM i server) so, just for grins, I walked through creating a new EDT project and deployed it...going for the simplest working example. The only setup I did on the Tomcat server was to drop jt400.jar into my tomcat/lib directory on the IBM i server.
Here's the EGL code (using EDT 0.8.1):
package com.dandarnell.client;
// ^ This package is JavaScript generation only.
import org.eclipse.edt.rui.widgets.*;
import com.dandarnell.common.*;
import com.dandarnell.server.HelloDatabaseService;
handler HelloDatabase type RUIhandler{initialUI =[ui], onConstructionFunction = start, cssFile = "css/HelloDatabase.css", title = ""}
ui GridLayout{columns = 3, rows = 4, cellPadding = 4, children = [ l1, t1, l2, l3, b1 ]};
b1 Button{ layoutData = new GridLayoutData{ row = 4, column = 1 }, text = "Say Hello", onClick ::= b1_onClick };
t1 TextField{ layoutData = new GridLayoutData{ row = 1, column = 2 }};
l1 TextLabel{ layoutData = new GridLayoutData{ row = 1, column = 1 }, text = "ID:" };
l2 TextLabel{ layoutData = new GridLayoutData{ row = 2, column = 2 }, text="" };
l3 TextLabel{ layoutData = new GridLayoutData{ row = 3, column = 2 }, text="" };
function start()
end
function b1_onClick(event Event in)
call HelloDatabaseService.getCustomerWithStatus(t1.text as int)
returning to myCallBackFunction
onException myExceptionHandler;
end
function myCallBackFunction(retResult CustomerWithStatus in)
if(retResult.status.succeeded)
l2.text = "Hello, " + retResult.data.firstname;
end
l3.text = "DB Status: " + retResult.status.message;
end
function myExceptionHandler(exp AnyException in)
SysLib.writeStdOut(exp.messageID + " " + exp.message);
if(exp isa ServiceInvocationException)
SysLib.writeStdOut((exp as ServiceInvocationException).detail1);
SysLib.writeStdOut((exp as ServiceInvocationException).detail2);
SysLib.writeStdOut((exp as ServiceInvocationException).detail3);
end
end
end
package com.dandarnell.common;
// ^ This package is Java and JavaScript generation.
Record Status
succeeded boolean;
message string?;
end
record Customer type Entity { @table { name="CUSTOMER" } }
id int{ @id };
firstname string(40);
end
Record CustomerWithStatus
status Status;
data Customer?;
end
package com.dandarnell.server;
// ^ This package is Java generation only.
import com.dandarnell.common.*;
service HelloDatabaseService
dataSource SQLDataSource? { @Resource{uri = "binding:dbbinding"}};
function getCustomerWithStatus(id int in) returns (CustomerWithStatus)
ret CustomerWithStatus{};
rec Customer?;
ret.status.succeeded = false;
ret.status.message = "Unknown error";
try
get rec from dataSource using(id);
if(rec == null)
ret.status.message = "Record not found";
else
ret.status.succeeded = true;
ret.status.message = "Ok";
ret.data = rec;
end
onException (exception SQLException)
ret.status.message = exception.message;
end
return (ret);
end
end
Attached screen shot is of my deployment descriptor. I did no manual JNDI/JDBC resource config on the Tomcat side ... just went with the context.xml as generated by the EDT tool in my deployable web project.
Table setup in DB2 looks like this:
CREATE TABLE DDARNELLDT/CUSTOMER (
ID INT NOT NULL WITH DEFAULT,
FIRSTNAME VARCHAR ( 40) NOT NULL WITH DEFAULT,
CONSTRAINT ID_KEY
PRIMARY KEY (ID))
INSERT INTO DDARNELLDT/CUSTOMER VALUES(1, 'Dan')
INSERT INTO DDARNELLDT/CUSTOMER VALUES(2, 'Joe')
On the UI you enter a user ID number (an integer) and then press the "Say Hello" button. The service is used to retrieve the user's name from a database table so that it can be helloed.
I don't know if this will help you or not...hope it does.
--Dan
Attachment: db1.PNG
(Size: 43.82KB, Downloaded 736 times)
[Updated on: Mon, 24 September 2012 18:03] by Moderator
|
|
| | | |
Re: JDBC driver error message from EGL on Tomcat 6 on iSeries [message #923370 is a reply to message #923207] |
Tue, 25 September 2012 17:30   |
Eclipse User |
|
|
|
Whew! I feel like I've been through the wringer...
Tomcat 6 and your sample project
I set this up under a single project with multiple packages. (Don't know if that is the normal way to do it.)
In the workbench, it ran and accessed the iSeries database in both the Preview and the Run on server, but it always produced this error:
CRRUI3655E [CRRUI3655E] An error occurred while processing response object: 'Object expected'
200
{"result" : {"status" : {"succeeded" : true, "message" : "Ok"}, "data" : {"id" : 1, "firstname" : "Dan"}}}
The dialog with the record did not display. As you can see, it did get the correct record before the error.
When I deployed to my PC Tomcat, it produced only a blank page when testing in Firefox (I thought that very odd). After much checking and redeploying, I tried IE. It it produced the same error message and results as the workbench.
I then deployed to the iSeries. Firefox behaved the same (blank page). IE produced the following error:
CRRUI3655E [CRRUI3655E] An error occurred while processing response object: 'Object expected'
200
{"result" : {"status" : {"succeeded" : false, "message" : "Cannot create JDBC driver of class '' for connect URL 'null': [sqlstate:null][sqlcode:0]"}, "data" : null}}
essentially the same JDBC error as the tutorial code produces.
Tomcat 7.0
So after a bit more messing around, I got a copy of Tomcat 7.0.30 and installed it on my PC and the iSeries.
The tutorial finally worked correctly on the PC and on the iSeries in Firefox (yeah!).
In IE 7 the oddity was that it correctly retrieves the data, but the 'Payment Record' grid is missing. And no error message...?
And get this, the tutorial even worked in Opera!
So, IE7 was the bad boy there (I know I'm behind on that one, but I don't use it much...)
Your sample project still showed a blank page in Firefox and Opera. In IE 7 it acted the same as under TC 6.0.20, seemingly getting the record but sending the error message before displaying the dialog.
jt400.jar
When I installed TC 7 and got the first success on the tutorial, I suddenly remembered that I had not copied the jt400.jar to the Tomcat /lib...that was weird. I discovered that the workbench is exporting the jt400.jar into the war file so it gets deployed in each app's WEB-INF/lib directory.
I did some more testing and found that TC 7 will run the apps correctly with jt400.jar in /lib or in WEB-INF/lib or in both (on both the iSeries and the PC). In fact, all of my tests on the PC and the iSeries returned the same results -- nice to see some consistency!
It seems the "Class locations" field in the Binding properties not only is used for classes in the IDE, it causes the jt400.jar file specified to be deployed to the web project and exported to the war file. I discovered that because I had different paths in the two projects pointing to two different versions of the jt400.jar, one left over from WDSc and the other supplied in EDT.
Leaving that field blank caused no jt400.jar to be deployed to the project or war. I like this as it lets the app server handle the jar file. However, is it better to have it in each app to avoid compatibility issues?
Leaving it blank causes problems with the connection in the IDE. Is there another setting to cause it to not be deployed and exported?
Well, thanks for your help and suggestions that got me this far. I can now move on to the next tutorial.
P.S. Once it was all working, I deleted all the jt400.jars and put the loader path in Tomcat to jt400Native. That worked too!
[Updated on: Tue, 25 September 2012 17:43] by Moderator
|
|
| |
Goto Forum:
Current Time: Thu Jun 19 22:51:22 EDT 2025
Powered by FUDForum. Page generated in 0.10355 seconds
|