Configure struts2 + spring + hibernate (SSH) in the BAE environment (3) spring & amp

Source: Internet
Author: User

1. Add necessary packages to lib. The import result is as follows:

Only include necessary packages. Additional requirements are required.

2. Upload All java files to the src directory.

3. Put all the poing files (XXX. hbm. xml) to the src directory.

4. Modify and configure the database

jdbc.driverClassName=com..jdbc..url=jdbc::jdbc.username=.password=sk

The database address is sqld.duapp.com, the port is 4050, And the dbname is"Cloud Environment Management> Service Management> MySQL (database)The name of the database created in the application. the user name is the API Key of the application and the password is the Secret Key.

5. modify all locations used to the Database Name

For example, in the POJO ing file (XXX. hbm. xml)

 

The values in must be changed to the database name specified by the BAE. Otherwise, the exception org. hibernate. exception. SQLGrammarException: cocould not execute query will occur.

6. Modify and add spring:

  contextConfigLocation  classpath:applicationContext.xml            org.springframework.web.context.ContextLoaderListener    
ContextConfigLocation is used to set the location of applicationContext. xml. When the server is started, it will find the/WEB_INF/applicationContext. xml file. After the server is started, it will find applicationContext. xml in the classes directory.
Note: It is useless to place anything under the/WEB_INF/classes directory in the project code. BAE will compile the files under the src directory and copy them to the directory where the real application runs.
7. Configuration:
  true           

Where

true

This parameter is used to start distributed sessions. If this parameter is not set, the Session function is disabled by default. If the Session is used, an error is reported.

 

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.