JavaEETutorial hello2 example
When I open the hello2 example project folder in Netbeans 5.5 I get an error message stating that i need to right click the project and select Resolve Missing server problem. Tomcat 5.5.17 is up and running. Any clues on fixing this problem will be appreciated
I solved the Missing server problem by replacing the value of j2ee.server.type formerly
j2ee.server.type=J2EE
now reads
j2ee.server.type=Tomcat55
in hello2/nbproject/project.properties
Now getting a deployment error. Again if anyone is following this thread and can help me with the problem I will appreciate it.
Clicking on the ouput screen error link takes me to the following code in hello2/nbproject/build-impl.xml
<target name="-run-deploy-nb" if="netbeans.home">
<nbdeploy debugmode="false" clientUrlPart="${client.urlPart}" forceRedeploy="${forceRedeploy}"/>
</target>
I've compared it to another project that deploys ok and I don't see any differences.
Ok I figured out the client.urlPart is another propertie in hello2/nbproject/project.properties formerly it read
client.urlPart=/greeting
now reads
client.urlPart=/hello2/greeting
the project deploys but the resulting web page is
HTTP Status 404 - //hello2/greeting
--
type Status report
message //hello2/greeting
description The requested resource (//hello2/greeting) is not available.
--
Apache Tomcat/5.5.17
I'm still hoping for a little help here if any of you know what my problem is.
I changed the mapping in the web.xml file from
<servlet-mapping>
<servlet-name>GreetingServlet</servlet-name>
<url-pattern>/greeting</url-pattern>
</servlet-mapping
to
><servlet-mapping>
<servlet-name>GreetingServlet</servlet-name>
<url-pattern>/hello2/greeting</url-pattern>
</servlet-mapping>
it now works except the duke.waving.gif doesn't display
My Tomcat server was bundled with netbeans 5.5 which I did download from Sun and the tutorial speaks specifically about using netbeans 5.5 still you could be right since I had to make the property change to get it to deploy on Tomcat. Someone else has suggested that the path to the gif may not be right. I looked at the generated html source code and its.
img src="duke.waving.gif" alt="Duke waving"
I'm new to this but I assume the path I'm looking for would be in the deployed .war on the server, which I think since the gif is in the root of the war the absolute address would be
"http://localhost:8084//hello2/duke.waving.gif"
If I plug that into a browser I get a 404 error requested resource not available.
If I right click Project go to Properties -> Run The Server drop down menu is empty and apparently can't be typed in. Context Path is empty, I tried putting /hello2 in there. The relative url is /hello2/greeting. Still haven't figured this out if anybody has some insight on it I will appreciate it.
Nevermind, I just figured it out. It was the path. The relative path from the greeting servelet was 3 directories up so the path was
../../../duke.waving.gif
once I made the correction in the out.println statement of the GreetingServelet.java file it worked. Thank you for your suggestion DOEACC. Though I found it on my own since you are the only reply I got at all, I think you deserve the dukestar.
Message was edited by:
paul_chancey