Intellij Maven build Glassfish exploded ear deployment and war/ejb folder naming

Hello,

I am having an annoying issue with the deployment of my ear web application into glassfish with IDEA.  I have a Maven project that builds a ear out of a war and ejb.  Things are working very well and I am happy with the setup except for one issue.  When I refresh/reimport the maven project it names the exploded version of the ear as follows:

ear/
     blah.war/ <-- folder
     blah.jar/ <--- folder

The exploded directories are named with the .war and .jar extensions of the compressed counterparts.  This throws a wrench at Glassfish, which in turn gives me the following exception during startup:

java.io.FileNotFoundException: <omitted>\ear\target\ear\blah.jar (Access is denied)
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:114)
    at java.util.jar.JarFile.<init>(JarFile.java:133)
    at java.util.jar.JarFile.<init>(JarFile.java:97)
    at org.apache.catalina.startup.TldConfig.tldScanJar(TldConfig.java:604)
    at org.apache.catalina.startup.TldConfig.execute(TldConfig.java:464)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:5247)
    at com.sun.enterprise.web.WebModule.start(WebModule.java:353)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:989)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:973)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:704)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1627)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1232)

So, it looks like Glassfish thinks the exploded blah.jar directories is a compressed .jar files.  I can then rename the exploded directories to 'blahWar' and 'blahEjb' and redeploy (without refreshing Maven inbetween) in the artifacts settings under project structure, fix the ear's application.xml and Glassfish starts up my application properly.

Is there a way to set the war/jar explosion to not use the original compressed artifact's full name?  Maybe replacing the '.war' with an '_war' .  Is this a bug that can or is being resolved with Intellij IDEA?

Thanks for your response.

1 comment
Comment actions Permalink

Hi John,

if MAVEN do the build, use the <unpackTypes> tag of the Maven EAR plugin in the POM.

<build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ear-plugin</artifactId>
        <version>2.4.2</version>
        <configuration>
          <unpackTypes>rar,war,ejb</unpackTypes>
          [...]
        </configuration>
      </plugin>
    </plugins>
  </build>

Further on, the <bundleFileName> tag should be renamed from foo.bar to foo_bar.

If IntelliJ do the build and deployment, look at the project stettings -> Artifacts -> ear exploded,
check the "show content of elements" checkbox at the bottom and rename the war and ejb folders from foo.bar -> foo_bar.

regards,
florian
0

Please sign in to leave a comment.