Vince Aggrippino

Greenhorn
+ Follow
since May 19, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Vince Aggrippino

Originally posted by Ben Souther:


What problem are you seeing now?



Thank you, Ben. I think I figured it out.

The problem seemed intermittent and now I know why. It depended on what directory I was in when I started Tomcat.

I wanted to save myself some typing, so I made symbolic links to $CATALINA_HOME/bin/startup.sh and $CATALINA_HOME/shutdown.sh and put them in ~/bin, which I've added to my path.

I know there is some code in those shell scripts to detect if the command that called it is a symbolic link and take appropriate actions based on that, but I guess it doesn't work perfectly.

I've changed my symlinks to actual scripts, with two lines each. Change to the Tomcat directory, then run startup.sh/shutdown.sh. Now everything works fine every time

Thank you all for your time and consideration.

-- Vince
17 years ago
This is related to my previous post, but slightly different circumstances.

Apache Tomcat 6.0.14
Java 1.6.0_02-b05
Wicket 1.3.0-beta3

I'm trying to run a Wicket application and it's not working. I'm getting a NoClassDefFoundError:

java.lang.NoClassDefFoundError: org/apache/wicket/protocol/http/WebApplication

I think I must be misunderstanding something basic about Tomcat web application deployment.

So, I create a basic "HelloWorld" type servlet using Wicket to try and troubleshoot the problem.

I've double- and triple-checked the package against the documentation and even verified it by listing the contents of the JAR with unzip.

What am I doing wrong?

The Wicket JAR file and two of its dependencies are in WEB-INF/lib:
@home:~/dev/tomcat/webapps/HelloWicket/WEB-INF/classes$ ls -ltr ../lib
total 1648
-rw-r--r-- 1 vince vince 1657246 2007-09-04 10:00 wicket-1.3.0-beta3.jar
-rw-r--r-- 1 vince vince 7449 2007-09-04 10:00 slf4j-simple-1.4.3.jar
-rw-r--r-- 1 vince vince 15345 2007-09-04 10:00 slf4j-api-1.4.3.jar


Here's my web.xml:

Here's the layout of my servlet's directory:

Thank you,
17 years ago

Originally posted by Ben Souther:
You don't have j2ee.jar in your JDK directory anywhere do you?
I've heard of people having trouble with Tomcat when they do.



No, I don't. I was hoping that was the solution

I have made a little progress...
I deleted my tomcat installation directory and untarred it again and now basic HelloWorld type servlets will run. I'm not getting a NoClassDefFound error for HttpServlet any more, but I'm still getting the problem and I think it's related.

I'll post a new thread with a new subject.

Thank you,
Vince
17 years ago

Originally posted by William Brogden:


All classes used in servlets should be in a package - thats the first thing to correct.

If Tomcat runs and you can execute the example servlet and JSPs provided then your installation has all it needs.

Bill


I realize that all classes used in servlets should be in a package as a matter of convention and good programming practice. As you might have guessed, all of my other servlets have packages. However it's not an error not to use a package.

I added a package to my test servlet, recompiled, and restarted Tomcat, but there was no change.

Tomcat runs and I can run all of the example servlets and JSPs provided.

I did notice that I don't have the problem if I'm only attempting to load a single servlet with Tomcat. If I only add one web application to the webapps folder, it runs fine.
[ September 03, 2007: Message edited by: Vince Aggrippino ]
17 years ago
I'm using Apache Tomcat 6.0.14 with Java 1.6.0_02.

I've been having some trouble loading servlets, so I tried a basic HelloWorld type program just to make sure everything was okay and it can't find the servlet-api.jar.

I'm getting NoClassDefFoundError: javax/servlet/http/HttpServlet

Isn't it supposed to automatically load all of the jar files in $CATALINA_HOME/lib?

Here's my code:

Here's my web.xml:

Thank you,

--
-- Vince
17 years ago
I figured it out. It was a classpath issue. The classpath needed to reference the beginning of the package. Since both classes were simply in a package named "mypackage" and I was in the mypackage directory, I needed to reference ".." rather than just "." in my classpath.
17 years ago
I have two classes that are part of a basic "Hello World" type of example from the Wicket project. I'm getting an error that says "cannot find symbol". My first thought was that it was related to the CLASSPATH (even though I know that error is ClassNotFoundException), but the class that it's looking for is in the current directory and "." is in the classpath.

Here's the command and output:

Here's the code I'm trying to compile:

What am I doing wrong? I know it must be something very basic.

Thank you,
Vince
17 years ago
None of the links in the SCJP FAQ seem to be working. http://faq.javaranch.com/view?ScjpFaq or http://faq.javaranch.com/java/ScjpFaq. All of the links point to anchors within http://faq.javaranch.com/java/ScjpFaq that aren't there.

I see that the update date of the page is August 15th. What time zone is that? As I write this, it's 9:15pm EST on August 15th in the US. Could I have looked while it was being updated?

Thank you,
Vince
17 years ago
Thank you. I've read through the API for HashMap and that is the best solution in this case.

My original question wasn't well thought-out. I wanted to store objects of different types in an array, but I'm reading them from a text file, so they have to start out as Strings anyway.

I'm still curious, though... Is there a type of array that can contain elements that aren't all the same type? I mean, with HashMap, it looks like I can have an associative array with keys of one type and values of another type, but those values would all have to be of the same type. If it was , all of the values have to be Integers, don't they? I couldn't , could I?

Thank you,
Vince
18 years ago
I'm working on my first Java program, for practice. It's a text editor and I want to be able to have a configuration file to store settings like font, color, window size, etc... I'm not having any problem with opening/reading the file or creating the interface for changing the settings. However, I'd like to store all of these settings in one variable.

Array probably isn't the right thing. Is this a Collection? I have lots of reading materials, but no experience.

For example, my settings include Objects for a Font (just one, I'm using JTextArea for now), several Colors (foreground, background, etc.), several integers (window width/height), and several boolean flags (remember size/location of window).

Thank you,
Vince
18 years ago
You're right. For what I want, all I need to do is use myArray.length. I'm very new to Java. I'm a Perl guy, originally, I I guess I'm having trouble getting out of that mindset.

Thanks also to Kino. The ArrayList class does do some neat things. It's more robust than I was looking for, but it gives me ideas

-- Vince
18 years ago
Is there something similar to an exists or defined method for arrays that will not generate java.lang.ArrayIndexOutOfBoundsException?

Here are some non-working examples of what I want to do:


So, I know several ways that don't work. Is there a way to do this in Java?

Thank you,
Vince
18 years ago
Thanks to Edwin and Ramen. I have it working now, using Edwin's examples and referring to the API at sun.com.

I'm going to read Sun's tutorial on the subject, too.

I favored using just the language code. This is applicable with Malay, too, as it is also spoken in Brunei and Indonesia.

This isn't for a real project yet. It's just for practice, now. However, I do anticipate doing some bilingual applications in the future. When I do work on something real, I'll probably look into tying my Resources into a database somehow. I saw a reference to that when I was trying to find the answer to my question before I posted.

Thanks,
Vince
18 years ago
I'm going through Learning Java (O'Reilly) and I'm playing with i18n. I'm just trying to write a simple program to help me become familiar with doing this. I'm getting a java.util.MissingResourceException at runtime. So, I must be doing something wrong when I define the resources. Can someone look at my code below and help me out?

Thanks,
Vince

18 years ago