aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes trying to run my first project Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "trying to run my first project" Watch "trying to run my first project" New topic
Author

trying to run my first project

Sumit Khurana
Ranch Hand

Joined: Sep 19, 2010
Posts: 68

Hi friends,

This is my first web project and first post in this forum.
I am using MyEclipse 6 for my programs.

I opened a new project and tried to run it.
But the tomcat server of MyEclipse was not able to find a library.


This thing i always sees in the console..


12-Feb-2011 20:56:48 org.apache.catalina.core.AprLifecycleListener init
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\MyEclipse 6.0\bin;C:\Program Files\MyEclipse 6.0\myeclipse\eclipse\plugins\com.genuitec.eclipse.easie.tomcat.myeclipse_6.0.0.zmyeclipse60020070820\tomcat\bin
12-Feb-2011 20:56:50 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
12-Feb-2011 20:56:50 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 3351 ms
12-Feb-2011 20:56:50 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
12-Feb-2011 20:56:50 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.13
12-Feb-2011 20:56:52 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
12-Feb-2011 20:56:52 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
12-Feb-2011 20:56:52 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/125 config=null
12-Feb-2011 20:56:53 org.apache.catalina.startup.Catalina start
INFO: Server startup in 2840 ms

I thing the problem is with this bold line....

And now i have 1 index.JSP file and 1 Web.xml which was automatically produced by MyEclipse 6.
so,i don't think that there would be a problem with these files..

I wrote this line on the browser...

http://localhost:8080/HelloWorld

i have also run this project on another system but on that it was running fine.

I don't know what to do.
please help!!

Thank you,

Sumit
Darren Littlepage
Ranch Hand

Joined: Dec 27, 2010
Posts: 35
Why are you using Eclipse? Are you following some book that instructs you to do that?
I am not using any IDE and I am following the Head First book.


OCPJP for Java 6 on 01/2011
Sumit Khurana
Ranch Hand

Joined: Sep 19, 2010
Posts: 68

No Darren,My friend suggested me to start with the Eclipse...
n I have just started to read the Head First Servlet and Jsp.

i am confused about how to run the programs of servlet and JSP through Tomcat directly thats why i am using eclipse...
Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

Howdy Sumit!

Head First tries to encourage you to start developing applications directly using tomcat instead of Eclipse or any other IDE. The reason is the same as with the SCJP - sometimes the IDE does something for you without even bothering telling you about it. It might be frustrating for the newcomers, as well as when you need to type something by yourself you're remembering it better.

I doubt the warning shown by you is the reason of your problem.

Could you please prepare the structure of your web application (you know - main directory, WEB-INF directory, web.xml in it etc.) along with your files in the directories and show it to us?

After this, we can together try -- step by step -- solve your problem :-)

Cheers!


OCP Java SE 6 Programmer, OCM Java SE 6 Developer, OCE Java EE 6 JSPSD, OCE Java EE 6 EJBD, OCE Java EE 6 JPAD, Spring 3.0 Core Professional.
Sumit Khurana
Ranch Hand

Joined: Sep 19, 2010
Posts: 68

Howdy! pedro,

thanks for reading n replying to my post,

Main structure of my web app is:

Helloworld
@@|
@@|-Webroot
@@@@|
@@@@|-META-INF
@@@@| @@ |-MANIFEST.MF
@@@@|
@@@@|-WEB-INF
@@@@|@@ |-lib(folder)
@@@@|@@ |-Web.xml
@@@@|
@@@@|-index.jsp

The content of index.jsp is:


<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>

<body>
This is my first ever JSP page. <br>
<p>This design is basically nothing</p>
</body>
</html>

The content of web.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>

n there is nothing in the lib folder..and this is my small helloworld web app
Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

Ok Sumit, so:
- is your web.xml file called web.xml or with capitalized W like on your diagram (Web.xml)?
- What is the result of starting the server with so defined application? 404 Error, cannot load page, ...?

You can try to prepare this application all by yourself (which is preferred for SCWCD candidates), by creating a simplified web application structure:

HelloWorld
|-- WEB-INF
| `-- web.xml
`-- index.jsp


That's all you need for this simple application.

Now put the code you posted into the index.jsp and web.xml files (or just copy the ones you already have).

I guess you have a Apache Tomcat installed already (what version?) if so, than copy this whole HelloWorld directory (application) into the TOMCAT_HOME/webapps/ directory and execute TOMCAT_HOME/bin/startup.sh.

You can also take a look at tomcat logs at TOMCAT_HOME/logs/catalina.out if it shows something gone wrong. After this - try opening:
http://localhost:8080/HelloWorld in your browser and tell us what you'll see.

PS. You need to be sure that no other Tomcat instance is running on the specified port. You can do that using netstat command if you're on Linux or i.e. windows system manager to see what processes are currently running. You can also test it by going to http://localhost:8080 and seeing if it will show 'cannot establish connection' type of error (Tomcat is off) or 404 Tomcat-style layout (tomcat is on).
PS2. You can use the "code" tag for the code you show, as it will increase the readability of your post

Cheers!
Sumit Khurana
Ranch Hand

Joined: Sep 19, 2010
Posts: 68

Thanks pedro for helping me and giving your precious time

Now,I have understood completely!!
Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

No problem Rancher. Hope it worked.

Cheers!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: trying to run my first project