在 Tomcat 的 server.xml 裡設定

<Context docBase="weixin" path="/weixin" reloadable="true" source="org.eclipse.jst.jee.server:weixin">
        <Resource name="jdbc/mysqlLocalDS01" username="root" password="password" url="jdbc:mysql://localhost:3306?characterEncoding=utf-8" auth="Container" driverClassName="com.mysql.cj.jdbc.Driver" factory="org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory" maxIdle="10" maxTotal="20" maxWaitMillis="-1" type="javax.sql.DataSource" />      
        <Resource name="jdbc/JappsDS01" username="ap" password="password" url="jdbc:oracle:thin:@127.0.0.1:1521:xe" driverClassName="oracle.jdbc.driver.OracleDriver" maxIdle="2" maxTotal="4" maxWaitMillis="5000"  type="javax.sql.DataSource" validationQuery="select 1 from dual"/>
    <Resources>
       <PreResources base="C://CKFinderJava//userfiles" className="org.apache.catalina.webresources.DirResourceSet" webAppMount="/userfiles"/>
   </Resources>
</Context>

MIS 發表在 痞客邦 留言(0) 人氣()


環境:
eclipse : https://eclipse.org/downloads/packages/release/Neon/3

MIS 發表在 痞客邦 留言(0) 人氣()

用 Hibernet Tool 自動產生的 Domain Code,對於 FOREIGN KEY 會以 annotation:  @ManyToMany(fetch = FetchType.LAZY) 來作註,但執行時會發生下列的錯誤
Struts Problem Report

MIS 發表在 痞客邦 留言(0) 人氣()

作法如下:
http://stackoverflow.com/questions/26616723/java-lang-nosuchmethoderror-javax-persistence-table-indexesljavax-persistenc

MIS 發表在 痞客邦 留言(0) 人氣()


所需軟體
1. OS: windows 7

MIS 發表在 痞客邦 留言(1) 人氣()

在目錄 %JBOSS_HOME%\modules\com\microsoft\sqlserver\jdbc\main 下放入 module.xml & sqljdbc42.jar
module.xml 的內容

MIS 發表在 痞客邦 留言(0) 人氣()

Sql Server Express

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
        <property name="hibernate.connection.url">jdbc:sqlserver://localhost\SQLEXPRESS;databaseName=master;user=sa;password=password</property>
        <property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
    </session-factory>
</hibernate-configuration>

MIS 發表在 痞客邦 留言(0) 人氣()

Step 01: 準備 table : TEST_GROUP & TEST_MEMBERS
 
table : TEST_GROUP



CREATE TABLE JAPPS.TEST_GROUP
(
  ID    VARCHAR2(10 BYTE),
  NAME  VARCHAR2(10 BYTE)
)


MIS 發表在 痞客邦 留言(0) 人氣()

datagrid
使用 EasyUI 的 Datagrid 選擇到一筆記錄後,將這一筆完整的資料要送到後端 Java 接收,可以先轉換成 JSON 的格式再後送。
UI 的圖示如下,可以用 FireBug 去查看 JavaScript 裡的資料

MIS 發表在 痞客邦 留言(0) 人氣()

Struts2 的 logger 是與 log4j2 作整合,同樣是 Apache Project 專案之一。為了瞭解一下與架構 Java 專案時的偵錯機制,所以花了半天的時間來實作。
Maven 對 log4j2 相依性




    <properties>
        <struts2.version>2.3.24.1</struts2.version>
        <log4j2.version>2.2</log4j2.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>


        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>${log4j2.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>${log4j2.version}</version>
        </dependency>





MIS 發表在 痞客邦 留言(0) 人氣()

當 struts2 加入 struts2-spring-plugin 的 JAR 檔後,執行 JUnit 或 Maven build 時發生 



SEVERE:   [50:59.081] ********** FATAL ERROR STARTING UP STRUTS-SPRING INTEGRATION **********
Looks like the Spring listener was not configured for your web app!
Nothing will work until WebApplicationContextUtils returns a valid ApplicationContext.
You might need to add the following to web.xml:
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
SEVERE:   [50:59.089] Dispatcher initialization failed


MIS 發表在 痞客邦 留言(0) 人氣()

applicationContext
上次介紹 Spring Quartz Job Schedule Simple Example 工作排程器 ,現在再來使用 Spring 原生的 Task Execution and Scheduling,首先來瞭解一下 @Scheduled annotation 的意思



This annotation is used for task scheduling. The trigger information needs to be provided along with this annotation. You can use the properties fixedDelay/fixedRate/cron to provide the triggering information.
1. fixedRate: makes Spring run the task on periodic intervals even if the last invocation may be still running. 固定時間執行,不管上一次是否結束
2. fixedDelay: specifically controls the next execution time when the last execution finishes. 上一次執行結束後,再依設定的固定時間執行
3. cron: is a feature originating from Unix cron utility and has various options based on your requirements. BJ4(就不解釋了)


MIS 發表在 痞客邦 留言(0) 人氣()

Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。