Chad Schmidt

Greenhorn
+ Follow
since Nov 04, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Chad Schmidt

Hello all,
I was wondering if someone could point me in the right direction for using JDBC connection pools in a WebSphere 5.1 Web application that uses multithreading.
Here's what I am trying to do (unsuccessfully I might add)
I have a Servlet that uses an instance of a class that provides a method that creates four threads. Each one of these threads connects to an iSeries host system and searches a file in a library using a prepared SQL statement.
I was using the IBM Toolbox for Java and obtaining a Record Level access connection for each iSeries host connection but I figured I might get better connection performance out of the application by using JDBC connection pools so I ditched the Record Level Access and when with JDBC and SQL statements instead. I'm sure the search will be slower because I will no longer be taking advantage of a KeyedFile object.
I have a connection pool set up on my WDSC integrated test server. It has been tested with a non-multithreaded application and it works great. When I try to use a connection from my pool in the multithreaded application I get all sorts of messages that state that my resources can not be found.
I also get a series of messages that read:
J2CA0075W: An active transaction should be present while processing method allocateMCWrapper.
At the end of the stack trace I see an exception message that points to my prepareStatement call in my Thread class. I guess this is where the server doesn�t like what I'm doing. I don't know why though.
Does anyone know what I need to do in order to use JDBC connection pooling and CMP resources all from within a Web application that creates its own threads?
Maybe I'm going about things wrong. I would bet money on that. I am rather new to some of these advanced topics and do what I can to learn them on my own. I figure it would be dumb not to ask for help if it can save me some time or point me down the right road to success sooner.
Thanks,
Hi all,
Does anyone know if it is possible to set up a connection pool on a WebSphere Application Server that will contain AS400 objects Instead of AS400JDBC objects? I want a pool of AS400 objects so I can access records on a iSeries using RECORD LEVEL ACCESS and not have the generic account information hard coded anywhere in my source code. If this is not possible what kind of a solution would be best for my problem?
Thanks,
17 years ago
All,
Ok, here's what I am currently attempting to do.
1.)I have a JSP with multiple text fields and a couple of selection boxes and a submit button.
2.)The user fills in all of these fields in the JSP and hits a submit button.
3.)An ActionForm collects the inputted values from the different fields and an Action class does some stuff with these values. (This all works great)
4.)After the Action class does what it has to do successfully it will then forward to another JSP page that informs the user that the action completed successfully. (This works great too)
5.)The user then has the option of using a link to return to the previous JSP with the text fields, selection boxes, and submit button.
(Here's my problem) I want this JSP's text fields to be cleared and its selection boxes to have their default values shown when I return to it from this other JSP.
I am doing some validation on the input when the user submits the data. Basically, if the user does not enter something into a few specific fields then after they press the submit button struts will refresh the page and display the errors. ALL previously entered fields must retain their values here, hence why I can't use a request scope for the action. It is only after I return to this form from another JSP do I want all the fields to be reset.
I am not sure how to make this happen. I have tried many things with no success so far. I know the solution is most likely simple but I don't see it and my attempts to find an example on the web have come up miserably short. Please help if you can.
Thank you,
Chad Schmidt
17 years ago
Raimondas,
You are 100% correct. I did not have a full understanding of how synchronization works between threads and shared objects. I did a bit of reading this weekend and I now fully understand what I was doing wrong. I had looked at the Sun tutorial you suggested but the solution did not pop out at me on Friday. I just needed to do a little more in depth reading before I saw the solution. I should be good to go now.
Thanks much,
Chad Schmidt
Ok, this may help some of you help me better. Here is a program where I am trying to synchronize the update a shared String array between four Threads. This example does not include the Servlet but that's not where my problem is so I figured that I would exlude it.

Please help if you can, it is important that I figure this problem out soon. I'm not quite sure I fully understand how wait() and notify/notifyAll() work.
Thank you,
Chad Schmidt
[ February 20, 2004: Message edited by: Jim Yingst ]
Hello all,
I have a thread and shared resource synchronization problem.
Here's the skinny on what I want my program to do.
I have a class that extends Thread, call it class X.
The class X object takes a String array and an integer representing the position in the array to update as the input parameters of its constructor. (This String array will be the shared resource between all instances of class X)
I also have a Servlet that creates four instances of this X class and passes each instance of X the same array reference but different integer values for the array position value ranging from (0 to 3).
I want to ensure that each class X object updates only one position of the array and that all X objects update the positions, as represented by the position value passed to their constructors, in the array before I attempt to access the array in order to display its contents to a user. (Since there are 4 X objects the shared String array is of size = 4)
I have tried a few different approaches with no luck. I can't seem to get each object to update the array. I may get two to do an update at best.
Does anyone have a design approach that would guarantee that each array element is updated by the appropriate thread?
Thanks in advance,
Chad Schmidt
Hello all,
I'm having difficulty running any Web project that uses the jt400.jar on my WS test application server. I am using the Websphere Developer Studio Client for iSeries version 5.0. My test server is set up as a WebSphere Test Applicaiton Server v 5.0. I had some problems with the previous install of the WS Developer Studio Client so I uninstalled and then re-installed it. I have even installed the available patches as found on IBM's support website. Everything seems to work as before except...
Before I uninstalled my client I made a backup of my old workspace folder. I then deleted it from my PC. Once I had re-installed my developer studio client I simply copied the old workspace over the default one and then started the studio client. It came up with no errors but when I try to run any of my previous Web projects, in my old profile, I get the error:
Error 500: Failed to load target servlet[name of servlet].
I'm also getting a error that reads:
[Servlet Error]-[name of servlet]: java.lang.NoClassDefFoundError: com/ibm/as400/access/AS400File
for each servlet I attempt to run that uses the jt400.jar. The jt400.jar is still included in the build path of each of my projects as before so I don't see what is going on. It's like none of my projects can see the jt400.jar even though it is still in the same place. What am I doing wrong?
Does anyone have an idea of what I need to do to get my servlets to run again? I am currently confused about what the "real" problem is.
Thank you,
Chad Schmidt
17 years ago
All,
Kishore's suggestion worked when I used the below code. Thank you so much for the suggestion.
statement.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE , ResultSet.CONCUR_READ_ONLY);
I see what I was doing wrong now.
Thanks again,
Chad
All,
Sorry for the late reply. I've been out of the office for a few days.
I am using the AS400JDBCDriver as provided by the JTOpen 4.1 release.
Here's how I create my statement and fire off the SQL query:
statement = JDBCconnection.createStatement();
String sQL = "SELECT PRTAX#, PRPNAM FROM CSLIB/PROVIDER WHERE PRSTAT = 'MO'";
rs = statement.executeQuery(sQL);
I have had no problems using the AS400JDBCDriver until now.
I'll try Kishore's suggestion and use the following syntax while creating my statement:
conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE , ResultSet.CONCUR_READ_ONLY);
I'll let you all know who it goes.
Thanks again,
Chad
Hello all,
I am having difficulties getting the number of rows contained in a ResultSet.
I am using the following code to obtain this data.
NOTE: numRows is an class scope integer variable.
// get the number of rows of the result set
// move cursor to the last row in the result set
rs.last();
// returns the number of the last row
numRows = rs.getRow();

// before processing result set the cursor before the first row
rs.beforeFirst();
When I execute this code I recieve the following error when the rs.last() method fires:
java.sql.SQLException: Cursor state not valid.
NOTE: I am not calling the rs.next() method before this call to rs.last().
Does anyone know why this is happening?
Thanks in advance,
Hello Dave,
If you are running the J2SDK1.4.X you should fine the html converter in this location:
%JAVA_HOME%\lib
***where %JAVA_HOME% = your install location of the JDK files.
The executable jar file is named: htmlconverter.jar
If you need to download the 1.3 version or later of the htmlconverter it can be downloaded from this URL:
http://java.sun.com/products/plugin/1.3/converter.html
Once you have downloaded the htmlconv-1_3_0_02.zip file, unzip it and start your Windows CMD prompt.
Navigate to the directory that contains the unzipped file using the DOS "cd" (change directory) command.
Once in the correct directory simply enter this command at the command prompt to start the html converter:
java -jar htmlconverter.jar -gui
NOTE: The name of the converter may be different. The 1.3 version is named: htmlconv1_3.jar
I hope this helps.

Chad
18 years ago
Hello,
I am really having a difficult time getting an applet that uses the AS400JDBCDriver class to run in Internet Explorer 6 SP1.
I have the code that creates the database connection class object in the init() method of my applet class wrapped in the following code in order run the applet our of the sandbox.
NOTE: I�m not sure I need to do this but this was the only way to make the AccessController errors disappear from the stack trace.
This code compiles and does not generate errors of any kind.
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
// My code here � it works
return null;
}
});
My problem seems to be with the signed jar files I create and reference in my applet�s APPLET tag ARCHIVE attribute. I have the jt400.jar file copied to my working directory. When I create a policy file that grants all access and use this policy file to run the applet in appletviewer, my reference to this local jt400.jar works fine. I assuming there are no socket security issues when running an applet locally in appletviewer.
When I attempt to run this applet in IE6 SP1 I get the following stack trace:
java.lang.SecurityException: class "AS400QueryApplet$1"'s signer information does not match signer information of other classes in the same package
at java.lang.ClassLoader.checkCerts(ClassLoader.java:599)
at java.lang.ClassLoader.defineClass(ClassLoader.java:532)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:157)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:123)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at AS400QueryApplet.init(AS400QueryApplet.java:33)
at sun.applet.AppletPanel.run(AppletPanel.java:353)
at java.lang.Thread.run(Thread.java:534)
Here�s my applet code:
<applet code="AS400QueryApplet.class"
archive="sAS400QueryApplet.jar, jt400.jar"
width=500 height=300>
</applet>
The sAS400QueryApplet.jar is a signed jar file the contains the following two files:
AS400QueryApplet.class
ResultSetTableModel.class
Here�s what my policy file reads:
keystore "file:/C:/Temp/JavaTestStuff/userstore";
grant signedBy "chad" {
permission java.net.NetPermission "ppcdev", "resolve, connect";
};

A reference to this policy file has been added to my java.security file located in my �C:\j2sdk1.4.2_02\jre\lib\security� directory.
NOTE: ppcdev is the AS400 host I am attempting to connect to.
The policy file that I use to connect when using appletviewer does not have this java.net.NetPermission entry nor does it grant access to a signer alias. Rather is has the follwing entry:
permission java.security.AllPermission;
Does anyone have experience with this type of applet???
Any help on this would be greatly appreciated since this is my first attempt to create and run an applet that actually does anything useful.
Thanks much
Chad
18 years ago
Got it to work!
I put the jt400.jar file in the same directory as my *.class and *.html file(s) and created a policy file that gave the applet access to all they system's resources, for testing purposes only, and made this change to my *.html file:
<html>
<applet code = "AS400QueryApplet.class" ARCHIVE="jt400.jar" width = "400" height = "300">
</applet>
</html>
All is well.
Thank you all!
Chad Schmidt
ctschmidt
Hello Maulin,
I read someone's reply, to a similar question like mine, on another message board that hinted on what you are talking about. That makes sense to me but I have never used that attribute of the APPLET tag before. Of course this is my first attempt at writing an applet that actualy does something useful.
Here is my current HTML code:
<html>
<applet code = "AS400QueryApplet.class" width = "400" height = "300">
</applet>
</html>
As you can see, it is simple and obviously not what I need. If you could point me in the right direction, that would be great.
Will I still need to create a system resource access policy?
I will look into the usage of the ARCHIVE attribute of the APPLET tag while waiting for a reply.
Thanks much!

Chad Schmidt
ctschmidt
I'm not sure I understand your solution.
If I run this program as a JFrame it will connect just fine.
Why would I have to copy the AS400JDBCDriver.class from the jt400.jar? Shouldn't it be made available to all java programs from my classpath setting?
My database does indeed sit on another machine. I am working from a Windows 2000 Professional workstation and connecting to a AS/400 host in my java program. I looked at the digital signature stuff a little. I looks like that is the next big thing to learn. I guess this is a security issue, correct?
I attempted to give the applet access to all resources on my PC by writing a policy and using this policy when running the applet in appletviewer. This was not a successful venture. I actually have the applet security turtorial, as offered by Sun, open on my PC. I will work through that and get a good grasp on this topic and see if it helps solve my problem.
Any further suggestions???
Thanks much!