3
votes

So, basicly:

I create a domain 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.

I start the domain 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.

I stop the domain asadmin stop-domain test

Waiting for the domain to stop ..
Command stop-domain executed successfully.

Everything goes well. But if i use NetBeans:

Open Netbeans -> Add GlassFish server (domain: test) -> Create Project The project starts correctly.

BUT

If i restart NetBeans the GlassFish doesn't start the domain and if i try to start the domain with console asadmin start-domain test i get this:

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

WWHHYYY

2
it looks like you have found a bug in the NetBeans/GlassFish integration plugin. I am investigating.vkraemer
This is not only a Netbeans/Glassfish integration, but its only on glassfish. I'm using th glassfish server (4.0) and it occurs to me. But the solution is showed by @Anthony Accioly. Using iconv u can convert the file fast and easy.Cold

2 Answers

5
votes

Your domain.xml file is not using UTF-8 encoding (maybe you edited it manually with notepad or something?).

Solution: Convert the domain.xml file to UTF-8 encoding with a proper tool.

Reference: Code Ranch Post.

Since you are on Windows, you can give UTFCast a go.

Cheers,

1
votes

I had the same problem. Solved by viewing the file in UTF-8 appeared a comment I had made ​​with special character, he turns this character into something not readable for java, solved by removing the special character. Note the original file is ANSI, convert to UTF-8 and leave converted the glassfish complains error, parseError at [row, col]: [1,1].