Tutorials >> Java >> JEE >> How to build and test a simple helloworld.war web application archive and deploy on a weblogic server

assumption:

weblogic domain with 1 admin server and 1 managed server exists

weblogic domain home directory is /app/weblogic/domain1

(1).  if ./applications/helloworld directory does not exist create it

$ cd /app/weblogic/domain1

$ mkdir -p applications/helloworld

 

(2). create WEB-INF directory under applications/helloworld

$ cd applications/helloworld

$ mkdir WEB-INF

 

(3). With a text editor create a simple index.jsp file

$ vi index.jsp

index.jsp

<!doctype html>
<html>
<head>
<title>JSP Test</title>
<%!
String message = "Hello, World.";
%>
</head>
<body>
<h2><%= message%></h2>
<%= new java.util.Date() %>
</body>
</html>

(4)  create web.xml inside WEB-INF directory

web.xml

<web-app>
<display-name>Hello World</display-name>
</web-app>

(5) verify dir & file structure.  In /app/weblogic/domain1/applications/helloworld we should have

./WEB-INF
./index.jsp
./WEB-INF/web.xml

(6) create helloworld.jar

$ jar cvf helloworld.jar *.jsp WEB-INF

(7) login to the weblogic admin console,

select Lock & Edit,

Deployments -> Install

point the path to /app/weblogic/domain1/applications/helloworld

select the helloworld.war file displayed

click Next

proceed with the app deployment and target to the running managed server instance.

finally activate changes

(8) if application status is "Prepared", select it and start

(9) Test it by

http://<weblogic server ip>:<weblogic port>/helloworld/