nGrinder TestRunner DNS / sun.net.spi.nameservice.NameServiceDescriptor

s

ngrinder3.3控制台验证脚本报错

http://ngrinder.642.n7.nabble.com/ngrinder3-3-td1301.html

目前发现3.3版本在控制台校验脚本报错,无法执行,但执行测试分发到压力机上可以正常执行。 
已下是错误日志: 

 1 Failed to instantiate [ch.qos.logback.classic.LoggerContext] 
 2 Reported exception: 
 3 sun.misc.ServiceConfigurationError: sun.net.spi.nameservice.NameServiceDescriptor: Provider org.ngrinder.dns.LocalManagedDnsDescriptor could not be instantiated: java.lang.ExceptionInInitializerError 
 4         at sun.misc.Service.fail(Service.java:120) 
 5         at sun.misc.Service.access$200(Service.java:111) 
 6         at sun.misc.Service$LazyIterator.next(Service.java:284) 
 7         at java.net.InetAddress$2.run(InetAddress.java:895) 
 8         at java.security.AccessController.doPrivileged(Native Method) 
 9         at java.net.InetAddress.<clinit>(InetAddress.java:889) 
10         at ch.qos.logback.core.util.ContextUtil.getLocalHostName(ContextUtil.java:32) 
11         at ch.qos.logback.core.util.ContextUtil.addHostNameAsProperty(ContextUtil.java:41) 
12         at ch.qos.logback.classic.joran.action.ConfigurationAction.begin(ConfigurationAction.java:48) 
13         at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Interpreter.java:276) 
14         at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:148) 
15         at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:130) 
16         at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:50) 
17         at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:147) 
18         at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:133) 
19         at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:96) 
20         at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:55) 
21         at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75) 
22         at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:148) 
23         at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84) 
24         at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:54) 
25         at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128) 
26         at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108) 
27         at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:279) 
28         at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:252) 
29         at net.grinder.engine.process.WorkerProcessEntryPoint.run(WorkerProcessEntryPoint.java:73) 
30         at net.grinder.engine.process.WorkerProcessEntryPoint.main(WorkerProcessEntryPoint.java:60) 
31 Caused by: java.lang.ExceptionInInitializerError 
32         at org.ngrinder.dns.LocalManagedDnsImpl.<init>(LocalManagedDnsImpl.java:33) 
33         at org.ngrinder.dns.LocalManagedDnsProxy.<init>(LocalManagedDnsProxy.java:30) 
34         at org.ngrinder.dns.LocalManagedDnsDescriptor.<clinit>(LocalManagedDnsDescriptor.java:29) 
35         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
36         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 
37         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 
38         at java.lang.reflect.Constructor.newInstance(Constructor.java:513) 
39         at java.lang.Class.newInstance0(Class.java:357) 
40         at java.lang.Class.newInstance(Class.java:310) 
41         at sun.misc.Service$LazyIterator.next(Service.java:282) 
42         ... 24 more 
43 Caused by: java.lang.NullPointerException 
44         at java.net.InetAddress.getAddressFromNameService(InetAddress.java:1229) 
45         at java.net.InetAddress.getAllByName0(InetAddress.java:1180) 
46         at java.net.InetAddress.getAllByName(InetAddress.java:1110) 
47         at java.net.InetAddress.getAllByName(InetAddress.java:1046) 
48         at java.net.InetAddress.getByName(InetAddress.java:996) 
49         at org.xbill.DNS.SimpleResolver.<init>(SimpleResolver.java:56) 
50         at org.xbill.DNS.SimpleResolver.<init>(SimpleResolver.java:68) 
51         at org.xbill.DNS.ExtendedResolver.<init>(ExtendedResolver.java:266) 
52         at org.xbill.DNS.Lookup.refreshDefault(Lookup.java:86) 
53         at org.xbill.DNS.Lookup.<clinit>(Lookup.java:97) 
54         ... 34 more 
55 Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class java.net.InetAddress 
56         at ch.qos.logback.core.util.ContextUtil.getLocalHostName(ContextUtil.java:32) 
57         at ch.qos.logback.core.util.ContextUtil.addHostNameAsProperty(ContextUtil.java:41) 
58         at ch.qos.logback.classic.joran.action.ConfigurationAction.begin(ConfigurationAction.java:48) 
59         at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Interpreter.java:276) 
60         at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:148) 
61         at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:130) 
62         at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:50) 
63         at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:147) 
64         at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:133) 
65         at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:96) 
66         at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:55) 
67         at net.grinder.engine.process.GrinderProcess.configureLogging(GrinderProcess.java:257) 
68         at net.grinder.engine.process.GrinderProcess.<init>(GrinderProcess.java:141) 
69         at net.grinder.engine.process.WorkerProcessEntryPoint.run(WorkerProcessEntryPoint.java:78) 
70         at net.grinder.engine.process.WorkerProcessEntryPoint.main(WorkerProcessEntryPoint.java:60) 



控制台的hosts文件如下: 
[new@controller-01 logs]$ getent hosts 
127.0.0.1       localhost localhost.localdomain localhost4 localhost4.localdomain4 
127.0.0.1       localhost localhost.localdomain localhost6 localhost6.localdomain6 
192.168.1.210   controller-01 
192.168.1.211   agent-01 
192.168.1.212   agent-02

问题分析:

此性能平台环境必须经过DNS解析过一遍,即使解析不到也需要个假DNS Server,它优先走DNS,不本地/etc/hosts解析,这样才能进一步,使用压测平台的脚本验证按钮等。

解决方案:

新增DNS解析: /etc/reslove.conf

nameserver 192.168.131.17

nameserver 192.168.131.18

end

原文地址:https://www.cnblogs.com/lindows/p/9040838.html