无法在 mac 上打开 h2.jar
Posted
技术标签:
【中文标题】无法在 mac 上打开 h2.jar【英文标题】:Unable to open h2.jar on mac 【发布时间】:2013-03-13 21:49:44 【问题描述】:我正在尝试为我的 java 应用程序构建一个 H2 数据库,我认为它正在工作,但我无法执行 .jar 文件来查看它是否工作......我正在做这个和我的朋友一起,他有一个 mac,对他来说很好用,我们有相同的 java 版本
我尝试过双击 .jar 并尝试使用命令行打开它
java -jar h2-1.3.170.jar
它向我展示了那个异常
IO Exception: "java.net.UnknownHostException: dhcp-10-231-195-255: dhcp-10-231-195-255: nodename nor servname provided, or not known" [90028-170]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
at org.h2.message.DbException.get(DbException.java:158)
at org.h2.message.DbException.convert(DbException.java:273)
at org.h2.util.NetUtils.getLocalAddress(NetUtils.java:263)
at org.h2.server.web.WebServer.updateURL(WebServer.java:325)
at org.h2.server.web.WebServer.init(WebServer.java:315)
at org.h2.tools.Server.<init>(Server.java:51)
at org.h2.tools.Server.createWebServer(Server.java:412)
at org.h2.tools.Console.runTool(Console.java:228)
at org.h2.tools.Console.main(Console.java:100)
Caused by: java.net.UnknownHostException: dhcp-10-231-195-255: dhcp-10-231-195-255: nodename nor servname provided, or not known
at java.net.InetAddress.getLocalHost(InetAddress.java:1438)
at org.h2.util.NetUtils.getLocalAddress(NetUtils.java:261)
... 6 more
Caused by: java.net.UnknownHostException: dhcp-10-231-195-255: nodename nor servname provided, or not known
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:866)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1258)
at java.net.InetAddress.getLocalHost(InetAddress.java:1434)
... 7 more
Exception in thread "main" org.h2.message.DbException: IO Exception: "java.net.UnknownHostException: dhcp-10-231-195-255: dhcp-10-231-195-255: nodename nor servname provided, or not known" [90028-170]
at org.h2.message.DbException.get(DbException.java:158)
at org.h2.message.DbException.convert(DbException.java:273)
at org.h2.util.NetUtils.getLocalAddress(NetUtils.java:263)
at org.h2.server.TcpServer.getURL(TcpServer.java:193)
at org.h2.tools.Server.getStatus(Server.java:391)
at org.h2.tools.Console.printProblem(Console.java:300)
at org.h2.tools.Console.runTool(Console.java:270)
at org.h2.tools.Console.main(Console.java:100)
Caused by: org.h2.jdbc.JdbcSQLException: IO Exception: "java.net.UnknownHostException: dhcp-10-231-195-255: dhcp-10-231-195-255: nodename nor servname provided, or not known" [90028-170]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
... 8 more
Caused by: java.net.UnknownHostException: dhcp-10-231-195-255: dhcp-10-231-195-255: nodename nor servname provided, or not known
at java.net.InetAddress.getLocalHost(InetAddress.java:1438)
at org.h2.util.NetUtils.getLocalAddress(NetUtils.java:261)
... 5 more
Caused by: java.net.UnknownHostException: dhcp-10-231-195-255: nodename nor servname provided, or not known
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:866)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1258)
at java.net.InetAddress.getLocalHost(InetAddress.java:1434)
... 6 more
【问题讨论】:
您能检查一下您的/etc/hosts
文件吗?您使用 *** 还是特殊的防火墙?您是否默认使用 IPv6 并禁用了 IPv4?
没有,我刚查了一下,没有你说的。
【参考方案1】:
要临时修复它,请编辑主机文件并将您的主机名附加到127.0.0.1
环回地址:
sudo vi /etc/hosts
127.0.0.1 localhost 你的主机名
255.255.255.255 广播主机
::1 本地主机
fe80::1%lo0 本地主机
192.168.1.3 洛基
首先要设置它,使用:
sudo scutil --set HostName YourHostname
点击此 JIRA 链接了解更多信息:https://jira.exoplatform.org/browse/KER-203?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
【讨论】:
【参考方案2】:如果你用谷歌搜索这个异常,你会发现others 有同样的问题。这可能是由bug in Java 7 引起的。
【讨论】:
以上是关于无法在 mac 上打开 h2.jar的主要内容,如果未能解决你的问题,请参考以下文章
无法使用 Vim 在 Mac 上打开 LaTeX 文件,由 Python 引起?