Command:
sudo vi /etc/php.ini
...
expose_php = Off
memory_limit = 128M
date.timezone = Asia/Hong_Kong
...
Reference:
http://www.php.net/manual/en/timezones.php
2013年9月30日 星期一
AMI Linux, set timezone
This article teaches you how to set timezone in your AMI Linux Machine.
1. List out the timezone
ls -F /usr/share/zoneinfo/
2. Setup timezone
sudo ln -sf /usr/share/zoneinfo/Asia/Hong_Kong /etc/localtime
3. Show the date
date
1. List out the timezone
ls -F /usr/share/zoneinfo/
2. Setup timezone
sudo ln -sf /usr/share/zoneinfo/Asia/Hong_Kong /etc/localtime
3. Show the date
date
2013年7月31日 星期三
Resolved: Glassfish4: Configuration Error: Secure Admin must be enabled to access the DAS remotely.
After started the Glassfish4 server, the following error message was shown in the screen.
Configuration Error: Secure Admin must be enabled to access the DAS remotely.
Solution:
For remote access, Glassfish does not allow admin account with empty password.
It could be fixed by following steps:
1. Change the password via command
./asadmin change-admin-password
2. Restart the Glassfish server
./admin stop-domain
./admin start-domain
3. Enable Secure admin via command
./asadmin enable-secure-admin
Configuration Error: Secure Admin must be enabled to access the DAS remotely.
Solution:
For remote access, Glassfish does not allow admin account with empty password.
It could be fixed by following steps:
1. Change the password via command
./asadmin change-admin-password
2. Restart the Glassfish server
./admin stop-domain
./admin start-domain
3. Enable Secure admin via command
./asadmin enable-secure-admin
Resolved: Glassfish4 in AWS Ubuntu: Couldn't get lock for /srv/glassfish4/glassfish/domains/domain1/logs/server.log
Failed to start Glassfish4 server on AWS Ubuntu and returns error message of:
Couldn't get lock for /srv/glassfish4/glassfish/domains/domain1/logs/server.log
Solution:
It is usually caused by the permission problem on the execution account. Try to switch user as the owner of the glassfish and start it up again!
Error message
/srv/glassfish4/bin$ ./asadmin start-domain
java.io.IOException: Couldn't get lock for /srv/glassfish4/glassfish/domains/domain1/logs/server.log
at java.util.logging.FileHandler.openFiles(FileHandler.java:389)
at java.util.logging.FileHandler.<init>(FileHandler.java:287)
at com.sun.enterprise.admin.launcher.GFLauncherLogger.addLogFileHandler(GFLauncherLogger.java:98)
at com.sun.enterprise.admin.launcher.GFLauncher.setup(GFLauncher.java:191)
at com.sun.enterprise.admin.servermgmt.cli.StartDomainCommand.createLauncher(StartDomainCommand.java:220)
at com.sun.enterprise.admin.servermgmt.cli.StartDomainCommand.executeCommand(StartDomainCommand.java:117)
at com.sun.enterprise.admin.cli.CLICommand.execute(CLICommand.java:321)
at com.sun.enterprise.admin.cli.AdminMain.executeCommand(AdminMain.java:360)
at com.sun.enterprise.admin.cli.AdminMain.doMain(AdminMain.java:298)
at org.glassfish.admin.cli.AsadminMain.main(AsadminMain.java:56)
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
Exception in thread "main" java.lang.RuntimeException: the domain directory is not writable.
at com.sun.enterprise.glassfish.bootstrap.MainHelper.verifyDomainRoot(MainHelper.java:244)
at com.sun.enterprise.glassfish.bootstrap.MainHelper.findInstanceRoot(MainHelper.java:347)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:78)
at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:54)
Command start-domain failed.
Couldn't get lock for /srv/glassfish4/glassfish/domains/domain1/logs/server.log
Solution:
It is usually caused by the permission problem on the execution account. Try to switch user as the owner of the glassfish and start it up again!
Error message
/srv/glassfish4/bin$ ./asadmin start-domain
java.io.IOException: Couldn't get lock for /srv/glassfish4/glassfish/domains/domain1/logs/server.log
at java.util.logging.FileHandler.openFiles(FileHandler.java:389)
at java.util.logging.FileHandler.<init>(FileHandler.java:287)
at com.sun.enterprise.admin.launcher.GFLauncherLogger.addLogFileHandler(GFLauncherLogger.java:98)
at com.sun.enterprise.admin.launcher.GFLauncher.setup(GFLauncher.java:191)
at com.sun.enterprise.admin.servermgmt.cli.StartDomainCommand.createLauncher(StartDomainCommand.java:220)
at com.sun.enterprise.admin.servermgmt.cli.StartDomainCommand.executeCommand(StartDomainCommand.java:117)
at com.sun.enterprise.admin.cli.CLICommand.execute(CLICommand.java:321)
at com.sun.enterprise.admin.cli.AdminMain.executeCommand(AdminMain.java:360)
at com.sun.enterprise.admin.cli.AdminMain.doMain(AdminMain.java:298)
at org.glassfish.admin.cli.AsadminMain.main(AsadminMain.java:56)
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
Exception in thread "main" java.lang.RuntimeException: the domain directory is not writable.
at com.sun.enterprise.glassfish.bootstrap.MainHelper.verifyDomainRoot(MainHelper.java:244)
at com.sun.enterprise.glassfish.bootstrap.MainHelper.findInstanceRoot(MainHelper.java:347)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:78)
at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:54)
Command start-domain failed.
Cannot resolve: AWS Linux AMI + Glassfish4 Command start-domain failed.
Tried to setup a Glassfish4 server on AWS Linux AMI but not succeed.
After searched Google, seems there is a bug in openjdk and it was fixed on the release java-1.7.0-openjdk-devel-1.7.0.25-2.3.10.4.
Installed command: sudo yum install java-1.7.0-openjdk-devel
Installed version: 1.7.0.25-2.3.10.3.29.amzn1
Running Glassfish server and results the following error:
After searched Google, seems there is a bug in openjdk and it was fixed on the release java-1.7.0-openjdk-devel-1.7.0.25-2.3.10.4.
Installed command: sudo yum install java-1.7.0-openjdk-devel
Installed version: 1.7.0.25-2.3.10.3.29.amzn1
Running Glassfish server and results the following error:
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.NoClassDefFoundError: Could not initialize class com.sun.enterprise.util.net.NetUtils
4. java.lang.IllegalStateException: Unable to perform operation: post construct on org.glassfish.server.ServerEnvironmentImpl
5. java.lang.IllegalArgumentException: While attempting to resolve the dependencies of com.sun.enterprise.v3.server.DomainXmlPersistence errors were found
6. java.lang.IllegalStateException: Unable to perform operation: resolve on com.sun.enterprise.v3.server.DomainXmlPersistence
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
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.NoClassDefFoundError: Could not initialize class com.sun.enterprise.util.net.NetUtils
4. java.lang.IllegalStateException: Unable to perform operation: post construct on org.glassfish.server.ServerEnvironmentImpl
5. java.lang.IllegalArgumentException: While attempting to resolve the dependencies of com.sun.enterprise.v3.server.DomainXmlPersistence errors were found
6. java.lang.IllegalStateException: Unable to perform operation: resolve on com.sun.enterprise.v3.server.DomainXmlPersistence
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
....
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:490)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:97)
at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:54)
Caused by: java.lang.ExceptionInInitializerError
at org.glassfish.common.util.admin.ManagedFile.<clinit>(ManagedFile.java:90)
at com.sun.enterprise.v3.server.DomainXmlPersistence.getPidFile(DomainXmlPersistence.java:102)
at com.sun.enterprise.v3.server.DomainXmlPersistence.accessRead(DomainXmlPersistence.java:114)
at org.glassfish.config.support.DomainXml.parseDomainXml(DomainXml.java:255)
at org.glassfish.config.support.DomainXml.run(DomainXml.java:117)
at org.jvnet.hk2.config.ConfigurationPopulator.populateConfig(ConfigurationPopulator.java:58)
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:88)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(GlassFishMain.java:113)
... 6 more
Caused by: java.util.MissingResourceException: Can't find com.sun.enterprise.util.LogMessages bundle
at java.util.logging.Logger.setupResourceInfo(Logger.java:1676)
at java.util.logging.Logger.<init>(Logger.java:285)
at java.util.logging.LogManager.demandLogger(LogManager.java:443)
at java.util.logging.Logger.demandLogger(Logger.java:347)
at java.util.logging.Logger.getLogger(Logger.java:438)
at com.sun.enterprise.util.CULoggerInfo.<clinit>(CULoggerInfo.java:61)
... 20 more
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:490)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:97)
at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:54)
Caused by: java.lang.ExceptionInInitializerError
at org.glassfish.common.util.admin.ManagedFile.<clinit>(ManagedFile.java:90)
at com.sun.enterprise.v3.server.DomainXmlPersistence.getPidFile(DomainXmlPersistence.java:102)
at com.sun.enterprise.v3.server.DomainXmlPersistence.accessRead(DomainXmlPersistence.java:114)
at org.glassfish.config.support.DomainXml.parseDomainXml(DomainXml.java:255)
at org.glassfish.config.support.DomainXml.run(DomainXml.java:117)
at org.jvnet.hk2.config.ConfigurationPopulator.populateConfig(ConfigurationPopulator.java:58)
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:88)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(GlassFishMain.java:113)
... 6 more
Caused by: java.util.MissingResourceException: Can't find com.sun.enterprise.util.LogMessages bundle
at java.util.logging.Logger.setupResourceInfo(Logger.java:1676)
at java.util.logging.Logger.<init>(Logger.java:285)
at java.util.logging.LogManager.demandLogger(LogManager.java:443)
at java.util.logging.Logger.demandLogger(Logger.java:347)
at java.util.logging.Logger.getLogger(Logger.java:438)
at com.sun.enterprise.util.CULoggerInfo.<clinit>(CULoggerInfo.java:61)
... 20 more
2013年7月27日 星期六
2013年7月20日 星期六
Install Java 7 in AWS Linux
This article teaches you how to change the Java version to Java 7 in AWS Linus.
1. sudo yum install java-1.7.0-openjdk
2. sudo alternatives --config java
1. sudo yum install java-1.7.0-openjdk
2. sudo alternatives --config java
How to setup a AWS linux server
This tutorial teaches you how to create a linux instance in AWS.
1. Create Instance --> Launch Instance
2. Choose Classic
3. Select Amazon Linus AMI
4. Continue
5. Continue
6. Continue
7. Continue
8. Enter the name for the key and then click "Create & Download your Key Pair". This is the key for the server access (e.g. ssh). Please keep it in a safe place as you cannot change it / download it again from aws.
9. Enter the Name and Description for the Security Group
10. Click Launch
11. Done!
1. Create Instance --> Launch Instance
2. Choose Classic
3. Select Amazon Linus AMI
4. Continue
5. Continue
6. Continue
7. Continue
8. Enter the name for the key and then click "Create & Download your Key Pair". This is the key for the server access (e.g. ssh). Please keep it in a safe place as you cannot change it / download it again from aws.
9. Enter the Name and Description for the Security Group
10. Click Launch
11. Done!
2013年4月8日 星期一
Connect to AWS Linux Server by using putty
This article teaches you how to connect to your AWS linux server via putty.
Step 1. Download the private key from aws console.
Step 2. Download puttygen from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Step 3. Import the downloaded private key to puttygen, and then save the key in ppk format
Step 4. Open putty, type the information such as hostname as usual..
go to Connection ->SSH -> Auth, and input the path of your private key
Step 5. Successfully connect to AWS Linux server!
Step 1. Download the private key from aws console.
Step 2. Download puttygen from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Step 3. Import the downloaded private key to puttygen, and then save the key in ppk format
Step 4. Open putty, type the information such as hostname as usual..
go to Connection ->SSH -> Auth, and input the path of your private key
Step 5. Successfully connect to AWS Linux server!
2013年4月4日 星期四
[Resolved] Connect to AWS Linux Server by using WinSCP
WinSCP returns "Permission Denied" when copying files to AWS Linux Server using ec2-user account.
In order to transfer files via WinSCP using root account,
1) Go to Environment -> SCP / Shell
2) Choose "sudo su -" in the field "Shell"
System shows error: "Connection has been unexpectedly closed. Server sent command exit status 1.
Error skipping startup message. Your shell is probably incompatible with application (BASH is recommended)
In WinSCP log..
. 2013-04-04 19:21:56.661 Started a shell/command
. 2013-04-04 19:21:56.665 --------------------------------------------------------------------------
. 2013-04-04 19:21:56.665 Using SCP protocol.
. 2013-04-04 19:21:56.667 Doing startup conversation with host.
. 2013-04-04 19:21:56.672 Skipping host startup message (if any).
> 2013-04-04 19:21:56.672 echo "WinSCP: this is end-of-file:0"
! 2013-04-04 19:21:56.699 sudo: sorry, you must have a tty to run sudo
. 2013-04-04 19:21:56.699 Server sent command exit status 1
. 2013-04-04 19:21:56.700 Disconnected: All channels closed
* 2013-04-04 19:21:56.713 (ESshFatal) Connection has been unexpectedly closed. Server sent command exit status 1.
* 2013-04-04 19:21:56.713 Error skipping startup message. Your shell is probably incompatible with the application (BASH is recommended).
Login to AWS Linux Server
1) Run command visudo using root account
2) Search the line "Defaults requiretty" and add "Defaults:ec2-user !requiretty" right after it.
After the setup, you can SCP to the server.
In order to transfer files via WinSCP using root account,
1) Go to Environment -> SCP / Shell
2) Choose "sudo su -" in the field "Shell"
System shows error: "Connection has been unexpectedly closed. Server sent command exit status 1.
Error skipping startup message. Your shell is probably incompatible with application (BASH is recommended)
In WinSCP log..
. 2013-04-04 19:21:56.661 Started a shell/command
. 2013-04-04 19:21:56.665 --------------------------------------------------------------------------
. 2013-04-04 19:21:56.665 Using SCP protocol.
. 2013-04-04 19:21:56.667 Doing startup conversation with host.
. 2013-04-04 19:21:56.672 Skipping host startup message (if any).
> 2013-04-04 19:21:56.672 echo "WinSCP: this is end-of-file:0"
! 2013-04-04 19:21:56.699 sudo: sorry, you must have a tty to run sudo
. 2013-04-04 19:21:56.699 Server sent command exit status 1
. 2013-04-04 19:21:56.700 Disconnected: All channels closed
* 2013-04-04 19:21:56.713 (ESshFatal) Connection has been unexpectedly closed. Server sent command exit status 1.
* 2013-04-04 19:21:56.713 Error skipping startup message. Your shell is probably incompatible with the application (BASH is recommended).
Login to AWS Linux Server
1) Run command visudo using root account
2) Search the line "Defaults requiretty" and add "Defaults:ec2-user !requiretty" right after it.
After the setup, you can SCP to the server.
訂閱:
文章 (Atom)