Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error in output of First program in HFSJ

 
nishant dahiya
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have done exactly as per the directions given in HFSJ page 30 program , i also started tomcat showing its home page at localhost:8080 but when i try to type http://localhost:8080/ch1/Serv1 i get the 404 error.

i can't exactly figure out what the problem is . I have build the exact directories as well as copied web.xml to WEB-INF and Ch1Servlet.java to classes in tomcat directory.


Can anybody please help me out??
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the server start up normally ?
What does your catalina logfile say ?
 
nishant dahiya
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah server started normally and i dont know what catalina are you talking about can you explain a bit please.
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in your tomcat installation folder there is a logs folder. I would suggest you stop the server, delete whatever is in there, and then restart and see what files are created and what error messages they contain ...
 
nishant dahiya
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you want me to post my catalina logs here
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, but please use code tags ;)
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have build the exact directories as well as copied web.xml to WEB-INF and Ch1Servlet.java to classes in tomcat directory.

That's Ch1Servlet.class you need in the classes directory. And what tomcat directory are you referring to ? Do you mean a directory you made under webapps ?

(moving this thread to the Tomcat forum)
 
nishant dahiya
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah i am talking about the same Ch1Servlet.class file , which i have written as Ch1Servlet.java file by mistake.

Also by tomcat directory i am talking about the whole directory structure given in HFSJ at page 31 i.e tomcat\webapps\ch1\WEB-INF\classes.

 
nishant dahiya
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sebastian Janisch wrote:Yes, but please use code tags ;)


I am attaching my catalina logs file here please have a look.

sry bt its showing that files with .log extension can't be attached , i also tried to attach it as a text file but that also fails , what should i do??
 
nishant dahiya
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is my catalina log file

Aug 25, 2009 4:56:39 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.5.0_05\bin;.;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\ORANT\BIN;C:\Program Files\Java\jdk1.5.0_05\bin;C:\Program Files\Common Files\Nero\Lib\;C:\Program Files\Common Files\Nero\Lib\
Aug 25, 2009 4:56:39 AM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Aug 25, 2009 4:56:39 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1154 ms
Aug 25, 2009 4:56:39 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Aug 25, 2009 4:56:40 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.28
Aug 25, 2009 4:56:40 AM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Aug 25, 2009 4:56:41 AM org.apache.catalina.startup.ContextConfig applicationWebConfig
SEVERE: Parse error in application web.xml file at jndi:/localhost/ch1/WEB-INF/web.xml
java.io.UnsupportedEncodingException: ISO-8851-1
at sun.io.Converters.getConverterClass(Converters.java:218)
at sun.io.Converters.newConverter(Converters.java:251)
at sun.io.ByteToCharConverter.getConverter(ByteToCharConverter.java:68)
at sun.nio.cs.StreamDecoder$ConverterSD.<init>(StreamDecoder.java:224)
at sun.nio.cs.StreamDecoder$ConverterSD.<init>(StreamDecoder.java:210)
at sun.nio.cs.StreamDecoder.forInputStreamReader(StreamDecoder.java:77)
at java.io.InputStreamReader.<init>(InputStreamReader.java:83)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.createReader(XMLEntityManager.java:2012)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager$ScannedEntity.setReader(XMLEntityManager.java:2455)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.setEncoding(XMLEntityScanner.java:188)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanXMLDeclOrTextDecl(XMLDocumentFragmentScannerImpl.java:734)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$XMLDeclDispatcher.dispatch(XMLDocumentScannerImpl.java:721)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1562)
at org.apache.catalina.startup.ContextConfig.applicationWebConfig(ContextConfig.java:348)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1048)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4184)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:927)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:890)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1150)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Aug 25, 2009 4:56:41 AM org.apache.catalina.startup.ContextConfig start
SEVERE: Marking this application unavailable due to previous error(s)
Aug 25, 2009 4:56:41 AM org.apache.catalina.core.StandardContext start
SEVERE: Error getConfigured
Aug 25, 2009 4:56:41 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/ch1] startup failed due to previous errors
Aug 25, 2009 4:56:42 AM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Aug 25, 2009 4:56:42 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Aug 25, 2009 4:56:42 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/15 config=null
Aug 25, 2009 4:56:42 AM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Aug 25, 2009 4:56:42 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2871 ms
Aug 25, 2009 4:58:33 AM org.apache.coyote.http11.Http11BaseProtocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8080
Aug 25, 2009 4:58:34 AM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
Aug 25, 2009 4:58:34 AM org.apache.coyote.http11.Http11BaseProtocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080
Aug 25, 2009 4:58:34 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: Failed shutdown of Apache Portable Runtime
 
Stanislav Belenitsky
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

it is probably too late and you already have the answer, but for the sake of everyone else who may hit the same error.

I have just hit the same error... found an answer on some German website.

There is a type mistake in the book. Valid ISO encoding version is "ISO-8859-1".

If you take a look at other web.xml files that Tomcat uses you will see that is the version they use.

Regards.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic