AWSのEC2上に、glassfishをインストールした時のメモ

AWS EC2のAmazonlinuxに、glassfish4をインストールする際に結構ハマったのでメモ

まずは、jdk1.7が入っているか確認


$ java -version
java version "1.7.0_25"
OpenJDK Runtime Environment (amzn-2.3.10.3.29.amzn1-x86_64)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)

 

入っていたのでglassfishのダウンロード、配置

$ cd /usr/local/
$ sudo wget http://download.java.net/glassfish/4.0/release/glassfish-4.0-ml.zip
$ sudo unzip glassfish-4.0-ml.zip

 

つづいて起動、すると以下のエラー


# sudo su
# glassfish4/bin/asadmin start-domain
Waiting for domain1 to start .............Error starting domain domain1.
The server exited prematurely with exit code 1.
Before it died, it produced the following output:


Launching GlassFish on Felix platform
Registry Info:: Total repositories: 1, Total modules = 387
Attached repository: []
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.common.glassfish-mbeanserver [319]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [javax.security.auth.message-api [350]], State = [NEW]]
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.transaction.jta [113]], State = [NEW]]
~~~~~~~~~~~省略~~~~~~~~~~~
Registered Module: [OSGiModuleImpl:: Bundle = [org.glassfish.main.admin.server-mgmt-l10n [250]], State = [NEW]]
Registered com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishRuntime@4f2fb603 in service registry.
Completed shutdown of GlassFish runtime
We are in non-embedded mode, so org.glassfish.main.core.glassfish [360] has nothing to do.
11 09, 2013 12:12:47 午後 com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner createBundleProvisioner
情報: Create bundle provisioner class = class com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner.
11 09, 2013 12:12:47 午後 com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner$DefaultCustomizer getLocations
WARNING: Skipping entry because it is not an absolute URI.
11 09, 2013 12:12:47 午後 com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner$DefaultCustomizer getLocations
WARNING: Skipping entry because it is not an absolute URI.
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:97)
at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:54)
Caused by: A MultiException has 8 exceptions. They are:
1. java.lang.ExceptionInInitializerError
2. java.lang.IllegalStateException: Unable to perform operation: post construct on org.glassfish.server.ServerEnvironmentImpl
3. java.lang.IllegalArgumentException: While attempting to resolve the dependencies of com.sun.enterprise.v3.server.DomainXmlPersistence errors were found
4. java.lang.IllegalStateException: Unable to perform operation: resolve on com.sun.enterprise.v3.server.DomainXmlPersistence
5. java.lang.NoClassDefFoundError: Could not initialize class com.sun.enterprise.util.net.NetUtils
6. java.lang.IllegalStateException: Unable to perform operation: post construct on org.glassfish.server.ServerEnvironmentImpl
7. java.lang.IllegalArgumentException: While attempting to resolve the dependencies of com.sun.enterprise.v3.server.GFDomainXml errors were found
8. java.lang.IllegalStateException: Unable to perform operation: resolve on com.sun.enterprise.v3.server.GFDomainXml
at org.jvnet.hk2.internal.Collector.throwIfErrors(Collector.java:84)
at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:229)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:311)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:448)
at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:118)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2204)
at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetAllServiceHandles(ServiceLocatorImpl.java:1149)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServices(ServiceLocatorImpl.java:651)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServices(ServiceLocatorImpl.java:639)
at org.jvnet.hk2.config.ConfigurationPopulator.populateConfig(ConfigurationPopulator.java:56)
at org.glassfish.hk2.bootstrap.HK2Populator.populateConfig(HK2Populator.java:158)
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.populateConfig(AbstractModulesRegistryImpl.java:211)
at com.sun.enterprise.module.bootstrap.Main.createServiceLocator(Main.java:273)
at org.jvnet.hk2.osgiadapter.HK2Main.createServiceLocator(HK2Main.java:120)
at com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishRuntime.newGlassFish(EmbeddedOSGiGlassFishRuntime.java:95)
at com.sun.enterprise.glassfish.bootstrap.GlassFishRuntimeDecorator.newGlassFish(GlassFishRuntimeDecorator.java:68)
at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishRuntime.newGlassFish(OSGiGlassFishRuntime.java:91)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(GlassFishMain.java:113)
... 6 more
Caused by: java.lang.ExceptionInInitializerError
at com.sun.enterprise.util.net.NetUtils.(NetUtils.java:55)
at com.sun.enterprise.universal.glassfish.ASenvPropertyReader$ASenvMap.getHostname(ASenvPropertyReader.java:310)
at com.sun.enterprise.universal.glassfish.ASenvPropertyReader$ASenvMap.get(ASenvPropertyReader.java:153)
at com.sun.enterprise.universal.glassfish.ASenvPropertyReader$ASenvMap.completeMap(ASenvPropertyReader.java:191)
at com.sun.enterprise.universal.glassfish.ASenvPropertyReader$ASenvMap.entrySet(ASenvPropertyReader.java:171)
at org.glassfish.server.ServerEnvironmentImpl.postConstruct(ServerEnvironmentImpl.java:165)
at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:281)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:328)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:448)
at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:118)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2204)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:549)
at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:77)
at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:191)
at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:214)
at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:311)
at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:448)
at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:118)
at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2204)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:549)
at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:77)
at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:191)
at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:214)
... 22 more
Caused by: java.util.MissingResourceException: Can't find com.sun.enterprise.util.LogMessages bundle
at java.util.logging.Logger.setupResourceInfo(Logger.java:1400)
at java.util.logging.Logger.(Logger.java:256)
at java.util.logging.LogManager.demandLogger(LogManager.java:399)
at java.util.logging.Logger.demandLogger(Logger.java:315)
at java.util.logging.Logger.getLogger(Logger.java:408)
at com.sun.enterprise.util.CULoggerInfo.(CULoggerInfo.java:61)
... 45 more
Command start-domain failed.

いろいろネットで調べると、java version “1.7.0_25” のバグらしいので

javaのアップデート


# yum install java-1.7.0-openjdk-devel.x86_64
# java -version
java version "1.7.0_45"
OpenJDK Runtime Environment (amzn-2.4.3.2.32.amzn1-x86_64 u45-b15)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)

もう一度起動すると、おおいいじゃん


# glassfish4/bin/asadmin start-domain
Waiting for domain1 to start ............................................
Successfully started the domain : domain1
domain Location: /usr/local/glassfish4/glassfish/domains/domain1
Log File: /usr/local/glassfish4/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.

コメント

タイトルとURLをコピーしました