This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I did as per this described below but i am getting error..
Create a directory on your machine that will be your sandbox for this exercise. We’ll use
C:\BJEE5\Ch02 in this example.
2. Create a new file called index.jsp in that directory using your favorite text editor. Here’s
the code for that file:
desc: Test installation of Java EE SDK 5
<title>Hello World - test the Java EE SDK installation
for (int i = 1; i < 5; i++)
36 CHAPTER 2 ■ GETTING STARTED
3. Create a subdirectory called META-INF, and in this directory create a file called
application.xml. This file contains settings used to identify your application and the
resources it depends on to JBoss, and to configure how users will access said resources.
Create this file with the following contents:
<display-name>Hello Java EE World!</display-name>
4. You need to create a new WAR and EAR file. The WAR file will contain the web components
of the Java EE application, along with a descriptor or “table of contents” that
describes what is in the archive. Web applications frequently consist of many more files
than this simple application, and the WAR is a convenient means of bundling up all of
those files into a single file for deployment. Likewise, an EAR file is a collection of WAR
files, JAR files, and resources that are all meant to operate within the context of a single
application. To create these files, open a command-line window, change your current
directory to the folder you created for this example (e.g., cd\BJEE5\Ch02), and type the
following two commands:
>jar cf web-app.war index.jsp
>jar cf helloworld.ear web-app.war META-INF
5. Copy the resultant EAR file, helloworld.ear, to your JBoss server deployment directory
(C:\jboss\server\all\deploy) and start JBoss from the command line with the command
shown in Figure 2-7.
6. It’s time to test your first JSP page. Start a web browser and open the following URL:
Does your web.xml contain a welcome-file list? If not, does adding one solve the problem?
If that does not help, do the following:
Post the contents of the EAR and WAR using the jar utility. Example: "jar -tf xxx.war"
Exactly where did you place the EAR? Full path, please.
With the EAR deployed, start JBoss AS and post the full console output, starting with the run command you entered all the way through the "started in xxx seconds" line.
By the way, are you just now learning how to work with Java EE applications? (I ask because you seem to be pulling pre-existing apps from a varioety of locations and trying them out.) If so, the first chapter from JBoss in Action (a free download) might be a better way to get started, mainly because that chapter goes through all of the steps needed to build and deploy the app.