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)
| | |
Re: JDBC driver error message from EGL on Tomcat 6 on iSeries [message #921996 is a reply to message #920805] |
Mon, 24 September 2012 16:25 |
Dan Darnell Messages: 145 Registered: November 2011 Location: Arkansas |
Senior Member |
|
|
The APR not found message means nothing when running on the IBM i. Ignore it.
For starters, try keeping the configuration the same (using the same jt400.jar that you use on the PC).
Here's my suggestion:
Undo what you've done with regard to jt400Native.jar. Take it out of /lib and undo whatever you did with catalina.properties.
Drop jt400.jar (same one you are using on the PC) into /lib.
Run your app. Did this correct the error?
If so, we'll revisit using jt400Native.jar. If not, let's figure out what else might be at play.
--Dan
p.s. Question: Are you using JNDI resources? Did you configure them in your server.xml and context.xml files in Tomcat on the IBM i?
Example from server.xml:
<Resource
name="jdbc/myresource"
type="javax.sql.DataSource"
password="mypassword"
driverClassName="com.ibm.as400.access.AS400JDBCDriver"
maxIdle="5"
maxWait="5000"
username="xxxxxxxxxx"
url="jdbc:as400:www.xxxxxxxxxxxx.com;libraries=lib1 lib2 lib3;prompt=false"
maxActive="10"/>
And from context.xml:
<ResourceLink global="jdbc/myresource" name="jdbc/myresource" type="javax.sql.DataSource"/>
[Updated on: Mon, 24 September 2012 21:33] Report message to a moderator
|
|
|
Re: JDBC driver error message from EGL on Tomcat 6 on iSeries [message #922114 is a reply to message #921996] |
Mon, 24 September 2012 18:57 |
Jeffrey Gardner Messages: 20 Registered: August 2012 |
Junior Member |
|
|
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 #922163 is a reply to message #922143] |
Mon, 24 September 2012 20:02 |
Jeffrey Gardner Messages: 20 Registered: August 2012 |
Junior Member |
|
|
I'm not sure I know where this all is, but from the EGL application directory under /webapps, here's the contents of the context.xml file:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Context>
<Resource auth="Container" driverClassName="com.ibm.as400.access.AS400JDBCDriver" maxActive="4" maxIdle="2" maxWait="5000" name="jdbc/WayAS400" password="xxxxxxx" type="javax.sql.DataSource" url="jdbc:as400:WayAS400;prompt=false" username="jeffg"/>
</Context>
If that isn't it, can you direct me to where I might find it? (Sorry, I am very ignorant on this stuff... )
OK, here's a few others:
Paymenttutorial.egldd file:
<?xml version="1.0" encoding="UTF-8"?>
<egl:deployment xmlns:egl="http://www.eclipse.org/xmlns/edt/deployment/1.0">
<bindings>
<binding name="WayAS400" type="edt.binding.sql" uri="workspace://WayAS400" useURI="true">
<parameters>
<parameter name="deployAsJndi" value="true"/>
<parameter name="jndiName" value="jdbc/WayAS400"/>
</parameters>
</binding>
</bindings>
<egl:target.project name="db2PaymentWeb"/>
</egl:deployment>
Paymenttutorial-bnd.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<egldd>
<bindings>
<binding name="WayAS400" type="edt.binding.sql" uri="jndi://jdbc/WayAS400" useURI="true">
</binding>
</bindings>
<includes>
</includes>
</egldd>
Do these help? (Sorry about n my initial "didn't find the code" message. Apparently, Windows does a terrible job of searching for strings in these types of files.)
[Updated on: Mon, 24 September 2012 20:28] Report message to a moderator
|
|
|
Re: JDBC driver error message from EGL on Tomcat 6 on iSeries [message #922251 is a reply to message #922163] |
Mon, 24 September 2012 21:51 |
Dan Darnell Messages: 145 Registered: November 2011 Location: Arkansas |
Senior Member |
|
|
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 694 times)
[Updated on: Mon, 24 September 2012 22:03] Report message to a moderator
|
|
| | |
Re: JDBC driver error message from EGL on Tomcat 6 on iSeries [message #923207 is a reply to message #922918] |
Tue, 25 September 2012 18:00 |
Dan Darnell Messages: 145 Registered: November 2011 Location: Arkansas |
Senior Member |
|
|
Jeffrey Gardner wrote on Tue, 25 September 2012 08:03
Also, I noticed you entered a local path on your PC for the "Class Locations" field. How is that used, and should I change it to the iSeries location when deploying to the iSeries?
Shouldn't have to change the "class locations" entry for deployment. It's not part of what makes it to "context.xml" in the web project. Seems to only be used when running in the IDE.
As long as you drop jt400.jar into /lib under Tomcat on the IBM i then Tomcat should be happy when you deploy.
--Dan
[Updated on: Tue, 25 September 2012 18:00] Report message to a 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 21:30 |
Jeffrey Gardner Messages: 20 Registered: August 2012 |
Junior Member |
|
|
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 21:43] Report message to a moderator
|
|
|
Re: JDBC driver error message from EGL on Tomcat 6 on iSeries [message #923417 is a reply to message #923370] |
Tue, 25 September 2012 22:39 |
Dan Darnell Messages: 145 Registered: November 2011 Location: Arkansas |
Senior Member |
|
|
Woo hoo! Glad you are functional now.
Not sure why my example didn't work for you. On the surface it seems like some strange mismatch between the JSON data being returned and the Customer record definition used by the JavaScript client. Might try a Project->Clean on the project and run it again. (Not that you actually need my example to work now that you've cleared your hurdles with the tutorial.)
Also, good find on the jt400.jar being included in the target project when it is indicated in class locations in the DD. That's actually not desirable in my case (makes the WAR file larger for one thing) but some might prefer it. As you note, leaving it blank then causes runtime issue in the IDE (and trying to use the connection profile without overriding it doesn't seem to honor the full JDBC URL). Guess I will live with jt400.jar riding along with each WAR for now but this whole area is something the project team might want to think more about (or maybe they can weigh in with an existing solution that addresses all scenarios).
Feeling like you've been through the wringer is par for the course. They don't call it the bleeding edge for nothing!
--Dan
[Updated on: Tue, 25 September 2012 22:41] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sun Oct 13 08:24:26 GMT 2024
Powered by FUDForum. Page generated in 0.05125 seconds
|