• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Questions to Eclipse J2EE IDE

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your answers Marc & Amitabha,
it helped me and now it works fine.

Patrick
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic