サンプルアプリケーションの作成

AndroMDA 入門ガイド の 「3 AndroMDAを用いた開発」を参考にしながら

環境は

MagicDraw Personal 12.5
JBOSS 4.0.2
JDK 6
maven 2.0.7

こんなところだろうか。

Hello World アプリケーション

を作成してみることにした。
3.1.4 ビルド&デプロイまですすんで進んだが、以下エラーがでてハマル。

C:\androMDA\hello_world>mvn install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] An invalid artifact was detected.

This artifact might be in your project's POM, or it might have been included tra
nsitively during the resolution process. Here is the information we do have for
this artifact:

    o GroupID:     helloworld.sample
    o ArtifactID:  hello_world-common
    o Version:     <<< MISSING >>>
    o Type:        jar

[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.artifact.InvalidArtifactRTException: For artifact {helloworld.s
ample:hello_world-common:null:jar}: The version cannot be empty.
        at org.apache.maven.artifact.DefaultArtifact.validateIdentity(DefaultArt
ifact.java:147)
        at org.apache.maven.artifact.DefaultArtifact.<init>(DefaultArtifact.java
:122)
        at org.apache.maven.artifact.factory.DefaultArtifactFactory.createArtifa
ct(DefaultArtifactFactory.java:158)
        at org.apache.maven.artifact.factory.DefaultArtifactFactory.createDepend
encyArtifact(DefaultArtifactFactory.java:58)
        at org.apache.maven.project.DefaultMavenProjectBuilder.createManagedVers
ionMap(DefaultMavenProjectBuilder.java:424)
        at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(Def
aultMavenProjectBuilder.java:850)
        at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFi
leInternal(DefaultMavenProjectBuilder.java:479)
        at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMave
nProjectBuilder.java:200)
        at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:553)
        at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:467)
        at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:527)
        at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:364)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:290)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Fri Sep 14 00:11:55 JST 2007
[INFO] Final Memory: 1M/4M
[INFO] ------------------------------------------------------------------------

WEBで検索していると、maven2.0.5を使わないと出るエラーらしい。。。

http://galaxy.andromda.org/forum/viewtopic.php?p=21487&highlight=#21487

自分はいまmaven2.0.7を使用しているので、2.0.5をインストールしてみる。
圧縮ファイルを解凍して環境変数とPATHの位置を変えるだけ。

しかしまたエラーがでた。。。

Downloading: http://team.andromda.org/maven2/javax/transaction/jta/1.0.1B/jta-1.
0.1B.jar
[WARNING] Unable to get resource 'javax.transaction:jta:jar:1.0.1B' from reposit
ory andromda (http://team.andromda.org/maven2)
Downloading: http://repo1.maven.org/maven2/javax/transaction/jta/1.0.1B/jta-1.0.
1B.jar
[WARNING] Unable to get resource 'javax.transaction:jta:jar:1.0.1B' from reposit
ory central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error creating eclipse configuration

Embedded error: Missing:
----------
1) javax.transaction:jta:jar:1.0.1B

  Try downloading the file manually from:
      http://java.sun.com/products/jta

  Then, install it using the command:
      mvn install:install-file -DgroupId=javax.transaction -DartifactId=jta \
          -Dversion=1.0.1B -Dpackaging=jar -Dfile=/path/to/file

  Path to dependency:
        1) helloworld.sample:hello_world:pom:1.0
        2) org.hibernate:hibernate:jar:3.1.3
        3) javax.transaction:jta:jar:1.0.1B

----------
1 required artifact is missing.

for artifact:
  helloworld.sample:hello_world:pom:1.0

from the specified remote repositories:
  central (http://repo1.maven.org/maven2),
  andromda (http://team.andromda.org/maven2)

[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20 seconds
[INFO] Finished at: Fri Sep 14 00:51:19 JST 2007
[INFO] Final Memory: 27M/55M
[INFO] ------------------------------------------------------------------------

# ライセンス上の問題から*1 Maven レポジトリに登録されていないので、自分で jar ファイルを作って、ローカルのレポジトリに登録する必要があるみたいだ
# http://java.sun.com/products/jta/ から、jta-1_0_1B-classes.zip をダウンロード。

1. □ jta-1_0_1B-classes.zip 8.61 KB をチェック
2. ○ Accept License Agreement を選択
3.    Download selected with Sun Download Manager    を押す

  • JTAのアーカイブ化
unzip jta-1_0_1B-classes.zip
jar -cvf jta-1.0.1B.jar javax
  • JTAの登録
mvn install:install-file -DgroupId=javax.transaction -DartifactId=jta
-Dversion=1.0.1B -Dpackaging=jar -Dfile=jta-1.0.1B.jar

そして再度hello_worldのルートディレクトリに移動し、 mvn install に try !!!!!!!!!

[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 minutes 9 seconds
[INFO] Finished at: Fri Sep 14 01:21:14 JST 2007
[INFO] Final Memory: 36M/63M
[INFO] ------------------------------------------------------------------------

おし!やっと成功!

ドキュメントに従いながらソースを修正した後、

mvn install 
mvn -f app/pom.xml -Ddeploy 

そしてJBOSS起動し、ブラウザでアクセス・・・・・だがまたエラー(涙

01:32:23,484 INFO  [MyfacesConfig] No context init parameter 'org.apache.myfaces
.CHECK_EXTENSIONS_FILTER' found, using default value true
01:32:23,484 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet
 threw exception
javax.faces.FacesException: java.lang.NullPointerException
        at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatc
h(ServletExternalContextImpl.java:439)
        at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspV
iewHandlerImpl.java:234)
        at oracle.adfinternal.view.faces.application.ViewHandlerImpl.renderView(
ViewHandlerImpl.java:159)
        at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:
384)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:173)
        at helloworld.sample.HelloWorldPopulator.doFilter(HelloWorldPopulator.ja
va:47)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:202)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:173)
        at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(Extensions
Filter.java:144)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:202)
          :
          :