Brad Strausbaugh

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

Recent posts by Brad Strausbaugh

Thanks, Gamini. That did the trick.

-Brad
16 years ago
I'm trying to compile my first tag handler. Actually, it's the one in Head First Servlets and JSPs at the end of Chapter 9, the AdvisorTagHandler class.

The compiler complains about my imports, namely that javax.servlet.jsp.JspException does not exist. My compile command looks like this and I have verified that servlet-api.jar actually resides where the classpath is indicating...



Does anything jump out? Or can anyone suggest something to try? Here is the source that I'm trying to compile. The first error occurs on the first import line ...

16 years ago
Excellent idea, Arulk. I will look into that.

-Brad
Bear, William, Rene.

Got it! I had a typo in my web.xml </servlet-mapping> tag and I had totally left out my </web-app> tag.

Learning about the logs and the manager application is very good stuff.

I owe you guys a beer. I owe a lot of people beers.

-Brad
16 years ago
William and Bear, thanks for both of your replies.

Bear, your pdf was very eye-opening. I can run the Application Manager now and my /HelloWorldOne app appears on Applications, Running=false and Sessions=0. Is "Sessions" what you mean by "context" as in Session Context, or is there something else I'm missing? Sessions remains 0 when I try to invoke my HelloWorldOne app in another browser window, and of course I still get the 404 error.

Still no success but this is very interesting.
16 years ago
At the risk of sounding like a total moron, I don't know what that phrase "context shows in the manager app" means. What is the manager app? I see Tomcat running in a DOS shell and I can invoke it using a browser, and my app is HelloWorldOne. But what is the manager app?

-Brad
16 years ago
form.html is directly under HelloWorldOne and a peer of WEB-INF. I mistakenly left it out of my diagram but it is in fact in my directory. So correctly my directory looks like this ...



... and this is as things are when I enter http://localhost:8080/HelloWorldOne/form.html and the 404 error occurs.
16 years ago
The directory hierarchy diagram didn't come through with the leading spaces, but yes, WEB-INF is under HelloWorldOne.
16 years ago
Thanks for replying.

Yes, my WEB-INF is under HelloWorldOne ... like ...



- If I simply type http://localhost:8080/HelloWorldOne/ I also get a 404 error. I also tried putting a simple index.html under HelloWorldOne and got the same 404 error

- Interestingly, if I try http://localhost:8080/tomcat-docs (which is there thanks to the Tomcat install) I get that index.html just fine. It's strange.
[ September 04, 2008: Message edited by: Bear Bibeault ]
16 years ago
Trying my first "Hello World" app with Tomcat which is much like the beer app in HFSJ. I'm using Tomcat 5.5 on XP. I've read the javaranch FAQ on Tomcat and I understand that Tomcat is not finding my target file, form.html.

I can launch Tomcat, then Firefox and bring up http://localhost:8080 just fine. But when I try http://localhost:8080/HelloWorldOne/form.html I get the 404 (unable to find /HelloWorldOne/form.html).

Modeling after the examples on HFJS p72-77, I have my form.html at ...

..\Tomcat 5.5\webapps\HelloWorldOne\form.html

Again, I'm following closely the deployment example on p73. I corrected a typo in my web.xml but I suspect that's an unrelated issue. Everything under WEB-INF is deployed as described in the HFSJ example.

Any advice is most welcome.

-Brad
16 years ago
I have recently passed my SCWCD exam and I want to re-enforce what I have learned, by writing some code. In preparation for my first job (whenever I get one), should I be spending my time, one: installing Tomcat and writing code at the command line the way Sierra and Bates do in "Head First Servlets and JSPs", or two: learn the web-app features of NetBeans 6.1, or three: something else. All opinions are welcome.

-Brad
Thanks much, Ernest and Jesper. That's just what I needed.
16 years ago
I am trying to write, compile and run a simple "Hello World" Java program. It compiles fine but when I try to run it I get a NoClassDefFoundError.

My j2sdk resides at the top level directory on the C drive - ie c:\j2sdk1.4.2_12\bin, and my JAVA_HOME is set to c:\j2sdk1.4.2_12. My path and classpath are both set to c:\j2sdk1.4.2_12\bin. In my DOS shell it all looks like this ...

C>
C>set path
Path=C:\WINDOWS\system32;C:\WINDOWS;C:\System32\Wbem;C:\j2sdk1.4.2_12\bin;C:\j2sdkee1.3.1\bin;C:\Sun\SDK\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH

C>set classpath
CLASSPATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\j2sdk1.4.2_12\bin

C>set JAVA_HOME
JAVA_HOME=C:\j2sdk1.4.2_12

C>type Test.java

public class Test {
public static void main(String[] args) {
System.out.print("Hello World!");
}
}

C>javac Test.java

C>java Test
Exception in thread "main" java.lang.NoClassDefFoundError: Test

C>

I am completely at a loss. Does anything obvious jump out?
16 years ago
Greetings:

I have just installed Tomcat 5.5 on my Windows XP notebook and I am trying to compile my first servlet -- the beerApp in HFSJ. The Java compiler complains that it can't find the javax.servlet.* and javax.servlet.http packages.

I found the FAQ on JavaRanch about setting CLASSPATH to TOMCAT_INSTALL_DIRECTORY/common/lib/servlet-api.jar, which in my case is ...

C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\Program Files\Java\jdk1.5.0_07\bin;c:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\servlet-api.jar

A few things:

- I still get the same compiler error - even after rebooting

- When I enter the PATH command in the DOS shell, it does not show the same CLASSPATH setting I made in Control Panel -> System -> Environmental Variables. Are PATH and CLASSPATH the same? DOS doesn't seem to recognize CLASSPATH

- Does my CLASSPATH look at least plausable?

c:\Program Files\Java\jdk1.5.0_07\bin;c:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\servlet-api.jar

Thanks, -Brad
16 years ago
I meant j2se 1.4, Darya. Thanks again.