eclipse-ee4j / glassfish

Eclipse GlassFish
https://eclipse-ee4j.github.io/glassfish/
384 stars 143 forks source link

If system name contains a non en_US character, create-domain fails ... #535

Closed glassfishrobot closed 17 years ago

glassfishrobot commented 18 years ago

I know it is hard to reproduce on a system with all en_US characters, but we need to understand what's going on here. The swforum link provides the exact stack trace. Please investigate this ... On Mon, 2006-04-03 at 11:57 -0700, Snjezana Sevo-Zenzerovic wrote:

Marco Walther wrote:

Does somebody have any idea?

From the forum: " Then I tryed to create a domain with: "create domain --adminport 24848 --adminuser adminadmin creator" but after the messages for several ports I got the error message: "Invalid byte 1 of 1 byte UTF-8 sequence. CLI130 Could not create domain, creator" "

Thanks, -- Marco

http://swforum.sun.com/jive/thread.jspa?forumID=123&threadID=67482

Similar thing was reported here:

http://forum.java.sun.com/thread.jspa?forumID=136&threadID=535069

Root cause in that case was that system name contained Polish character...

I forwarded that link. Maybe it's the same cause here (probably German.

Thanks, – Marco

Environment

Operating System: All Platform: All

Affected Versions

[9.0pe]

glassfishrobot commented 6 years ago
glassfishrobot commented 18 years ago

@glassfishrobot Commented shadowtmdg said: I tried to reproduce this by using the Greek letter A (unicode 0x0391) in front of my computer name.

I am using the latest 43 branch sources.

I did not encounter the same problem, however a java.net.UnknownHostException was thrown. It seemed to handle it well and the output says the domain was created successfully.

When you start the domain, it throws the same UnknownHostException and says the following(see just below) - however the domain is running and responding on both admin and instance ports.

" ... Domain sd is ready to receive client requests. Additional services are being started in background. java.net.UnknownHostException: aShadowDust: aShadowDust CLI156 Could not start the domain sd."

One thing I noted was that in the domain.xml file there was no reference to my hostname, instead localhost was present where previously my hostname had been.

Does anyone know the exact computer name used in the original defect?

Below is the output of the command:

C:\JavaProjects\tests>asadmin create-domain --adminport 7070 --adminuser admin - -instanceport 1234 sd Apr 12, 2006 12:28:46 AM com.sun.enterprise.util.ASenvPropertyReader setSystemPr operties SEVERE: property_reader.unknownHost java.net.UnknownHostException: aShadowDust: aShadowDust at java.net.InetAddress.getLocalHost(InetAddress.java:1308) at com.sun.enterprise.util.net.NetUtils.getCanonicalHostName(NetUtils.ja va:89) at com.sun.enterprise.util.ASenvPropertyReader.setSystemProperties(ASenv PropertyReader.java:188) at com.sun.enterprise.cli.commands.S1ASCommand.(S1ASCommand.java:1 40) at com.sun.enterprise.cli.commands.BaseLifeCycleCommand.(BaseLifeC ycleCommand.java:86) at com.sun.enterprise.cli.commands.CreateDomainCommand.(CreateDoma inCommand.java:84) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct orAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC onstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:494) at java.lang.Class.newInstance0(Class.java:350) at java.lang.Class.newInstance(Class.java:303) at com.sun.enterprise.cli.framework.CommandFactory.createCommand(Command Factory.java:76) at com.sun.enterprise.cli.framework.CLIMain.invokeCommand(CLIMain.java:1 50) at com.sun.enterprise.cli.framework.CLIMain.main(CLIMain.java:63) Please enter the admin password> Please enter the admin password again> Please enter the master password> Please enter the master password again> 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. Domain sd created.

C:\JavaProjects\tests>

glassfishrobot commented 18 years ago

@glassfishrobot Commented bnevins said: I can't figure out a way to get CLI to accept a unicode string. I tried to create a domain named "\uc5ec" – CLI wouldn't hear of it!

So I went into the CLI code and modified it to set the new domain name (in CreateDomainCommand.java) to "\uc5ec".

Then I compiled and ran CLI. The domain dir was created and everything was going along fine until it got to a native NSS call. I suspect that the native code is C or C++ and won't accept UNICODE strings.

I'm reassigning to Kedar for possible reassigning to security folks (and I am on vacation for the next week and a half.)


Here is the runtime error:

java.lang.Exception: Cannot init NSS. at com.sun.enterprise.ee.security.NssStore.initNSSNative(Native Method) at com.sun.enterprise.ee.security.NssStore.(NssStore.java:96) at com.sun.enterprise.ee.security.NssStore.getInstance(NssStore.java:136) at com.sun.enterprise.ee.admin.servermgmt.EEDomainsManager.createNSSCertDB(EEDomainsManager.java:305) at com.sun.enterprise.ee.admin.servermgmt.EEDomainsManager.createSSLCertificateDatabase(EEDomainsManager.java:191) at com.sun.enterprise.admin.servermgmt.pe.PEDomainsManager.createDomain(PEDomainsManager.java:141) at com.sun.enterprise.ee.admin.servermgmt.EEDomainsManager.createDomain(EEDomainsManager.java:141) at com.sun.enterprise.cli.commands.CreateDomainCommand.createTheDomain(CreateDomainCommand.java:333) at com.sun.enterprise.cli.commands.CreateDomainCommand.runCommand(CreateDomainCommand.java:189) at com.sun.enterprise.cli.commands.MultiProcessCommand.processLine(MultiProcessCommand.java:312) at com.sun.enterprise.cli.commands.MultiProcessCommand.runCommand(MultiProcessCommand.java:103) at com.sun.enterprise.cli.framework.CLIMain.invokeCommand(CLIMain.java:155) at com.sun.enterprise.cli.framework.CLIMain.main(CLIMain.java:63) Cannot init NSS.

glassfishrobot commented 18 years ago

@glassfishrobot Commented bnevins said: Kedar,

I'm reassigning to you because: 1) I'm on vacation starting now and 2) I believe the problem is in NSS native code and should be assigned to security folk or domain-name restrictions should be doc'd

glassfishrobot commented 18 years ago

@glassfishrobot Commented bnevins said: Here is exactly what I did to "inject" a unicode domain name for the create-domain command:

=================================================================== RCS file: /cvs/glassfish/admin-cli/commands/src/java/com/sun/enterprise/cli/commands/CreateDomainCommand.java,v retrieving revision 1.12 diff -b -u -r1.12 CreateDomainCommand.java — src/java/com/sun/enterprise/cli/commands/CreateDomainCommand.java 6 Feb 2006 06:11:14 -0000 1.12 +++ src/java/com/sun/enterprise/cli/commands/CreateDomainCommand.java 13 Apr 2006 06:05:13 -0000 @@ -156,7 +156,8 @@ new Object[]

{DOMAINDIR_OPTION}

)); //domain validation upfront (i.e. before we prompt) try {

glassfishrobot commented 18 years ago

@glassfishrobot Commented km105526 said: reassigned.

glassfishrobot commented 18 years ago

@glassfishrobot Commented @shingwaichan said: It seems that we are going into a different direction here. The original issue is that the domain being created is "English", but the underlying OS is non-en_US characters. (Maybe the directory name is not English.) According to http://forum.java.sun.com/thread.jspa?forumID=136&threadID=535069, at javax.xml.parsers.SAXParser.parse(SAXParser.java:281) at com.sun.enterprise.admin.servermgmt.util.DomainXmlSAXParser.parse(DomainXmlSAXParser.java:33) at com.sun.enterprise.admin.servermgmt.pe.PEDomainsManager.createDomainXmlEvents(PEDomainsManager.java:174)

The further investigation below is actually looking at a different issue, namely, create a domain with non-English name in "EE" environment.

glassfishrobot commented 18 years ago

@glassfishrobot Commented kumara said: According to the detailed stack trace from the forum entry, it seems that the customer is running it on 8.0 or 8.0 UR1 (with JDK 1.4.2) because the xml parser class is org.apache.xerces... instead of com.sun.org.apache... (used in later releases)

Caused by: java.io.UTFDataFormatException: Invalid byte 1 of 1-byte UTF-8 sequence. at org.apache.xerces.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:693) at org.apache.xerces.impl.io.UTF8Reader.read(UTF8Reader.java:566) at org.apache.xerces.impl.XMLEntityScanner.load(XMLEntityScanner.java:1509) at org.apache.xerces.impl.XMLEntityScanner.scanLiteral(XMLEntityScanner.java:745) at org.apache.xerces.impl.XMLScanner.scanAttributeValue(XMLScanner.java:899) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanAttribute(XMLDocumentFragmentScannerImpl.java:907) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:821) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1568) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:355) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:539) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:595) at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152) at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1125) at javax.xml.parsers.SAXParser.parse(SAXParser.java:345) at javax.xml.parsers.SAXParser.parse(SAXParser.java:281) at com.sun.enterprise.admin.servermgmt.util.DomainXmlSAXParser.parse(DomainXmlSAXParser.java:33) at com.sun.enterprise.admin.servermgmt.pe.PEDomainsManager.createDomainXmlEvents(PEDomainsManager.java:174) ... 7 more

Needs further investigation to see if it can be reproduced on 9.0. As of 8.1 the only external value used during domain creation is host name (because the paths are expressed as system properties). For 9.0 PE, the only use of host name (which might have non UTF-8 characters) is in JMS host. At some point we should look at resolving the client address of JMS at runtime and default the server to use IP_ANY (0.0.0.0). This will reduce another external dependency.

glassfishrobot commented 18 years ago

@glassfishrobot Commented kravtch said: Bug #6409173 (IT 535 : If system name contains a non en_US character, create-domain fails ...) templates token replacement used only default charset(UTF-16) to produce domain.xml files but xml suggested UTF-8 coding Changes: admin-core/util:

Checking in src/java/com/sun/enterprise/admin/util/LineTokenReplacer.java; /cvs/glassfish/admin-core/util/src/java/com/sun/enterprise/admin/util/LineTokenReplacer.java,v <-- LineTokenReplacer.j ava new revision: 1.3; previous revision: 1.2 done Checking in servermgmt/src/java/com/sun/enterprise/admin/servermgmt/RepositoryManager.java; /cvs/glassfish/admin/servermgmt/src/java/com/sun/enterprise/admin/servermgmt/RepositoryManager.java,v <-- RepositoryMa nager.java new revision: 1.6; previous revision: 1.5 done (IT 535 : If system name contains a non en_US character, create-domain fails ...) templates token replacement used only default charset(UTF-16) to produce domain.xml files but xml suggested UTF-8 coding Changes: admin-core/util:

Checking in src/java/com/sun/enterprise/admin/util/LineTokenReplacer.java; /cvs/glassfish/admin-core/util/src/java/com/sun/enterprise/admin/util/LineTokenReplacer.java,v <-- LineTokenReplacer.j ava new revision: 1.3; previous revision: 1.2 done Checking in servermgmt/src/java/com/sun/enterprise/admin/servermgmt/RepositoryManager.java; /cvs/glassfish/admin/servermgmt/src/java/com/sun/enterprise/admin/servermgmt/RepositoryManager.java,v <-- RepositoryMa nager.java new revision: 1.6; previous revision: 1.5 done

glassfishrobot commented 18 years ago

@glassfishrobot Commented Was assigned to kravtch

glassfishrobot commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA GLASSFISH-535

glassfishrobot commented 18 years ago

@glassfishrobot Commented Reported by km105526

glassfishrobot commented 17 years ago

@glassfishrobot Commented Marked as fixed on Thursday, May 17th 2007, 4:05:53 am