I have this very simple upload method to upload a file to a one-node hdp2.5 cluster:
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(new URI("webhdfs://hdsfhost:50070", conf);
fs.copyFromLocalFile(false, true, new Path(localFilePath), new Path(hdfsPath));
Tracing what happens the flow starts correctly:
connect to hdfshost:50070,
check if file already exists (no),
connect to datanode.
That is where it fails: the datanode is found to be localhost:50075 instead of hdfshost:50075, resulting in a "java.net.ConnectException: Connection refused".
I have the following relevant settings on hdp:
dfs.client.use.datanode.hostname => true
dfs.datanode.http.address => 0.0.0.0:50075
dfs.namenode.http-address => 0.0.0.0:50070
I could not find any reason why localhost is used instead of hdfshost (and there is no override in /etc/hosts, neither on the local machine neither on the cluster). Any help would be very appreciated.
You need to change your configuration of the http-address to your local IP address instead of 0.0.0.0.
0.0.0.0 gets resolved to localhost and will then be used by dfs.client.use.datanode.hostname => true while your local IP address will be resolved to the DNS name and then be used by hostname again.
Since it works I will post this as an answer, thus I don't know if my reasoning for the solution is correct. If anybody knows the exact reason please add it as a comment or edit my answer.
I am trying to debug a simple Java application on my machine using Eclipse as an IDE. When I try to debug the application by entering the Debug Perspective, I set a breakpoint and start debug. Within a few seconds, the following pop-up window:
Launching unicodeRead has encountered a problem. Cannot connect to VM.
The message dumped on the console is as follows:
ERROR: transport error 202: connect failed: Connection refused
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:708]
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
How do I correct this? Why does this happen?
I just had the same problem.
Yesterday everything worked fine, now nothing - same error as you gave. I found out that network admins made some changes in the meantime. Some firewall stuff. Problem is that Eclipse tries to establish connection to JVM at "localhost" (and some random port). When I tried pinging localhost (or 127.0.0.1) I got following:
C:\Windows\system32>ping 127.0.0.1
Pinging 127.0.0.1 with 32 bytes of data:
PING: transmit failed. General failure.
PING: transmit failed. General failure.
PING: transmit failed. General failure.
PING: transmit failed. General failure.
and
C:\Windows\system32>ping localhost
Ping request could not find host localhost. Please check the name and try again.
It seams that in some cases DNS is expected to resolve this, and if firewall prevents localhost requests to DNS - stuff breaks. I had to alter hosts file and remove comments in following lines, so I would not rely on DNS for this anymore:
# 127.0.0.1 localhost
# ::1 localhost
Although it is written that hosts file changes take effect immediately, I think that some processes locked this and restart was necessary in my case. After that, everything worked again.
Had same problem, but the solution was to run the application with -server=y option and not with -server=n.
Before:
java -agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:5005
After:
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=localhost:5005
Looks like the same problem as here. A reboot of the pc fixed the problem there. I haven't found any other solutions.
I was seeing an error while using the -X format:
java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=n myapp
The error went away when I switched to the newer format:
java -agentlib:jdwp=transport=dt_socket,server=y,address=4000,suspend=n myapp
Its Very Simple,Just do the Following Changes in eclipse.ini file.
-vm
binary\com.sun.java.jdk.win32.x86_1.6.0.u43\jre\bin\javaw.exe
I changed
-agentlib:jdwp=transport=dt_socket,address=9009,server=n,suspend=y
to
-agentlib:jdwp=transport=dt_socket,address=9009,server=y,suspend=n
and that did the trick!
My case is I have a bunch of domains refer to 127.0.0.1 in hosts file, like this:
127.0.0.1 localhost domian1.local domain2.local domain3.local
one day I added another new domain to refer to 127.0.0.1. By mistake, I put the domain in front of "localhost", like this:
127.0.0.1 domain4.local localhost domian1.local domain2.local domainx.local
After this, I always got an alert window in eclipse while debugging:
Cannot connect to VM
com.sun.jdi.connect.TransportTimeoutException
In console:
ERROR: transport error 202: connect failed: Connection refused
ERROR: JDWP: Failed to initialize transport via localhost:50470, trying localhost via 127.0.0.1:50470
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
ERROR: transport error 202: connect failed: Connection refused
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:690]
The solution is keep "localhost" at the first position all the time.
127.0.0.1 localhost domian1.local domain2.local domainx.local domain4.local
What solved for me was deleting the entire domain1 folder inside the domains folder on glassfish main folder.
Eclipse will ask you to recreate a domain and then everything works again.
In eclipse select Run tab -> Debug configuration -> Junit -> select your test name ->
Environment tab -> add variable server=y .
I was getting the same error on my ubuntu machine because of a mishap with the /etc/hosts file. I had commented out the mapping of localhost to 127.0.0.1, and to complicate matters further there was a swap file hanging around.
This was the first line of my /etc/hosts:
127.0.0.1 #localhost
Deleting the # fixed the problem, whereas rebooting understandably had not.
My cause & solution were completely different.
I think in my case it was due to the installation of JProfiler. I fixed it by uninstalling JProfiler and launching eclipse with the -clean option. I suspect that JProfiler was inserting itself in the debugger. The -clean option forces Eclipse to re-assess its plugins, so that alone might have been sufficient.
Continuing #gonadarian's answer, it seems Eclipse uses port 127.0.0.1 for debug purposes. This port is also called localhost. The way this error can be removed is by ensuring that there are no processes or services running on the above ports. The way to do this, on Linux is:
As root, enter the command:
netstat -tulpn | grep 127.0.0.1
If there are processes running on the above port, it will show up in the format:
process_id/process name.
Kill the above processes like so: kill -KILL process_id
Restart the computer for these changes to take effect. The error should no longer occur.
I'm currently learning Hadoop by http://tecadmin.net/steps-to-install-hadoop-on-centosrhel-6/
in the 5th step when I apply this command $ bin/hadoop namenode -format I get following error
I also have checked these links for resolving my problem
"hadoop namenode -format" returns a java.net.UnknownHostException
java.net.UnknownHostException: Invalid hostname for server: local
I don't know where is domain name in the configuration files for replacing it by localhost.
also I went to /etc/hosts file and replaced text by localhost.. still I haven't resolve the problem please someone help me.
The unknownHostException could be resolved by the following steps:
Go to /etc/hosts
Edit the "hosts" file with IP 127.0.0.1 [space] HostName (e.g. static.98.35.ebonenet.com)
Save the file and try again
With the help of Aadil's answer I resolved The unknownHostException by the following steps:
Step-1 Go to /etc/hosts
Step-2 Edit the "hosts" file with IP 127.0.0.1 [space/tab] localhost [space/tab] HostName (e.g. static.98.35.ebonenet.com)
Step-3 Save the file and try again
Problem:
If anyone facing:
SHUTDOWN_MSG: Shutting down NameNode at java.net.UnknownHostException:
ubuntu: ubuntu: unknown error
Solution:
Go to /etc/hosts
Disable/Remove if any IPV6 configuration maintained in /etc/hosts file
Save the file and try again
at jboss start up we are providing option -b 0.0.0.0 like below
run.sh -c web -b 0.0.0.0
can any body explain why do we need to provide this?
with out this (-b) option my application deployment is failling.
I have googled this not able find proper explanation.
EDIT
In the run script instead of 0.0.0.0 i have send {MyPcIp}.
Deplyment Error
2013-03-28 05:21:32,263 INFO [org.jboss.web.WebService] (main) Using RMI server codebase: http://{MyPcIp}:8083/
2013-03-28 05:21:32,266 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (main) Error installing to Start: name=jboss:service=WebService state=Create mode=Manual requiredState=Installed
java.lang.Exception: Port 8083 already in use.
at org.jboss.web.WebServer.start(WebServer.java:233)
at org.jboss.web.WebService.startService(WebService.java:322)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:376)
2013-03-28 05:21:32,277 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (main) Error installing to Real: name=vfsfile:/home/bnw/jboss-eap-5.0/jboss-as/server/web/conf/jboss-service.xml state=PreReal mode=Manual requiredState=Real
org.jboss.deployers.spi.DeploymentException: Error deploying: jboss:service=WebService
at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:118)
That argument tells the server to listen on all interfaces instead of just the default (probably 127.0.0.1). But that isn't the problem here.
It seems like your configured port is already in use, so it allows you to listen on 0.0.0.0 instead of the default interface. However, this is not the right way to fix things, because connections to port 8083 may be accepted by different servers depending on the specific interface used. You should figure out why your application is attempting to listen on 8083 twice, or why there is a server already bound to that port.
-b 0.0.0.0 is specifying that you'd like you JBoss to bind into the network interface 0.0.0.0 (aka "all available interface"), as opposed of using whatever default configured
The fact that JBoss fails to start unless you use this indicates the default points to some network interface which is nonexistent / already being bound by something else
Or your app expects JBoss to binds to all network interfaces -- but since it's no longer the case hence it fails
I have a server that is "named" and it seems to cause Grails to be unable to find localhost.
Running Grails application..
2011-01-12 20:45:14,046 [main] ERROR ehcache.Cache - Unable to set localhost. This prevents creation of a GUID. Cause was: zaftra: zaftra
java.net.UnknownHostException: zaftra: zaftra
at java.net.InetAddress.getLocalHost(InetAddress.java:1426)
at net.sf.ehcache.Cache.<clinit>(Cache.java:143)
at net.sf.ehcache.config.ConfigurationHelper.createCache(ConfigurationHelper.java:463)
at net.sf.ehcache.config.ConfigurationHelper.createDefaultCache(ConfigurationHelper.java:369)
at net.sf.ehcache.CacheManager.configure(CacheManager.java:445)
at net.sf.ehcache.CacheManager.init(CacheManager.java:302)
at net.sf.ehcache.CacheManager.<init>(CacheManager.java:260)
at net.sf.ehcache.hibernate.EhCacheProvider.start(EhCacheProvider.java:128)
Contents of /etc/hosts (as shown):
127.0.0.1 localhost localhost.localdomain zaftra
::1 localhost localhost.localdomain zaftra
I'm going to assume that you're on some flavor of linux. If that's the case, you might have a look at your /etc/hosts file - is there an entry for localhost? I'd expect to see something like:
127.0.0.1 localhost zaftra
::1 localhost
I did some Googling - there's a similar question over on SuperUser - the suggestion there was to add the following to /etc/resolv.conf:
search (domainname) // in your case, search (zaftra)
You might also try:
search zaftra
// or
search zaftra.example.com // if there's a more fully-qualified domain name you can use
(That's based off of an entry I've got in resolv.conf on one of my Ubuntu machines).
I'm using AWS(running amazon linux) and ran into the exact same issue, my fix was to add this to /etc/hosts:
102.130.27.257 LAMP-LIVE01-N123 www.mydomain.com
where those values came from:
{internal IP} {instance name} {domain for grails app}
and then I restarted httpd and my grails app server(tomcat)