aspose file tools*
The moose likes Tomcat and the fly likes Unknown Host Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Unknown Host" Watch "Unknown Host" New topic
Author

Unknown Host

Matt Kurz
Ranch Hand

Joined: Jan 02, 2010
Posts: 40
I'am taking a look at a webapp which connects per webservice as client with cxf and soap to several other webservices and sends an email in any case. It's a tapestry webapp which runs perfect on antoher machine under tomcat 7. It also runs perfect on my machine with mvn jetty:run. But if I try to run it with tomcat 6 on my machine I get "Could not connect to ... Unknown host..." for all connections. I can ping the server. I have no idea why it doesn't work in tomcat and what I can check next. In the first attempts it worked. But suddenly it didn't. I reinstalled tomcat6 on my ubtuntu 10.04 machine per package manager 2 times, but the error was always the same. I removed it and downloaded tomcat 6 from the apache servers, but again the same. My pc can dissolve the URL's, but it seems like tomcat cannot. Or do I have to allow the Url's in a config file? Has someone any idea?
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3829

In the first attempts it worked. But suddenly it didn't

Have you tried other options (i.e.: Tomcat 7 etc..) after this? Was there any change in your network/proxy etc... And for what you get this "Could not connect to...Unknown host...." error?


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Matt Kurz
Ranch Hand

Joined: Jan 02, 2010
Posts: 40
Vijitha Kumara wrote:
In the first attempts it worked. But suddenly it didn't

Have you tried other options (i.e.: Tomcat 7 etc..) after this? Was there any change in your network/proxy etc... And for what you get this "Could not connect to...Unknown host...." error?


I get the same error with tomcat 7. I change nothing on my network/proxy. How I've said: It runs with mvn jetty:run. I get this error if I use tomcat. It's thrown when the webapp tries to connect to smtp.mycomp.com. I can ping smtp.mycomp.com.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3829

It's a tapestry webapp which runs perfect on antoher machine under tomcat 7

Probably a check with this configuration as it works there? Have you checked anything else in the logs for this?
Matt Kurz
Ranch Hand

Joined: Jan 02, 2010
Posts: 40
I try the app on another pc later. At the moment I can't. In the meantime here a part of the log with some stuff changed to assure anonymity:


Address: http://99.999.999.201:7777/xyz/bc/soap/rfc
Encoding: UTF-8
Content-Type: text/xml
Headers: {Accept=[*/*], Authorization=[Basic aHR0cF9jc2dfcWlhOnJvbmphMTE=], SOAPAction=["http://www.ung.com/ONSD_COMPANY_SERVICE"]}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:ONSD_COMPANY_SERVICE xmlns:ns2="urn:ung-com:document:ung:rfc:functions"><TABLE><item/></TABLE></ns2:ONSD_COMPANY_SERVICE></soap:Body></soap:Envelope>
--------------------------------------
2011-11-07 15:39:32,648 DEBUG [Renew Data thread-1] org.apache.cxf.transport.http.Headers: Accept: */*
2011-11-07 15:39:32,648 DEBUG [Renew Data thread-1] org.apache.cxf.transport.http.Headers: Authorization: Basic aHR0cF9jc2dfcWlhOnJvbmphMTE=
2011-11-07 15:39:32,648 DEBUG [Renew Data thread-1] org.apache.cxf.transport.http.Headers: SOAPAction: "http://www.ung.com/ONSD_COMPANY_SERVICE"
2011-11-07 15:39:32,663 DEBUG [Renew Data thread-1] org.apache.cxf.transport.http.TrustDecisionUtil: No Trust Decider for Conduit '{urn:ung-com:document:ung:rfc:functions}ONSD_COMPANY_SERVICEPortTypePort.http-conduit'. An afirmative Trust Decision is assumed.
2011-11-07 15:39:32,673 DEBUG [Renew Data thread-1] org.apache.cxf.transport.http.HTTPConduit: Sending POST Message with Headers to http://99.999.999.201:7777/xyz/bc/soap/rfc Conduit :{urn:ung-com:document:ung:rfc:functions}ONSD_COMPANY_SERVICEPortTypePort.http-conduit
Content-Type: null

2011-11-07 15:39:32,675 DEBUG [Renew Data thread-1] org.apache.cxf.phase.PhaseInterceptorChain: Invoking handleFault on interceptor org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor@1174ec5
2011-11-07 15:39:32,675 DEBUG [Renew Data thread-1] org.apache.cxf.phase.PhaseInterceptorChain: Invoking handleFault on interceptor org.apache.cxf.interceptor.StaxOutEndingInterceptor@2d63c5bb
2011-11-07 15:39:32,675 DEBUG [Renew Data thread-1] org.apache.cxf.phase.PhaseInterceptorChain: Invoking handleFault on interceptor org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInterceptor@5fab9dac
2011-11-07 15:39:32,675 DEBUG [Renew Data thread-1] org.apache.cxf.phase.PhaseInterceptorChain: Invoking handleFault on interceptor org.apache.cxf.interceptor.BareOutInterceptor@75db5427
2011-11-07 15:39:32,675 DEBUG [Renew Data thread-1] org.apache.cxf.phase.PhaseInterceptorChain: Invoking handleFault on interceptor org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor@7ca5ba31
2011-11-07 15:39:32,675 DEBUG [Renew Data thread-1] org.apache.cxf.phase.PhaseInterceptorChain: Invoking handleFault on interceptor org.apache.cxf.interceptor.StaxOutInterceptor@658ba380
2011-11-07 15:39:32,675 DEBUG [Renew Data thread-1] org.apache.cxf.phase.PhaseInterceptorChain: Invoking handleFault on interceptor org.apache.cxf.interceptor.AttachmentOutInterceptor@92524b0
2011-11-07 15:39:32,675 DEBUG [Renew Data thread-1] org.apache.cxf.phase.PhaseInterceptorChain: Invoking handleFault on interceptor org.apache.cxf.interceptor.LoggingOutInterceptor@3c7038b9
2011-11-07 15:39:32,675 DEBUG [Renew Data thread-1] org.apache.cxf.phase.PhaseInterceptorChain: Invoking handleFault on interceptor org.apache.cxf.interceptor.MessageSenderInterceptor@6b9c18ae
2011-11-07 15:39:32,675 DEBUG [Renew Data thread-1] org.apache.cxf.phase.PhaseInterceptorChain: Invoking handleFault on interceptor org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor@127208e4
2011-11-07 15:39:32,675 DEBUG [Renew Data thread-1] org.apache.cxf.phase.PhaseInterceptorChain: Invoking handleFault on interceptor org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor@329b5c95
2011-11-07 15:39:32,675 DEBUG [Renew Data thread-1] org.apache.cxf.phase.PhaseInterceptorChain: Invoking handleFault on interceptor org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor@3b26456a
2011-11-07 15:39:32,675 DEBUG [Renew Data thread-1] org.apache.cxf.phase.PhaseInterceptorChain: Invoking handleFault on interceptor org.apache.cxf.jaxws.interceptors.SwAOutInterceptor@55187eb3
2011-11-07 15:39:32,675 DEBUG [Renew Data thread-1] org.apache.cxf.phase.PhaseInterceptorChain: Invoking handleFault on interceptor org.apache.cxf.jaxws.interceptors.HolderOutInterceptor@4d97507c
2011-11-07 15:39:32,676 WARN [Renew Data thread-1] org.apache.cxf.phase.PhaseInterceptorChain: Interceptor for {urn:ung-com:document:ung:rfc:functions}ONSDCOMPANYSERVICEPortTypeService#{urn:ung-com:document:ung:rfc:functions}ONSD_COMPANY_SERVICE has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:484)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:414)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:317)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:269)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
at $Proxy56.onsdCOMPANYSERVICE(Unknown Source)
at $ONSDCOMPANYSERVICEPortType_1337e783ea0.onsdCOMPANYSERVICE($ONSDCOMPANYSERVICEPortType_1337e783ea0.java)
at $ONSDCOMPANYSERVICEPortType_1337e783e9e.onsdCOMPANYSERVICE($ONSDCOMPANYSERVICEPortType_1337e783e9e.java)
at com.comp.app.services.impl.NewDataServiceImpl.updateCOMPANY(NewDataServiceImpl.java:580)
at com.comp.app.services.impl.NewDataServiceImpl.updateNewData(NewDataServiceImpl.java:320)
at com.comp.app.services.impl.NewDataServiceImpl$UpdateData.run(NewDataServiceImpl.java:196)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.io.IOException: IOException invoking http://99.999.999.201:7777/xyz/bc/soap/rfc : Stream is closed
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1385)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1370)
at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:47)
at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:188)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:614)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
... 21 more
Caused by: java.io.IOException: Stream is closed
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:2803)
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:2792)
at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:46)
at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:69)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1342)
... 26 more
2011-11-07 15:39:32,848 ERROR [Renew Data thread-1] com.comp.app.services.appModule.NewDataService: Could not send email about new data update
org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.mycomp.com :25
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1242)
at org.apache.commons.mail.Email.send(Email.java:1267)
at com.mycomp.commons.mail.services.MailServiceImpl.sendSimpleEmail(MailServiceImpl.java:86)
at com.mycomp.commons.mail.services.MailServiceImpl.sendSimpleEmail(MailServiceImpl.java:75)
at $MailService_1337e783e99.sendSimpleEmail($MailService_1337e783e99.java)
at com.comp.app.services.impl.NewDataServiceImpl.updateNewData(NewDataServiceImpl.java:501)
at com.comp.app.services.impl.NewDataServiceImpl$UpdateData.run(NewDataServiceImpl.java:196)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: javax.mail.SendFailedException: Send failure (javax.mail.MessagingException: Unknown SMTP host: smtp.mycomp.com (java.net.UnknownHostException: smtp.mycomp.com ))
at javax.mail.Transport.send(Transport.java:163)
at javax.mail.Transport.send(Transport.java:48)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1232)
... 14 more
Caused by: javax.mail.MessagingException: Unknown SMTP host: smtp.mycomp.com (java.net.UnknownHostException: smtp.mycomp.com )
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1389)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
at javax.mail.Service.connect(Service.java:274)
at javax.mail.Service.connect(Service.java:91)
at javax.mail.Service.connect(Service.java:76)
at javax.mail.Transport.send(Transport.java:94)
... 16 more
Caused by: java.net.UnknownHostException: smtp.mycomp.com
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:195)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:233)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1359)
... 21 more
2011-11-07 15:39:32,967 ERROR [Renew Data thread-1] com.comp.app.services.appModule.NewDataService: Error updating new data from server, retrying at 2011-11-07T15:44:32
com.comp.app.NewDataException: Failed to update new data
at com.comp.app.services.impl.NewDataServiceImpl.updateNewData(NewDataServiceImpl.java:497)
at com.comp.app.services.impl.NewDataServiceImpl$UpdateData.run(NewDataServiceImpl.java:196)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: javax.xml.ws.WebServiceException: Could not send Message.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)
at $Proxy56.onsdCOMPANYSERVICE(Unknown Source)
at $ONSDCOMPANYSERVICEPortType_1337e783ea0.onsdCOMPANYSERVICE($ONSDCOMPANYSERVICEPortType_1337e783ea0.java)
at $ONSDCOMPANYSERVICEPortType_1337e783e9e.onsdCOMPANYSERVICE($ONSDCOMPANYSERVICEPortType_1337e783e9e.java)
at com.comp.app.services.impl.NewDataServiceImpl.updateCOMPANY(NewDataServiceImpl.java:580)
at com.comp.app.services.impl.NewDataServiceImpl.updateNewData(NewDataServiceImpl.java:320)
... 9 more
Caused by: java.io.IOException: IOException invoking http://99.999.999.201:7777/xyz/bc/soap/rfc : Stream is closed
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1385)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1370)
at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:47)
at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:188)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:614)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:484)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:414)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:317)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:269)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
... 14 more
Caused by: java.io.IOException: Stream is closed
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:2803)
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:2792)
at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:46)
at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:69)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1342)
... 26 more


Does that help?
Matt Kurz
Ranch Hand

Joined: Jan 02, 2010
Posts: 40
Hmm. I have the same errors on another pc. Maybe there's a config I didn't see. What does the posted error say you?
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3829

From the stack trace there seems to be few issues:


Check this URL?


Caused by: javax.mail.MessagingException: Unknown SMTP host: smtp.mycomp.com (java.net.UnknownHostException: smtp.mycomp.com ) ...


Have you consider fixing/analyzing these? Latter seems to be the service is down or some network/DNS issue....
Matt Kurz
Ranch Hand

Joined: Jan 02, 2010
Posts: 40
Thanks for your patience. I have copied http://99.999.999.201:7777/xyz/bc/soap/rfc in the browser and got an authentification page. So, how expected the URL is correct. I can also ping smtp.mycomp.com. These are the same I use in mvn jetty:run. I have checked the config files again and again. Diffed it with the one on another machine. I have no idea anymore.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3829

I have copied http://99.999.999.201:7777/xyz/bc/soap/rfc in the browser and got an authentification page...

So how you pass/authenticate the credentials in the code?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Matt Kurz wrote:I can also ping smtp.mycomp.com.


From the machine where the error message was thrown, or from your client machine? The latter test would be useless, the former test is what you need.
Matt Kurz
Ranch Hand

Joined: Jan 02, 2010
Posts: 40
Vijitha Kumara wrote:
I have copied http://99.999.999.201:7777/xyz/bc/soap/rfc in the browser and got an authentification page...

So how you pass/authenticate the credentials in the code?


It's hardcoded. Consider that everything works fine, when I start it with mvn jetty:run
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3829

Have you considered what Paul has said above?

Without Maven have you checked any other containers (just to make sure that's Tomcat 6 specific issue, but again you had this worked once in Tomcat 6 right?). Beyond that I really am out of ideas here, sorry....
Matt Kurz
Ranch Hand

Joined: Jan 02, 2010
Posts: 40
Paul Clapham wrote:
Matt Kurz wrote:I can also ping smtp.mycomp.com.


From the machine where the error message was thrown, or from your client machine? The latter test would be useless, the former test is what you need.

The error was thrown on the client machine. I have no access to the server. It's another company.

@Vijitha Kumara
The app runs on another pc under tomcat 7. I have tried this on my pc several times with tomcat 6+7. Maybe I don't see something very simple. I will learn. Test with other containers is a good idea. Which one can you recommend?

Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3829

Test with other containers is a good idea. Which one can you recommend?

There are many available but GlassFish & JBoss may be easier to find more information about (in case you need).
BTW, this "other machines" you talk about are in the same network as the troublesome machine?
The error was thrown on the client machine.

And you access this mail server from the client machine?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unknown Host