• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

To the man who shares my namesake...Aaron Mulder

 
Aaron Fenzi
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aaron,
First of all, it is a pleasure to speak with such an accomplished author. When I think of the greats, I think Shakespeare, Melville, Hemingway, Mulder.
Anyway, I'm trying to get a bunch of files up and running on WebLogic, along with a database connection. Do you think you could give me a hand?

You are the man. Thanks.
[ February 25, 2003: Message edited by: Aaron Fenzi ]
 
Aaron Mulder
Author
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Uhh, sure. (Kind of hard to say if I can really help at this point... ) Want to pass along some more details?
 
Aaron Fenzi
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I sure will. (You'll have to forgive me, since I came down with a pretty high fever...again.)
Anyway, I'm trying to get an old project to work on WebLogic 7.0 instead of Tomcat. I just need to know the steps to do so, including directory structures, configurations of necessary .xml files, etc.
For example, let's say that my project folder is stored in the C:\bea\user_projects\mydomain\applications\BookNook file. I created two folders in that directory: WEB-INF and images folder, and in the WEB-INF folder, I created two more folders: classes and lib. I stored the servlet classes in the classes folder, and nothing in the lib folder yet.
Anyway, I need to know several things: do I need to configure any .xml files other than web.xml? If so, how would I need to configure them? Also, based on my current folder directory, could you show me how to write up my web.xml file (with examples), and finally, could you show me the proper URL to use when I want to bring the application up on the web?

Aaron, I really appreciate whatever help you can give me.
 
Aaron Mulder
Author
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Easiest thing to do for portability is package the web app into a WAR. It should indeed have a WEB-INF dir with the web.xml deployment descriptor and subdirs for classes (servlet classes) and lib (3rd party libs). You should be able to deploy that and get default behavior under either Tomcat or WebLogic, though it probably won't work right if you've declared and used security roles in yupr web.xml (more on that below). You can deploy an exploded directory in either product instead of a WAR, but then it's not as easy to make sure everything is laid out and identified correctly; up to you.
As far as what to put in your web.xml file, I'd have to refer you to a basic J2EE reference. I can't give you a reasonable example because I don't know what servlets and JSPs you want to use. WebLogic ships with a couple web app examples under weblogic70/samples/server/src/examples/webapp/ which you can refer to. But the short story is, if you have something working in Tomcat, you can use the same web.xml in WebLogic.
WebLogic adds a second deployment descriptor, weblogic.xml, in the same location as the main web.xml (WEB-INF/). That has additional WebLogic-specific options for configuring your web app. I go through them all in the book, but probably the most important ones will be mapping J2EE security roles in the web.xml to actual users and groups in WebLogic, and mapping EJB references and resource references declared in web.xml to actual EJBs and resources available in WebLogic. we've also talked in other threads about the settings that control the JSP compiler.
To access the app, start by constructing an http URL to the server, with the host name and port it's running on (by default this would be http://localhost:7001/ ). The next bit of the URL is, by default, the name of your web application (the war or directory name without any .war extension). So if your app is BookNook.war, the working URL is http://localhost:7001/BookNook/ Then you add on the rest for any servlet or JSP you want to access, based on the path to the JSP in the WAR, or the servlet URL mapping declared in the web.xml file. So to get to welcome.jsp at the top level of the WAR, you'd be looking at http://localhost:7001/BookNook/welcome.jsp
[ February 26, 2003: Message edited by: Aaron Mulder ]
 
Aaron Fenzi
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aaron,
I think my only question now would be concerning the code.
If I have would like to get to my servlets from my index.html page, what would be the proper link to use? For example, if the path of index.html is C:\bea\user_projects\mydomain\applications\BookNook\WEB-INF\Index.html
and the path of the servlets is C:\bea\user_projects\mydomain\applications\BookNook\WEB-INF\classes, what would my link be in the index.html code?
 
Aaron Mulder
Author
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on how you've mapped the servlet in your web.xml deployment descriptor. For example, if the servlet handles all requests to "/foo" or "/foo/*", and your index.html is at the top level of your web application WAR, the index.html should be able to point to the servlet with the relative URL of "foo" (or "foo/bar" if you pass path information to the servlet).
Index.html: http://localhost:7001/myapp/index.html
Servlet: http://localhost:7002/myapp/foo
 
Aaron Mulder
Author
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note as well that it's better to put your index.html directly under BookNook/ than to put it under BookNook/WEB-INF/, since the content under WEB-INF/ is supposed to be hidden from all clients. I assumed in the example above that you put the index.html file at the top level of the WAR, which would be BookNook/
 
Aaron Fenzi
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, the index.html page should be under BookNook, and the servlets should be under WEB-INF/classes?
 
Aaron Mulder
Author
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right (and the servlet classes go in a directory structure reflecting their package):
BookNook/index.html
BookNook/WEB-INF/web.xml
BookNook/WEB-INF/classes/some/package/myservlet.class
 
Aaron Fenzi
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, based on everything we've gone over, if I follow your conventions for the servlet directories, how should I configure the link on the html page to get me to one of the servlets (e.g. ProductLookupPage)?
 
Aaron Mulder
Author
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure how to link directly to it, but see the 6th post in this thread ("It depends on...").
 
Aaron Fenzi
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I only ask because I didn't know if I had to include /servlet(s) in there somehow. (e.g. http://localhost:7001/BookNook/servlet/ProductLookupPage.)
 
Aaron Mulder
Author
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Only if you choose to configure it that way (by mapping your servlet to the URL "servlet/ProductLookupPage" instead of just "ProductLookupPage").
 
Aaron Fenzi
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aaron, I think I have what I need. Thanks for all your help, and if I win the book, you're autographing it for me, brother!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic