wood burning stoves*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Questions to Eclipse J2EE IDE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Questions to Eclipse J2EE IDE" Watch "Questions to Eclipse J2EE IDE" New topic
Author

Questions to Eclipse J2EE IDE

Patrick Beck
Ranch Hand

Joined: Nov 07, 2006
Posts: 82
Hi all,

I am using HFSJ and I would like to try the examples in the Eclipse IDE, therefore I downloaded Eclipse J2EE IDE from eclipse.org for my Linux OS. May be somebody also uses this IDE and can answer the following questions:

(1)
Tomcat is installed correctly on my system and works. I can start it by running the start and stop scripts in the bin-directory.
I configured tomcat in Eclipse J2EE IDE, set up the path to the tomcat dir etc. I have to possibility to start and stop tomcat with the server-tab in Eclipse J2EE IDE. But this doesn't work properly. While running, I get the following output in the console:



Seems correctly, no error messages.
But when I call localhost:8080 in my browser, I usually get the tomcat start page. But this time, while invoking tomcat from Eclipse J2EE IDE, I get the following error:


HTTP Status 404 - /

type Status report

message /

description The requested resource (/) is not available.
Apache Tomcat/5.5.25


As I said before, if I start tomcat as usual via startscript, everything works correct.

Does anybody know about this problem in Eclipse J2EE?


(2)
Another problem is about to get access to classes from the web.xml in Eclipse J2EE IDE.

I used to work with the listener-example from HFSJ and I already have a running version (while coding with VI) and I would like to get this example running in Eclipse J2EE IDE.

When you create a project in Eclipse J2EE IDE, you get a directory structure different from the examples of HFSJ, e.g. the src and classes directory are outside WEB-INF. That also means I have to do some changes in my web.xml file that the container can find my servlet class files as well as the listener class.

The new structure looks like this:


ds@toshiba:~/programme/apache-tomcat-5.5.25/webapps/listenerTest_J2EE$ l build/classes/com/example/
insgesamt 12K
-rw-r--r-- 1 ds ds 447 2007-09-21 15:04 Dog.class
-rw-r--r-- 1 ds ds 1,6K 2007-09-21 15:49 ListenerTester.class
-rw-r--r-- 1 ds ds 1,2K 2007-09-21 15:04 MyServletContextListener.class


web.xml is located here:


ds@toshiba:~/programme/apache-tomcat-5.5.25/webapps/listenerTest_J2EE$ l WebContent/WEB-INF/
insgesamt 8,0K
drwxr-xr-x 2 ds ds 4,0K 2007-09-21 14:56 lib/
-rw-r--r-- 1 ds ds 652 2007-09-21 16:05 web.xml


The following content:



The package structure looks correct, but when I run localhost:8080/listenerTest_J2EE/ListenTest.do (in this case, I started tomcat manually), I get the following error:


HTTP Status 404 - /listenerTest_J2EE/ListenTest.do

type Status report

message /listenerTest_J2EE/ListenTest.do

description The requested resource (/listenerTest_J2EE/ListenTest.do) is not available.
Apache Tomcat/5.5.25


Seems like tomcat cannot find the classes. The problem I am currently working on is, to fix the path in the web.xml file to match the classes. But I couldn't figure out how to set the path to the classes in the web.xml to meet the requirements of Eclipse J2EE IDE.

Maybe someone has an idea to solve this problem. The complete directory structure looks like as follows:


ds@toshiba:~/programme/apache-tomcat-5.5.25/webapps/listenerTest_J2EE$ l
insgesamt 12K
drwxr-xr-x 3 ds ds 4,0K 2007-09-21 14:56 build/
drwxr-xr-x 3 ds ds 4,0K 2007-09-21 14:57 src/
drwxr-xr-x 4 ds ds 4,0K 2007-09-21 14:56 WebContent/
ds@toshiba:~/programme/apache-tomcat-5.5.25/webapps/listenerTest_J2EE$ l build/classes/com/example/
insgesamt 12K
-rw-r--r-- 1 ds ds 447 2007-09-21 15:04 Dog.class
-rw-r--r-- 1 ds ds 1,6K 2007-09-21 15:49 ListenerTester.class
-rw-r--r-- 1 ds ds 1,2K 2007-09-21 15:04 MyServletContextListener.class
ds@toshiba:~/programme/apache-tomcat-5.5.25/webapps/listenerTest_J2EE$ l src/com/example/
insgesamt 12K
-rw-r--r-- 1 ds ds 169 2007-09-21 14:58 Dog.java
-rw-r--r-- 1 ds ds 610 2007-09-21 15:49 ListenerTester.java
-rw-r--r-- 1 ds ds 425 2007-09-21 14:58 MyServletContextListener.java
ds@toshiba:~/programme/apache-tomcat-5.5.25/webapps/listenerTest_J2EE$ l WebContent/
insgesamt 8,0K
drwxr-xr-x 2 ds ds 4,0K 2007-09-21 14:56 META-INF/
drwxr-xr-x 3 ds ds 4,0K 2007-09-21 14:56 WEB-INF/
ds@toshiba:~/programme/apache-tomcat-5.5.25/webapps/listenerTest_J2EE$ l WebContent/WEB-INF/
insgesamt 8,0K
drwxr-xr-x 2 ds ds 4,0K 2007-09-21 14:56 lib/
-rw-r--r-- 1 ds ds 652 2007-09-21 16:05 web.xml


Thanks,
Patrick

[ September 25, 2007: Message edited by: Patrick Beck ]

[ September 25, 2007: Message edited by: Patrick Beck ]
[ September 25, 2007: Message edited by: Patrick Beck ]

SCJP5<br />SCWCD<br />SCBCD (preparing)<br />IBM/Lotus CLS, CLP, PCLP R5/R6/R7<br />LPIC-1, LPIC-2
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

1) When you run Tomcat internal to Eclipse, you don't get the top-level start/welcome Tomcat page. You'll have to create an application.

2) You don't need to change the path in web.xml. It will be able to see your source directory just fine. I think you are jumping to conclusions about the error you are receiving. The error is a basic "something isn't right" message and you usually get more information about what went wrong by clicking the Console tab (which should be near the Servers tab).

I highly recommend not putting your application directories under the Tomcat directory folders. There's no need for it if you are running an IDE-internal instance of Tomcat and I think it will only make things more confusing.

It might be a good idea to make an index.html page (which you will put directly under WebContent) and test to see if you can get it working first.


A good workman is known by his tools.
Amit Batra
Ranch Hand

Joined: Mar 04, 2006
Posts: 361
patrick,

maybe there are 2 instances of Tomcat running. go to control panel->Administrative tools->services->and look for apache tomcat. If its running stop it. and then start tomcat from within Eclipse. alternatively leave that instance running and don't start tomcat from within eclipse and see if it deploys correctly.
[ September 26, 2007: Message edited by: Amitabha Batranab ]
Patrick Beck
Ranch Hand

Joined: Nov 07, 2006
Posts: 82
Thank you for your answers Marc & Amitabha,
it helped me and now it works fine.

Patrick
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Questions to Eclipse J2EE IDE