Win a copy of OCP Oracle Certified Professional Java SE 11 Developer Practice Tests this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
Sheriffs:
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
Bartenders:
  • Carey Brown
  • salvin francis
  • Piet Souris

NullPointerException from Tomcat

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have got a server application deployed on Tomcat as a SOAP service. When the service is started and a client attemps connecting to it the below given stack trace gets displayed at the command prompt on the server's machine. Can anyone tell me as to what are the possible reasons for such exceptions being thrown? Its very urgent .... please.
 
Ketan KC Chachad
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also the catalina log file is showing the following exception getting logged

I need some help on Apache Tomcat and the possible reasons as to why these exceptions are arising? Any reference material, links and on-line books are welcomed. Thanks in advance
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That exception looks to me like a problem with the way your client's request is formatted, nothing to do with Tomcat. Here is the checkHead method from Tomcat 4.1.27

It looks to me like the response reference is null due to the formatting of the request header lines.
If it was my problem I would use one of the utilities that lets you intercept the full text of request and response.
Bill
 
Ketan KC Chachad
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the reply ..... but the format of the client request is in the form of SOAP messages sent over HTTP. And I have used TCPSniffer to intercept the requests and response sent and received at the client side. Is there any other tool that I can use for intercepting SOAP or HTTP requests and / or responses?
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All I can say is that the exception you got indicates a problem with an extremely long line in the request headers. SOAP messages have HTTP headers that have to be interpreted by the servlet engine before the body gets passed to the SOAP processing servlet. Thats what that "line too long" exception is talking about.
For my SOAP book I wrote a tool similar to TCPSniffer - if you want to try it, you can download it from my SOAP book page.
Please let us know what the problem turns out to be. (Are you using Apache SOAP or Axis or what?)
Bill
 
Ketan KC Chachad
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using Apache SOAP and I have a doubt regarding the usage of the tool created by you. The doubt is regarding the properties file to be created ..... if the Tomcat server is running on say on host 192.168.0.200 and the port on which the rpcrouter is listening is 8000, I mean to say that in the client application the URL for the server is given as http://192.168.0.200:8000/soap/servlet/rpcrouter then
  • what do I write in the properties file if I am executing the tool on the client's machine?
  • And what should the extension of the file be?
  •  
    William Brogden
    Author and all-around good cowpoke
    Posts: 13078
    6
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    The properties file needs to give the name of the host to connect to, the port the host is listening on, and the port you are going to use on the client side. The client is going to address the localhost and port and the utility will translate to the other host and port.
    You can name the properties file anything convenient since you have to open from a file dialog anyway.
    This should all be in a HowToUse.txt file with the download.
    Bill
     
    Ketan KC Chachad
    Ranch Hand
    Posts: 77
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    So is the following the correct content of the properties file?


    host=192.168.0.200
    hostport=8000


    If it is then do I have to change the server address in the URL for the client application to the local address at which this utility is listening to? And do I need to specify the local port also in this properties file?
     
    William Brogden
    Author and all-around good cowpoke
    Posts: 13078
    6
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    If it is then do I have to change the server address in the URL for the client application to the local address at which this utility is listening to? And do I need to specify the local port also in this properties file?


    The server address and port have to be the ones the server is actually using - you don't change those.
    You have to specify the local port that you want the utility to listen to and the client software has to address that port.
    Just like TCPSniffer, the utility has to intercept all communication between client and server and relay it on while keeping a copy.
    Bill
     
    Ketan KC Chachad
    Ranch Hand
    Posts: 77
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    The server address and port have to be the ones the server is actually using - you don't change those.


    Do you mean that the server address and the port given in the client application's URL does not change? Then what does this mean?

    You have to specify the local port that you want the utility to listen to and the client software has to address that port.


    Also is the properties file content I have posted correct?
     
    William Brogden
    Author and all-around good cowpoke
    Posts: 13078
    6
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    The properties file has to specify the host name and port that the service is actually using - the utility has to know where to connect.
    The properties file has to specify the localhost port that you are going to have the client talk to. The utility is going to listen on that port for a connection that it is going to relay to the service, while capturing the transmitted data.
    Your client has to talk to the utility on the localhost and the port specified. It has to use that connection instead of the application URL. If you used these properties:
    host=192.168.0.200
    hostport=8000
    clientport=9000
    Then the client would have to address localhost:9000 - the utility would make a connection to 192.168.0.200 and relay the request from the client to the service while capturing the text. If all goes well you can then see what is odd about the request header.
    Bill
    [ December 03, 2003: Message edited by: William Brogden ]
     
    Hold that thought. Tiny ad:
    Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    reply
      Bookmark Topic Watch Topic
    • New Topic