LoginSignup
2
2

More than 5 years have passed since last update.

Java EE7の勉強用のリポジトリを立ち上げた。

Last updated at Posted at 2016-06-21

Java EE7のプロジェクト作成について覚書


稼働環境

謎にWin10、NetBeans8.1、GlassFish4.1.1、MySQL5.7.13


ソース所在

ブログに逐一手順を書くのは効率よくないので、ソースをGitHubで晒すことにします。
(Readmeは後日書きます)
ソースだけだと読み取れない手順について、ブログで補足します。


プロジェクトを作る

NetBeansで、新規プロジェクト>Maven>Webアプリケーション

pomはweb-apiで出来るのでjavaee-apiへの書き換えが必要

pom.xml(書き換え前)
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-web-api</artifactId>
        <version>7.0</version>
        <scope>provided</scope>
    </dependency>
pom.xml(書き換え後)
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>7.0</version>
        <scope>provided</scope>
    </dependency>

Glassfish管理コンソールの不具合があるのでコマンドラインから操作(備忘録)

コマンドラインから全て投入する方が楽なので編集(2016/7/19)

 asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlDataSource --restype javax.sql.DataSource --property user=root:password=********:DatabaseName=study:serverName=localhost:PortNumber=3306 marathon
C:\Program Files\glassfish-4.1.1\bin>asadmin create-jdbc-resource --connectionpoolid marathon jdbc/marathon
JDBC resource jdbc/marathon created successfully.
Command create-jdbc-resource executed successfully.

文字化けの対応

発生する時としない時があり根本原因が不明だが、glassfish-web.xmlというファイルに以下の記述をすることで文字化けが解決する場合があった。

</jsp-config>
<parameter-encoding default-charset="UTF-8"/>
</glassfish-web-app>

そもそも当該ファイルが存在しない場合もあるので、その場合には、NetBeansでプロジェクトを右クリックしてGlassfishディスクリプタ作成をするのが良い。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2