File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes BEA/Weblogic and the fly likes WebLogic 6.0 -- The Hello World Example 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 "WebLogic 6.0 -- The Hello World Example" Watch "WebLogic 6.0 -- The Hello World Example" New topic
Author

WebLogic 6.0 -- The Hello World Example

JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
I am using the WebLogic 6.0 and trying to make the HelloWorldServlet example work. I got the Internal Server Error message.
1. I put the HelloWorldServlet.class under the directory:
c:\bea\wlserver6.0sp1
\config\mydomain\applications\DefaultWebApp_myserver
\WEB-INF\classes
2. see below for the web.xml file in the
c:\bea\wlserver6.0sp1
\config\mydomain\applications\DefaultWebApp_myserver\
\WEB-INF
<?xml version="1.0" ?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
<servlet-name>
HelloWorldServlet
</servlet-name>
<servlet-class>
examples.servlets.HelloWorldServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>
HelloWorldServlet
</servlet-name>
<url-pattern>
helloWorld
</url-pattern>
</servlet-mapping>
</web-app>
3. I called the servlet from IE browser with the following URL:
http://localhost:7001/helloWorld
and I got Error 500 -- Internal Server Error
Could anybody pinpoint what I did wrong? Thanks in advance
Saran Vel
Ranch Hand

Joined: Nov 03, 2000
Posts: 111
Hi,
A small change..
U need to put u'r classes in config\mydomain\applications\mydomainWebApp\WEB-INF\classes.
U can add u'r XML codes in the web.xml which already exists there..
Hope u will get it..
Saran.
[This message has been edited by Saran Vel (edited April 17, 2001).]


Saran
Sun Certified Java2 Programmer
JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
Saran: Sorry, I do not get it. I think that I do not quite understand.
Do I put my class file HelloWorldServlet.class under the directory:
c:\bea\wlserver6.0sp1
\config\mydomain\applications\DefaultWebApp_myserver
\WEB-INF\classes
This is the directory under which the "quick start guide" tells me to put my class files. When I installed the WebLogic6.0, "bea" is my home directory, and the wlserver6.0sp1 is the directory in which I installed the WebLogic Server software. I did not specify my own administrative domain name, server name, and therefore,
c:\bea\wlserver6.0sp1
\config\mydomain\applications\DefaultWebApp_myserver
\WEB-INF\classes
are all default names.
Did I do anything wrong with my web.xml file?
Saran Vel
Ranch Hand

Joined: Nov 03, 2000
Posts: 111
While u installing server by default the name of the domain is mydomain and name of server is myserver.
After installing u will find a folder config\mydomain. There u will find setEnv.cmd file.
There u need to set up the following class paths:
:setEnv
set APPLICATIONS=%WL_HOME%\config\mydomain\applications
set CLIENT_CLASSES=%WL_HOME%\config\mydomain\clientclasses
set SERVER_CLASSES=%WL_HOME%\config\mydomain\serverclasses
set WEBAPP_CLASSES=%WL_HOME%\config\mydomain\applications\mydomainWebApp\WEB-INF\classes
The bolded directory is the one where u need to put all u'r servlets and jsp's.
But if u include defaultWebApp_myserver and the directory which holds u'r server related files then u can use as mentioned in quickstart.(I guess it is.. bec i didn't do this way..)
While installing, there will be two directries under mydomain\applications..
1.mydomainWebApp
2.DefaultWebApp_myserver
the mydomainWebApp\WEB-INF will contain classes folder by default where u no need to create one.. and u include all u'r servlet's class files there.
The web.xml related codes can be included in the web.xml file which is already there..
Then u start the server.. nad make sure u included the class paths which i mentioned..
after starting the server u invoke the servlet from the browser by giving, http://localhost:7001/mydomainWebApp/quickStartServlet
if u r using defaultWebApp_myserver then i guess u can invoke
servlet by giving http://localhost:7001/quickStartServlet..
Hope this clears..
Saran
(Sorry for my previous unclear answer.. i just said tyhe way i used to do..
And sorry for spelling mistakes..There is lot of typing.. u know..)

[This message has been edited by Saran Vel (edited April 17, 2001).]
JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
Saran: Thank you for the explanation. However, I have to bother you again. I think that I am still missing something.
After the installation, I only found one directory under
c:\bea\wlserver6.0sp1\config\mydomain\applications
which is DefaultWebApp_myserver
A.
I followed your suggestions and the setEnv.cmd file under the
c:\bea\wlserver6.0sp1\config\mydomain
now looks like:
:setEnv
set CLASSPATH=%JAVA_HOME%\lib\tools.jar;%WL_HOME%\lib\weblogic_sp.jar;%WL_HOME%\lib\weblogic.jar;%CLASSPATH%
set PATH=%WL_HOME%\bin;%JAVA_HOME%\bin;%PATH%
set APPLICATIONS=%WL_HOME%\config\mydomain\applications
set CLIENT_CLASSES=%WL_HOME%\config\mydomain\clientclasses
set SERVER_CLASSES=%WL_HOME%\config\mydomain\serverclasses
set WEBAPP_CLASSES=%WL_HOME%\config\mydomain\applications\DefaultWebApp_myserver\WEB-INF\classes
@echo.
@echo Your environment has been set.
:finish
B. I put the HelloWorldServlet.class file under
c:\bea\wlserver6.0sp1
\config\mydomain\applications\DefaultWebApp_myserver
\WEB-INF\classes
C. my web.xml file stays the same as stated
D. I typed http://localhost:7001/helloWorld in the IE browser
and I still get the Internal Server Error. Please help.
Saran Vel
Ranch Hand

Joined: Nov 03, 2000
Posts: 111
Hi,
It's working for me..
I think u need to make a small change..
U didn't included the paths u set, in the classpath.. i mean,
after doing this..
set PATH=%WL_HOME%\bin;%JAVA_HOME%\bin;%PATH%
set APPLICATIONS=%WL_HOME%\config\mydomain\applications
set CLIENT_CLASSES=%WL_HOME%\config\mydomain\clientclasses
set SERVER_CLASSES=%WL_HOME%\config\mydomain\serverclasses
set WEBAPP_CLASSES=%WL_HOME%\config\mydomain\applications\DefaultWebApp_myserver\WEB-INF\classes
u need to set the class path as..
set CLASSPATH=%JAVA_HOME%\lib\tools.jar;%WL_HOME%\lib\weblogic_sp.jar;%WL_HOME%\lib\weblogic.jar;%WL_HOME%\lib\xmlx.jar;%WL_HOME%\samples\eval\cloudscape\lib\cloudscape.jar;%CLIENT_ CLASSES%;%SERVER_CLASSES%;%WEBAPP_CLASSES%;C:\bea;
Tell me whether u got it or not..
Saran
JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
Saran: I have found the mistake that I made. It is working now. Because the HelloWorldServlet.java is in a package, I should have put the HelloWorldServlet.class under the subdirectory of "classes":
c:\bea\wlserver6.0sp1
\config\mydomain\applications\DefaultWebApp_myserver
\WEB-INF\classes\examples\servlets
Thanks a lot for coaching every step that I take. Now, I have another question. In case that MyFile.java is NOT in a package, and I put MyFile.class under the "classes" directory:
c::\bea\wlserver6.0sp1
\config\mydomain\application\DefaultWebApp_myserver
\WEB-INF\classes
Do I simply put MyFile in the <servlet-class> element of the web.xml file? and my web.xml file looks like:
<?xml version="1.0" ?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
<servlet-name>
MyFile
</servlet-name>
<servlet-class>
MyFile
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>
MyFile
</servlet-name>
<url-pattern>
myfile
</url-pattern>
</servlet-mapping>
</web-app>
I typed http://localhost:7001/myfile
in the IE browser and I got Error404 -- Not Found
I think that I put the class file at the right place. And I simply gave the file name in the web.xml because there is no package involved. What mistakes I am making this time? Am I bothering you too much?
Saran Vel
Ranch Hand

Joined: Nov 03, 2000
Posts: 111
Hi,
It's again working for me, when i do, whatever u have done..meaning, removing the package..
Sorry.. i cann't figure out this time..
Nothing like bothering.. u know.. After a long gap i looking into servlets bec of u.. actually i didn't explored much in WLS6.0 for servlets.. I'm working on EJB most of the time..
And moreover if i able to solve the problem then its makes me happy..u know..its common human psychology.. i guess..
Have a nice day..
Saran
JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
Saran, Thank you. I have the problem solved. What I learned is that I have to "restart" the server.
Saran Vel
Ranch Hand

Joined: Nov 03, 2000
Posts: 111
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: WebLogic 6.0 -- The Hello World Example
 
Similar Threads
Running a simple servlet in Weblogic6.1
How to run servlet on Weblogic 6.0
Mr. Hanna, Followed Your Advice On Custom Tag, Same Error Message
HelloWorldServlet in Weblogic 6.0
Mr. Simon Brown, Could You Help With This Custome Tag Problem?