wood burning stoves 2.0*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "error in running the sample application" Watch "error in running the sample application" New topic
Author

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
--%>
<html>
<head>
<title>Hello World - test the Java EE SDK installation
</title>
</head>
<body>
<%
for (int i = 1; i < 5; i++)
{
%>
36 CHAPTER 2 ■ GETTING STARTED
<h<%=i%>>Hello World</h<%=i%>>
<%
}
%>
</body>
</html>
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"?>
<application>
<display-name>Hello Java EE World!</display-name>
<module>
<web>
<web-uri>web-app.war</web-uri>
<context-root>/hello</context-root>
</web>
</module>
</application>
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:
http://localhost:8080/hello



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

Joined: May 14, 2008
Posts: 5812
    
    7

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
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

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: http://aspose.com/file-tools
 
subject: error in running the sample application
 
Similar Threads
Adding APP-INF/classes to JBoss EAR classpath
please help
Is it useful to deploy by a .war file?
Jar in the build path of web and EJB application
please help in running this program