steve nicholls

+ Follow
since Dec 10, 2002
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by steve nicholls

Okay, I've been wrestling with this one for a day, and I'm still running into problems. I was able to load the same code from a different machine to the test box and it works correctly .

So now the error seems to be originating from just this machine. I removed all the projects, ears, etc... from this machine and then I set the JVM back to its default (eclipse JVM, which works on the other machines). I shut down WSAD and the machine. Started WSAD up and created all the projects again with the original baseline code, then I rebuilt all the code. However when I create the JAR and put it on the test box (from this machine) I'm still getting the same error:

failed with java.lang.UnsupportedClassVersionError: arc/web/servlets/pub/GetSoeOrder (Unsupported major.minor version 48.0) for

Can anyone please shed some light this issue so I can keep my sanity.

19 years ago
I've created JAR for some web code to put on our test machine. Originally this was running smoothly, and then I changed the JVM to jdk1.4.2 (to compile some Regular Expression code). After uploading this code, I got the following error on an object I've never had problems with before.

failed with java.lang.UnsupportedClassVersionError: arc/web/servlets/pub/GetSoeOrder (Unsupported major.minor version 48.0) for

I got rid of the Regular Expression and changed the JVM back to the "detected JVM" setting (which is the eclipse JRE). I rebuilt all the code, but I'm still getting this error when I re-JAR the code and stick it on the test box.

Any suggestions?


FYI: I'm using:
WebSphere Studio Application Developer Integration Edition

Version: 5.0.0
Build id: 20030205_0822
[ May 19, 2004: Message edited by: steve nicholls ]
19 years ago
I don't believe there is a time limit once you download the assignment...there may be one once you purchase the exam voucher. I downloaded the assignment in August of last year and finished in February of this year...working on odds and ends of it during my spare time.
I'm trying to get an accurate time estimate for completing the assignment so my company can award me "training hours". I would have to agree that 5 weeks is a tight timeframe to complete this task for even an experienced developer.
Some time back, I saw a thread on here about the total development hours it would take a coder to design, code, debug, and submit a successful developer programming assignment, although I can't find that discussion, going through the recently posted threads. I remember the estimates ranging from 3-5 weeks of full time work (depending on previous experience) to complete the project and take the test. Is that accurate?
This is the obligatory "I PASSED!!" message, to let you know the obvious and to thank some of the truly awesome people at Java Ranch.
Eugene Kononov, Mag Hoeme, and especially Peter Den Haan.....take a bow.
I passed with a 139. I got dinged for GUI design and general considerations. I was hoping they could be a little more detailed about the point assignment, but since they didn't specify anything
I'll just have to assume my airplane icon was just not up to par. Nevertheless, it was a good learning experience and I'm glad I completed it. Now I just need to convince my boss, that SCJDs have competative salaries with doctors.
Seriously, thank you for all your help...much appreciated!
21 years ago
You definately have to replace all deprecated methods. In the case of getBytes this can be replaced by getBytes() or getBytes(String).
The getBytes() method uses your default CharacterSet to encode what is writeen to the binary file. Each VM has its own default CharacterSet based on the Operating System. It could be the case that your default character set does not encode the file into a writeable format that is readable later (I have read that if you use OS/390, which uses the EBCDIC character set, there are issues similar to this).
Instead try getBytes(String), where the string is the name of a character set. This forces the program to encode in the necessary character set. US-ASCII should work as the character set. If you decide to go this route, remember that since you are encoding it in US-ASCII, you should also read (decode) it in US-ASCII. This means using a method that allows an encoding parameter to replace the following:
rv[i] = new String(buffer, 0, offset, description[i].getLength());
Whatever you do, just remember to document it with your submission.
Let me clarify this issue a little more, I think I probably confused everyone with a deluge of hypotheticals.
The instructions want us to specify how to add the JAR to the classpath.
" not say something like 'add server.jar to your classpath' You should document exactly how to add the jar file to the classpath.". What is an acceptable way of documenting this?
Peter you stated:
"All the instructions will have to say is things like go to the directory where you unpacked the application and run "java -jar client.jar <remotehost ort>" (or whatever your command line is)." Can we assume that the user unpacked the JAR inside a directory found in the CLASSPATH?
I really appreciate your help Peter and Eugene. Let me know what you think?
In the Instructions.html document, it states that in the ReadMe document we need to specify exactly how to start the program. " not say something like "add server.jar to your classpath". You should document exactly how to add the jar file to the classpath."
Well depending on the OS, there are several different methods for setting and getting environment variables (such as classpath), do we need to document this operation for each concievable OS? This is problem #1.
As an work around, I thought about just setting the classpath in the command line, which is feasible but brings up another problem. The JAR tool has issues tyring to set the classpath in the command line:
Issue 1: Do we need to include instruction on how to unjar the jar file? If so, the JAR command does not allow you to specify the class path in the command line. The only other option is to set this environment variable, which leads to problem #1 (above), where we have to document how to set the classpath for every type of OS.
Issue 2: In the case where we have a Server.jar, Client.jar and then a Total.jar (containing all submission files). If you try to set the classpath in the command line you run into problems using Total.jar in your classpath and then using the "-jar" flag to start Client.jar. So, the following code does not work.
java -classpath c:\temp\Total.jar -jar Client.jar
I realize that I am probably agonizing over this detail too much, but it would be horrible if a submission got rejected because the execution instructions weren't stupid-proof. Likewise, I realize that there is probably a simple, yet clever way to document setting the classpath for all OSs. Ideally, I would like the user to set the classpath as an environment variable and not rely on having to include it in all of my command lines. So if anyone has a sufficient method for documenting this task, I would greatly appreciate it.
Thanks so much.
Thanks Mark.
FYI: I did a little research into this area. As you stated, the RMI server will default to port 1099 if the default UnicastRemoteObject constructor is used. Likewise, serveral RMI servers can be loaded onto one port, with the server name being the unique identifier. Consequently, when using rebind(String, Object) to specify the server name (String), the method will fail if the name already exists. If no port is specified on the client side (in the rmi url), the lookup(String) method will search on port on the default port. So it would appear for this program, a port does not need to be specified, but the server should ensure the Server name is unique before trying to rebind.
Also, as a side note, the default RMI port can be switched by specifying this in the command line, for example:
$ rmiregistry 10123
will use port 10123 as the default port. I hope this research is useful to anyone else with port questions.
I am not using the port number parameter, we can request from the user. When I start the server, I use Naming.rebind("serverName", Object) and when the client connects to the server, it uses:
Where ipAddress is the IP address without a port number. So is the port field necessary? Does the RMI client seek out the first available RMI server at that IP address with that name? Can errors occur if the port number is not specified?
Thanks for all your advice. In order to track users (for unlock()), I will probably incorporate a Factory object into my design. Which brings me to the following question.
If I have a Factory object and a Server object do both need to extend UnicastRemoteObject? Or can I just set the Factory to extend UnicastRemoteObject and pass back the Server object? I am assuming that the Factory has to be placed on the server side, if we want to track users. (BTW - Mag, I just coined the phrase "Factory Server" as a Factory that extends UnicastRemoteObject). Any thoughts or suggestions would be appreciated.
Thanks for all your advice. In order to track users (for unlock()), I will probably incorporate a Factory object into my design. Which brings me to the following question.
If I have a Factory object and a Server object do both need to extend UnicastRemoteObject? Or can I just set the Factory to extend UnicastRemoteObject and pass back the Server object? I am assuming that the Factory has to be placed on the server side, if we want to track users. (BTW - Mag, I just coined the phrase "Factory Server" as a Factory that extends UnicastRemoteObject. Wasn't sure what else to call it). Any thoughts or suggestions would be appreciated.
After reading through several chapters on RMI, it seems that most implementations use a Factory Pattern to delegate connection chores. However, after looking at the SCJD requirements, we only ever connect to one server in one given way (if you are local mode you would NOT need to instantiate a Factory object). To create a Factory, it needs to extend UnicastRemoteObject and you have to call it from the client using Naming.lookup(). To me it would seem, in the SCJD case, that you are creating a Factory for the sake of creating a factory (you write the client code to point towards a Factory, which points toward the DataServer, when you could write could to directly point from the client to the server).
I understand that creating a Factory allows the developer flexibility in the future, because he/she can easy switch or create new connections. Are there other benefits? Is my understanding of Factory architecture accurate/correct? Will I be docked points if I don't implement a Factory pattern?
I realize that the Factory pattern has significant values in production level code, but how relevent is it to SCJD?
Also, to implement a Factory server, would this be started in conjunction with the Data server? And would the Factory server utilize the same rmiregistry and security policy? Would it even have to?
Okay, I realize I just asked about 6 questions, but I really appreciate your help. Thoughts and suggestions are welcome and encouraged. Thanks!
Thanks Rene! Setting the imagePanel size and preferredSize seemed to do the trick.
21 years ago
I appreciate your thoughts on this problem. I tried what you suggested (below), although I am still getting a small white box instead of my image. It appears that we need to force the image to be painted (or repainted), without painting over the existing GUI elements. Any other suggestions/comments.
import java.awt.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.*;
public class TestFrame extends JFrame{
private JButton okButton = new JButton("OK");
privateJLabel jl1 = new JLabel("hey");
private Image image;
public TestFrame(){
setSize(400, 200);
Toolkit tk = Toolkit.getDefaultToolkit();
image = tk.getImage("image.gif");
Container cp = getContentPane();
JPanel jp = new JPanel();
jp.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
JPanel textPanel = new JPanel();
textPanel.setLayout(new GridLayout(6,1));
gbc.gridx = 1;
gbc.gridy = 0;
jp.add(textPanel, gbc);
gbc.gridx = 0; gbc.gridy = 0;
ImagePanel imagePanel = new ImagePanel(image);
jp.add(imagePanel, gbc);
gbc.gridx = 1;
gbc.gridy = 2;
JPanel okPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
jp.add(okPanel, gbc);
okButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent AE){
public void paintComponent(Graphics g){

public static void main(String args[]){
TestFrame ig = new TestFrame();
class ImagePanel extends JPanel {
Image image;
public ImagePanel(Image image) {
this.image = image;
public void paintComponent(Graphics g) {
super.paintComponent(g); //paint background
//Draw image at its natural size first.
g.drawImage(image, 0, 0, 50, 50, this); //85x62 image
21 years ago