aspose file tools*
The moose likes BEA/Weblogic and the fly likes To the man who shares my namesake...Aaron Mulder Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "To the man who shares my namesake...Aaron Mulder" Watch "To the man who shares my namesake...Aaron Mulder" New topic
Author

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

Aaron Fenzi
Greenhorn

Joined: Oct 15, 2002
Posts: 21
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 ]

Java-ridden fury with an attitude.<p>If you don't get caught, it's not cheating.
Aaron Mulder
Author
Ranch Hand

Joined: Feb 25, 2003
Posts: 65
Uhh, sure. (Kind of hard to say if I can really help at this point... ) Want to pass along some more details?


<a href="http://www.javaranch.com/bookpromo.jsp" target="_blank" rel="nofollow">WebLogic Book Giveaway</a> 2/25-2/27
Aaron Fenzi
Greenhorn

Joined: Oct 15, 2002
Posts: 21
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

Joined: Feb 25, 2003
Posts: 65
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

Joined: Oct 15, 2002
Posts: 21
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

Joined: Feb 25, 2003
Posts: 65
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

Joined: Feb 25, 2003
Posts: 65
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

Joined: Oct 15, 2002
Posts: 21
So, the index.html page should be under BookNook, and the servlets should be under WEB-INF/classes?
Aaron Mulder
Author
Ranch Hand

Joined: Feb 25, 2003
Posts: 65
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

Joined: Oct 15, 2002
Posts: 21
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

Joined: Feb 25, 2003
Posts: 65
I'm not sure how to link directly to it, but see the 6th post in this thread ("It depends on...").
Aaron Fenzi
Greenhorn

Joined: Oct 15, 2002
Posts: 21
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

Joined: Feb 25, 2003
Posts: 65
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

Joined: Oct 15, 2002
Posts: 21
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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: To the man who shares my namesake...Aaron Mulder
 
Similar Threads
And the winners are...
Difference in admin console between wls 6.1 and 7.1
AJAX - XML File Max Size?
SUN announces new SCJA exam
weblogic.ejbc and ear file.