This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!

Gary Ba

Ranch Hand
+ Follow
since Oct 23, 2009
Gary likes ...
Firefox Browser Java Windows
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Gary Ba

Thanks Greg! I deleted the web.xml and the BeeServlet worked.

Bear, I skimmed through the tutorial and I will read more into it once I have more time. Its a little intimidating to get question from your status.

Man....for now, it is working so I can move on to the next part of the instructions whew...

Gary
4 years ago
Yes, I packaged the class in

C:\tomcat\apache-tomcat-8.0.12\webapps\bee\WEB-INF\classes
and web.xml is located in C:\tomcat\apache-tomcat-8.0.12\webapps\bee\WEB-INF

Before that though, I have put the .java file under C:\Java\development\bee\src and compiled it to C:\Java\development\bee\build\classes
Once compiled, I copied BeeServlet.class into C:\tomcat\apache-tomcat-8.0.12\webapps\bee\WEB-INF\classes

Is that what you meant?

Thank you for being patient

Gary
4 years ago
The BeeServlet.class is under bee\WEB-INF\classes.

The url is http://localhost:8080/bee/BeeServlet so i have url-pattern as /bee/BeeServlet

I also looked at this link for more information. http://www.tutorialspoint.com/servlets/servlets-packaging.htm

I can view the examples that is included on tomcat. BeeServlet.java is copied from the example and compiled then moved .class to bee\WEB-INF\classes folder

Where is the error?

Gary

4 years ago
Thanks Bear for the reply.

I looked through Servlets Faq. Under the ServletNotRunning404 which is the error I am getting, it looks like I covered what can go wrong.
- The .class file is under WEB-INF/classes.
- I do have a servlet mapping on web.xml.
- The url path http://localhost:8080/bee/BeeServlet is the same as URL pattern /bee/BeeServlet

I know this is probably a stupid mistake. Can you point out any obvious mistake I am running into?

Thank you for the help.
Gary
4 years ago
All,

After (struggled) successfully installing Tomcat, I started to re create BeeServlet (code is given) from the assignment. I am not familiar with XML so i did some research online. I created an web.xml file and put it under
C:\tomcat\apache-tomcat-8.0.12\webapps\bee\WEB-INF

The web.xml i created has the following code:




However, when I ran tomcat and directed my browser to

http://localhost:8080/bee/BeeServlet

I received the following message..

HTTP Status 404 - /bee/BeeServlet
message /bee/BeeServlet
description The requested resource is not available.

I have the compiled BeeServlet class on
C:\tomcat\apache-tomcat-8.0.12\webapps\bee\WEB-INF\classess

Is there anything wrong with my web.xml? Do I need anything else?

Thank you in advance.
Gary
4 years ago
Pallavi,
Yehey! Wohooo! It works after removing the bin on tomcat!!

I then went onto http://localhost:8080/ and saw the apache tomcat version and a succesful message.

Thank you!

Gary
4 years ago
Thank you for your reply Pallavi.

Yes, I made a typo when copying the location of tomcat. Initially, I installed tomcat 7 but found out it is not compatible with JRE 7 so installed tomcat.

From command prompt, I typed in C:\tomcat\apache-tomcat-8.0.12\bin>startup.bat start
and i still get same error

"The CATALINA_HOME environment variable is not defined correctly
This environment variable is needed to run this program"

Gary
4 years ago
Hi Everyone,

I just installed Apache Tomcat 8.0.12 into my laptop for servlets assignment. I then went to command prompt and did a

C:\tomcat\apache-tomcat-7.0.55\bin>startup.bat start

Doing this I received an error "The CATALINA_HOME environment variable is not defined correctly
This environment variable is needed to run this program".

Here are my environment variables, system variables:

PATH: C:\Program Files\Java\jdk1.7.0_67\bin;C:\Program Files\Java\jre7\bin;C:\tomcat\apache-tomcat-8.0.12\bin;
JAVA_HOME: C:\Program Files\Java\jdk1.7.0_67
JRE_HOME: C:\Program Files\Java\jre7
CATALINA_HOME: C:\tomcat\apache-tomcat-8.0.12\bin;

I just got back on the saddle where I left. I need to get tomcat running first before I can start with the cattle drive assignments.

Does anyone have any idea what else I can try? I will try to sleep in it and try again tomorrow.

Thank you in advance.
Gary
4 years ago
I am looking for the instruction for installing Tomcat. I saw this thread and I thought I would try this.

Margaret and Phil, if you are available, can you send me the Tomcat instruction?

I will the link to Margaret's last posting.

Gary
4 years ago
I received an email from Greg Charles with the new assignment instruction.

Thanks Greg! Always, when in doubt, ask Greg!
4 years ago
Hello Everyone,
I am planning to get back in the saddle. From my last email with the nitpicker, I left on servlets 3A. Since my laptop crashed, I had to download the Java SE Development Kit and tried Orion for servlets assignments. However, the orion link is in different language (orionserver.com). I searched through the other postings and I saw that others are using Tomcat for the assignment. I am not familiar with Tomcat so I have a couple of questions before I start.
1. Do I download the latest Tomcat?
2. Does the assignments intruction stays the same for Tomcat?

Excited to doing the assignments.

Thanks,
Gary
4 years ago
I finally got BeeServlet error out of my laptop!!!

Okay, if anyone is interested I can share it tomorrow.

Good night,
Gary

7 years ago
Hi,

I am trying to get back in the cattle drive (Servlets is where I had left) but I am running to a big wall.

I started doing the first instruction on servlets like install orion, run orion, moo and date web browser with no problem. However, when it comes to installing JavaEE SDK, compiling and browsing to beeservlet, it gives me the following errors...

500 Internal Server Error

java.lang.NoClassDefFoundError: com/javaranch/drive/BeeServlet$Defaultry

at com.javaranch.drive.BeeServlet.init(BeeServlet.java:19)
at javax.servlet.GenericServlet.init(GenericServlet.java:44)
at com.evermind[Orion/2.0.7 (build 11273)]._ay._lye(Unknown Source)
at com.evermind[Orion/2.0.7 (build 11273)]._ay._cbd(Unknown Source)
at com.evermind[Orion/2.0.7 (build 11273)]._ay._nlc(Unknown Source)
at com.evermind[Orion/2.0.7 (build 11273)]._ax._lsc(Unknown Source)
at com.evermind[Orion/2.0.7 (build 11273)]._ax._uab(Unknown Source)
at com.evermind[Orion/2.0.7 (build 11273)]._bf.run(Unknown Source)

Does anyone have any ideas on what to try?

Thanks,
Gary

7 years ago
I installed JRE6 again and both javac.exe and java.exe are working.

Thanks for the pointer.

Gary
7 years ago
Hi guys,
I am getting back into the cattle drive assignment where I had left off on Servlets (Reverse-2). I tried running orion using java -jar orion.jar but received an error..

C:\orion>java -jar orion.jar
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object

I looked up what the error is and it told met that my ClassPath is not correct. I then tried javac if I can compile any of my old java program and it gave me a similar error.
I typed PATH on my command line and it gave me...

C:\orion>path
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32
\WindowsPowerShell\v1.0\;C:\Program Files\jEdit;C:\Program Files\Java\jdk1.6.0_2
5\bin\bin;C:\Program Files\QuickTime\QTSystem\

Sure enough my classpath has an extra ...\bin at the end. Removed it and is able to compile using javac . However, java -jar orion.jar is still giving me a problem.
I then read online that I can type the whole path..."C:\Program Files\Java\jdk1.6.0_25\bin\java.exe" -jar orion.jar. And boom it worked which tells me jdk is working fine.

Question: Why is it that my javac is working without specifying the whole path while java does not?
What am I missing here. To me, my classpath is setup correctly and jdk is working fine.

Let me know if I need to explain more.

Thank you in advance.

Gary
7 years ago