CentOS installation glassfish4.0 configuring JDBC Connection MySQL

Source: Internet
Author: User
Tags glassfish

Version Glassfish-4.0.zip

1, unzip, copy to the specified installation path

Unzip Glassfish-4.0.zip CP CP glassfish4/usr/local/-RF

2. set glassfish environment variable

Vim/etc/profileexport glassfish_home=/usr/local/glassfish4export path=.: $PATH: $JAVAHOME/bin: $MYSQLHOME/bin:$ Glassfish_home/binsource/etc/profle

Enter /usr/local/glassfish4/glassfish/config, Edit the directory under the asevn.conf file, add at the end of the file as_java= "/USR/LOCAL/JDK" (value is native JDK installation path)

As_java= "/usr/jdk1.7.0_60"

3. If you do not want to use the default domain, You can create your own domain in this step andspecify domaindir and Admin Port

Execute the following command to create a domain with port 4848 named Rainbow Disk

Asadmin create-domain--adminport 4848 Hongpan

Enter Admin user name [Enter to accept default ' admin '/no password]>

Bad Network Configuration. DNS can not resolve the hostname:

Java.net.UnknownHostException:dev:dev:Name or service not known

Using Port 4848 for Admin.

Using the 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-Certificate Server is:

[Cn=localhost,ou=glassfish,o=oracle Corporation,l=santa Clara,st=california,c=us]

Distinguished Name of the self-signed-Certificate Server is:

[Cn=localhost-instance,ou=glassfish,o=oracle Corporation,l=santa Clara,st=california,c=us]

Domain Hongpan created.

Domain Hongpan Admin Port is 4848.

Domain Hongpan allows admin login as user "admin" with no password.

Command Create-domain executed successfully.


4. Start the domain Rainbow Plate just established

Asadmin Start-domain Hongpan

Waiting for Hongpan to start ................

Successfully started the Domain:hongpan

Domain Location:/usr/local/glassfish4/glassfish/domains/hongpan

Log File:/usr/local/glassfish4/glassfish/domains/hongpan/logs/server.log

Admin port:4848

Command Start-domain executed successfully.


5. Modify the admin password of the domain you just created , and enable it to Log on to the console via the web

Asadmin Change-admin-password

Enter Admin user name [default:admin]>

Enter the admin password>

Enter the new admin password>

Enter the new admin password again>

Command Change-admin-password executed successfully.


Every time the console is prompted to enter the user name password, more trouble

You can create a password configuration file

As_admin_password=xxxx


6. Enable remote login permission

Asadmin Enable-secure-admin

Enter Admin User name>

Enter Admin password>

You must restart all running servers for the change on secure admin to take effect.

Command Enable-secure-admin executed successfully.


7. Restart domain

Asadmin Restart-domain Hongpan

Management is now available through the console

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/3F/14/wKioL1PIk4DRdaxIAAFmMzmNQO0238.jpg "title=" 1.jpg " alt= "Wkiol1pik4drdaxiaafmmzmnqo0238.jpg"/>


Configure the JDBC connection below to start MySQL

1. Copy the jar bundle from MySQL to the GlassFish Library directory.

CP mysql-connector-java-5.1.16-bin.jar/usr/local/glassfish4/glassfish/lib/

2. Restart domain


3. Log in to the MySQL console, to the JDBC Connection pool interface

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/3F/1D/wKiom1PIlPyT3GaUAAHCdi-KgAQ928.jpg "title=" 2.jpg " alt= "Wkiom1pilpyt3gauaahcdi-kgaq928.jpg"/>

Click New to create a new JDBC Connection pool

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/3F/1D/wKiom1PIlcvjqFtbAAGwpxx_Pdk287.jpg "title=" 3.jpg " alt= "Wkiom1pilcvjqftbaagwpxx_pdk287.jpg"/>

Configure connection Properties

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/3F/1D/wKioL1PIl6_TyLgfAAGgpiy139A473.jpg "title=" 4.jpg " alt= "wkiol1pil6_tylgfaaggpiy139a473.jpg"/> test Connectivity

Succeeded


4, to create a JDBC resource, the program will only need to connect the Jndi name to

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/3F/1F/wKiom1PIl6TTCKjOAAI7hrL4YRw977.jpg "title=" 6.jpg " alt= "Wkiom1pil6ttckjoaai7hrl4yrw977.jpg"/>

JNDI name fills in the names, pools name selects the JDBC connection pool you just created.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/3F/1F/wKioL1PImNnQ1p6dAAGiZoewGYo613.jpg "title=" 7.jpg " alt= "Wkiol1pimnnq1p6daagizoewgyo613.jpg"/>

Configuration complete, Done!

This article is from the "http://yayang.blog.51cto.com/826316/1439841" blog, make sure to keep this source.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.