aspose file tools*
The moose likes Servlets and the fly likes Getting started with J2EE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Getting started with J2EE" Watch "Getting started with J2EE" New topic
Author

Getting started with J2EE

John Sears
Greenhorn

Joined: Sep 15, 2009
Posts: 14
Hi,
I'm trying to get started learning some technologies for a project I'm working on (struts2 on WebLogic 10), but I'm having a hard time getting just a very basic HelloWorld app going. I have never worked with enterprise java before. As I understand it, the J2EE specification calls for a specific directory structure for a web application. My goal is to put together an application that runs a filter to catch all references to .do files, captures the time they were created (just so I can get an attribute to save), then forwards the request to a JSP that prints a hello message and the time.

If I understand correctly, an enterprise web application needs the following structure (simplified): JSPs in the root directory, and a WEB-INF directory with web.xml and the server-side classes. I guess any referenced jars should go in WEB-INF/lib too.

So, my design is as follows:

BasicFilter.java


HelloWorldSession


HelloWorld.jsp


web.xml




I put these files into the following directory structure:

/Projects/HelloWorld/HelloWorld.jsp
/Projects/HelloWorld/WEB-INF/web.xml
/Projects/HelloWorld/WEB-INF/world/hello/BasicFilter.class
/Projects/HelloWorld/WEB-INF/world/hello/HelloWorldSession.class

When I deploy to WL10, it says that it can prepare correctly but when I try to start it I get java.lang.ClassNotFoundException: world.hello.BasicFilter. I've tried moving the class files directly into the WEB-INF directory and into the HelloWorld directory as well...same error.

If anyone could point me along I would be very grateful! I'm excited to get a skeleton web app going so that I can begin to experiment with frameworks like struts and later Spring.

Thank you for any help!
John
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19761
    
  20

It should be /Projects/HelloWorld/WEB-INF/classes/world/hello/BasicFilter.class

Moving to Servlets as filters and the web application structure are closely related to servlets.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
John Sears
Greenhorn

Joined: Sep 15, 2009
Posts: 14
Ah thank you very much. I didn't realize that that was the convention. My next step will be to package these into an archive-- I believe the way to do this is to put together an Ant build file and create a war? I understand I could also use Maven...

Anyway, thanks again!
 
 
subject: Getting started with J2EE