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)
Related
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 trying to run Glassfish on OpenShift in a DIY cartridge and I have a problem because I'm receiving an error saying that I can't bind the port 8080.
I have been talking with Openshift support and they have told me that I must remove a ruby file that is binding the 8080 port.
Error:
[#|2015-04-21T17:58:27.887-0400|SEVERE|glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=1;_ThreadName=main;|Shutting down v3 due to startup exception : Permission denied: 8080=com.sun.enterprise.v3.services.impl.monitor.MonitorableSelectorHandler#15ac5d5|#]
I think that I have done this, because I have removed a .rb file in the git directory but the problem persists.
Does anyone have any suggestions?
You need to make sure that your glassfish server is binding to port 8080 on your gear's ip address, which is your OPENSHIFT_DIY_IP environment variable.
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
When I run the below command in terminal of ubuntu linux and also I set the ClassPath properly but I wasn't successful.
java jade.Boot -gui
I got following errors in terminal window:
15 Jun, 2011 6:33:10 PM jade.core.Runtime beginContainer
INFO: ----------------------------------
This is JADE snapshot - revision 6357 of 2010/07/06 16:27:34
downloaded in Open Source, under LGPL restrictions,
at http://jade.tilab.com/
----------------------------------------
Retrieving CommandDispatcher for platform null
15 Jun, 2011 6:33:11 PM jade.imtp.leap.CommandDispatcher addICP
WARNING: Error adding ICP jade.imtp.leap.JICP.JICPPeer#ae506e[Error: Not possible to launch JADE on a remote host (127.0.1.1). Check the -host and -local-host options.].
15 Jun, 2011 6:33:11 PM jade.core.AgentContainerImpl joinPlatform
SEVERE: Communication failure while joining agent platform: No ICP active
jade.core.IMTPException: No ICP active
at jade.imtp.leap.LEAPIMTPManager.initialize(LEAPIMTPManager.java:138)
at jade.core.AgentContainerImpl.init(AgentContainerImpl.java:316)
at jade.core.AgentContainerImpl.joinPlatform(AgentContainerImpl.java:482)
at jade.core.Runtime.createMainContainer(Runtime.java:165)
at jade.Boot.main(Boot.java:89)
15 Jun, 2011 6:33:11 PM jade.core.Runtime$1 run
INFO: JADE is closing down now.
help me to recover from this error.
I am so tired of this problem. It is one of many quirks and problems with JADE.
The problem you are facing is that you need to supply correct host information in the command line. Example
java jade.Boot -gui -local-host
This is all described here: http://jade.tilab.com/doc/tutorials/JADEAdmin/startJade.html
In many cases you don't have this problem and then it is sufficient to use the -gui option only. However I have discovered that Jade does not work very well when your resolves to 127.0.1.1. You can fix this by setting your IP address in or if you are on Linux edit your /etc/hosts file for a more permanent solution.
just type in JADE path..
java -cp lib/jade.jar jade.Boot -gui -local-host 127.0.0.1
(JADE has some problems to set local host adress)
The problem might be is previous java process might be still running on the local port , Make sure to check if port is in use or not if in use kill the java process before you rerun.
It's simple.
Modify /etc/hosts
Modify the line for the address 127.0.0.1, as follows:
127.0.0.1 localhost.localdomain localhost <machine_name>
Remove or comment the line with 127.0.1.1:
# 127.0.1.1 <machine_name>
and you're done.
The error isn't in the jade. It's a bug used by jade to start the default parameters with a bugged java method that should be fixed.
When jade runs the java method, it will retrieve 127.0.1.1 instead the loop-back 127.0.0.1.
I'm saying it because I tested. I read the JADE src that do this and I executed the java method that I didn't remember now.
Unfortunately it's happening in a few linux machines. In windows I didn't see it happens.
What I did to solve this problem was to edit the /etc/hosts file, like this:
Original file:
127.0.0.1 localhost
127.0.1.1 machine-name
Modified file:
127.0.0.1 localhost machine-name
127.0.1.1 machine-name
What I did was to put an alias of the machine-name on the loop-back ip address. This will bypass the bug.
I'm installing CSVN using jdk1.6.0_23 and I'm getting the following Java error:
2011-02-10 16:25:50,951 [WrapperJarAppMain] WARN util.GrailsUtil - [WARNING] Property [ldapServerPort] of domain class com.collabnet.svnedge.console.Server has type [int] and doesn't support constraint [nullable]. This constraint will not be checked during validation.
2011-02-10 16:25:51,117 [WrapperJarAppMain] ERROR ehcache.Cache - Unable to set localhost. This prevents creation of a GUID. Cause was: vkqgae01: vkqgae01
java.net.UnknownHostException: vkqgae01: vkqgae01
at java.net.InetAddress.getLocalHost(InetAddress.java:1354)
at net.sf.ehcache.Cache.<clinit>(Cache.java:143)
My server has 3 NICs (eth0, eth1 and eth2). I've added an entry to the hosts file bellow localhost containing the following:
127.0.0.1 vkqgae01
I can successfully ping vkqgae01, but nslookup cannot resolve it.
Any ideas?
That is related with
hostname
and
/etc/hosts
If /etc/hosts doesn't containt the definition of the hostname it fails. Just add your hostname to /etc/host for example if your hostname is work add or modified the following line:
127.0.0.1 work localhost
I can succesfully ping vkqgae01, but nslookup cannot resolve it.
Any ideas?
What happens?
vkqgae01 is resolved locally thanks to your hosts file.
nslookup sends a query to your DNS, where vkqgae01 is unknown.
Suggestion: add vkqgae01 to hosts file of every machine where you "use" it.
Basically, the fact that the local hosts file on vkqgae01 contains 127.0.0.1 localhost vkqgae01 doesn't help other machines to solve its name.
Just added the line below in /etc/hosts and it worked.
127.0.0.1 imac
nslookup queries DNS specifically and directly. This means it will not be able to show anything added directly to an /etc/hosts file (as that isn't DNS).
If you want to properly make sure your system will resolve a name, use getent:
'getent hosts vkqgae01'
You need to restart the container if /etc/hosts was changed as far as JVM caches local addresses/names on the first InetAddress call. It looks like InetAddress implementation bug, but still not fixed.