It's not a secret anymore!
The moose likes JBoss/WildFly and the fly likes error in running the sample application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "error in running the sample application" Watch "error in running the sample application" New topic

error in running the sample application

beata jane
Ranch Hand

Joined: Sep 10, 2009
Posts: 43
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:
file: index.jsp
desc: Test installation of Java EE SDK 5
<title>Hello World - test the Java EE SDK installation
for (int i = 1; i < 5; i++)
<h<%=i%>>Hello World</h<%=i%>>
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:
<?xml version="1.0"?>
<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:

please help me to solve this.
Thanking you.
Peter Johnson

Joined: May 14, 2008
Posts: 5852

What error are you getting?

JBoss In Action
beata jane
Ranch Hand

Joined: Sep 10, 2009
Posts: 43
I copied the ear file and pasted it on jboss/server/all/deploy....
Then in the browser i typed http:\localhost:8080\hello ....
It is showing me 404 error..
Peter Johnson

Joined: May 14, 2008
Posts: 5852

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.
I agree. Here's the link:
subject: error in running the sample application
jQuery in Action, 3rd edition