所以,基本上:
我创建了一个域asadmin create-domain test
Enter admin user name [Enter to accept default "admin" / no password]>
Using default port 4848 for Admin.
Using default port 8080 for HTTP Instance.
Using default port 7676 for JMS.
Using default port 3700 for IIOP.
Using default port 8181 for HTTP_SSL.
Using default port 3820 for IIOP_SSL.
Using default port 3920 for IIOP_MUTUALAUTH.
Using default port 8686 for JMX_ADMIN.
Using default port 6666 for OSGI_SHELL.
Using default port 9009 for JAVA_DEBUGGER.
Distinguished Name of the self-signed X.509 Server Certificate is:
[CN=G62-120ey,OU=GlassFish,O=Oracle Corporation,L=Santa Clara,ST=California,C=US]
Distinguished Name of the self-signed X.509 Server Certificate is:
[CN=G62-120ey-instance,OU=GlassFish,O=Oracle Corporation,L=Santa Clara,ST=California,C=US]
No domain initializers found, bypassing customization step
Domain test created.
Domain test admin port is 4848.
Domain test allows admin login as user "admin" with no password.
Command create-domain executed successfully.
我启动了域asadmin start-domain test
Waiting for test to start ......................
Successfully started the domain : test
domain Location: I:\glassfish\glassfish\domains\test
Log File: I:\glassfish\glassfish\domains\test\logs\server.log
Admin Port: 4848
Command start-domain executed successfully.
我停止了域asadmin stop-domain test
Waiting for the domain to stop ..
Command stop-domain executed successfully.
一切顺利。但是,如果我使用NetBeans:
Open Netbeans - >添加GlassFish服务器(域:测试) - >创建项目 该项目正确启动。
BUT
如果我重新启动NetBeans,GlassFish不会启动域,如果我尝试使用控制台asadmin start-domain test
启动域,我会得到:
Waiting for test to start ...Error starting domain test.
The server exited prematurely with exit code 1.
Before it died, it produced the following output:
Launching GlassFish on Felix platform
Completed shutdown of GlassFish runtime
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:97)
at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:55)Caused by: org.jvnet.hk2.component.ComponentException: Failed to create a habitat
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.createHabitat(AbstractModulesRegistryImpl.java:169)
at com.sun.enterprise.module.bootstrap.Main.createHabitat(Main.java:425)
at org.jvnet.hk2.osgiadapter.HK2Main.createHabitat(HK2Main.java:96)
at com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishRuntime.newGlassFish(EmbeddedOSGiGlassFishRuntime.java:89)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(GlassFishMain.java:113)
... 6 more
Caused by: java.lang.RuntimeException: Fatal Error. Unable to parse file:/I:/glassfish/glassfish/domains/test/config/domain.xml
at org.glassfish.config.support.DomainXml.parseDomainXml(DomainXml.java:273)
at org.glassfish.config.support.DomainXml.run(DomainXml.java:112)
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.populateConfig(AbstractModulesRegistryImpl.java:176)
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.createHabitat(AbstractModulesRegistryImpl.java:158)
... 10 more
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[4,64]
Message: Invalid byte 1 of 1-byte UTF-8 sequence.
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(Unknown Source)
at javax.xml.stream.util.StreamReaderDelegate.next(Unknown Source)
at org.glassfish.config.support.XMLStreamReaderFilter.thisNextTag(XMLStreamReaderFilter.java:94)
at org.glassfish.config.support.XMLStreamReaderFilter.nextTag(XMLStreamReaderFilter.java:74)
at org.jvnet.hk2.config.ConfigParser.handleElement(ConfigParser.java:199)
at org.jvnet.hk2.config.ConfigParser.handleElement(ConfigParser.java:215)
at org.jvnet.hk2.config.ConfigParser.handleElement(ConfigParser.java:167)
at org.jvnet.hk2.config.ConfigParser.parse(ConfigParser.java:98)
at org.jvnet.hk2.config.ConfigParser.parse(ConfigParser.java:93)
at org.glassfish.config.support.DomainXml.parseDomainXml(DomainXml.java:254)
... 13 more
答案 0 :(得分:5)
您的domain.xml
文件未使用UTF-8编码(也许您是使用记事本手动编辑的?)。
解决方案:使用适当的工具将domain.xml文件转换为UTF-8编码。
参考: Code Ranch Post。
由于您使用的是Windows,因此可以UTFCast进行操作。
干杯,
答案 1 :(得分:1)
我遇到了同样的问题。通过查看UTF-8中的文件解决了我用特殊字符做出的评论,他将这个字符转换为java不可读的内容,通过删除特殊字符解决。请注意,原始文件是ANSI,转换为UTF-8并保留转换为glassfish投诉错误parseError at [row, col]: [1,1]
。