users@glassfish.java.net

Re: Issue with maven-embedded-glassfish-plugin version 3.1(3.1.1)

From: Bhavanishankar <bhavanishankara.sapaliga_at_oracle.com>
Date: Mon, 20 Feb 2012 22:43:04 +0530

Hi Vasile,

"\" characters getting replaced on Windows seems to be bug. Please file
a bug for it in issuetracker^[1]

Since "glassfish.embedded.tmpdir" system property is the way of
specifying where the temp. domain dir should get created, what you are
seeing is the right behaviour.

For the second application deployment, you should ideally file an
enhancement request in issuetracker^[1] . But as a workaround, you can
use admin goal^[2] of the plugin. For you reference, I have attached
pom.xml snippet which can do this.

Thanks,

Bhavani

[1] http://java.net/jira/browse/GLASSFISH
[2] http://embedded-glassfish.java.net/nonav/plugindocs/3.1/admin-mojo.html


On 02/20/2012 10:02 PM, Mirea Vasile wrote:
>
>
> Hi Bhavani,
>
> Thank you very much for the answer.
> Unfortunately is not working properly.
> The path ${project.build.directory}/glassfish is replaced with :
>
> T:\workspace2\slave-server-webui\target/glassfish
>
> Unfortunately the plugin replace all "\" and the path remains like:
> Set system property [glassfish.embedded.tmpdir =
> T:workspace2slave-server-webui
> arget/glassfish]
>
> Maybe you can correct this bug(my build runs on windows 7).
>
> I found a workaround in my case:
> I use target/glassfish and then the plugin use this path additional to
> the app path and then the plugin deploy glassfish under:
> T:\workspace2\slave-server-webui\target\glassfish\
> Then the glassfish directory will be:
>
>
> T:\workspace2\slave-server-webui\target\glassfish\gfembed8580213734252944528tmp
>
>
> Now my question is why this tmp directory is additionally generated ?
> My problem is I want to copy another application in the autodeploy
> directory of embedded glassfish.
> My integration tests for my application slave-server-webui are using
> another application ( a web service)
> I need to copy in the pre-integration pfase this additional web
> service application in the embedded glassfish otherwise my application
> slave-server-webui and his integration tests won't work.
>
> Maybe you can suggest me a better solution for my case.
> I describe my problem here :
>
> http://stackoverflow.com/questions/9280413/maven-embedded-glassfish-plugin-deploying-2-applications
>
> Unfortunattly I got no answer to my question, so my only idea was to
> copy in the autodeploy directory on the embedded glassfish my second
> application(the web service).
> Thanks for helping with using embeded glassfish plugin for maven.
>
> Regards,
> Vasile
> ------------------------------------------------------------------------
> *Von:* Bhavanishankar <bhavanishankara.sapaliga_at_oracle.com>
> *An:* Mirea Vasile <mirea_vasile_at_yahoo.com>
> *Cc:* "users_at_glassfish.java.net" <users_at_glassfish.java.net>;
> "users_at_embedded-glassfish.java.net" <users_at_embedded-glassfish.java.net>
> *Gesendet:* 7:25 Montag, 20.Februar 2012
> *Betreff:* Re: Issue with maven-embedded-glassfish-plugin version
> 3.1(3.1.1)
>
> Hi,
>
> With 3.1 (onwards) you should set the instanceRoot iff you have
> pre-created domain directory.
>
> Otherwise, if you intend to make the embedded GlassFish use a
> different temp. directory for its tiny instance root creation, then
> you should set this in embedded plugin configuration:
>
> <configuration>
> ...
>
> <systemProperties>
>
> <property>glassfish.embedded.tmpdir=${project.build.directory}/glassfish</property>
>
> </systemProperties>
>
> ...
> </configuration>
>
> HTH,
>
> Bhavani
>
> On 02/15/2012 04:04 PM, Mirea Vasile wrote:
>>
>>
>> Hi,
>>
>> I have the following issue:
>>
>> I am using the maven-embedded-glassfish-plugin .
>> I am having the following configuration in maven for it:
>>
>> <plugin>
>> <groupId>org.glassfish</groupId>
>> <artifactId>maven-embedded-glassfish-plugin</artifactId>
>> <version>3.0</version>
>>
>> <configuration>
>> <goalPrefix>embedded-glassfish</goalPrefix>
>> <serverID>localhost</serverID>
>> <name>${build.finalName}</name>
>> <app>${project.build.directory}/${build.finalName}.war</app>
>> <port>8080</port>
>>
>> <instanceRoot>${project.build.directory}/glassfish</instanceRoot>
>>
>> <autoDelete>true</autoDelete>
>>
>> </configuration>
>>
>> <executions>
>> <execution>
>> <id>start-glassfish</id>
>> <phase>pre-integration-test</phase>
>> <goals>
>> <goal>start</goal>
>> </goals>
>> </execution>
>> <execution>
>> <id>glassfish-deploy</id>
>> <phase>pre-integration-test</phase>
>> <goals>
>> <goal>deploy</goal>
>> </goals>
>> </execution>
>> <execution>
>> <id>glassfish-undeploy</id>
>> <phase>post-integration-test</phase>
>> <goals>
>> <goal>undeploy</goal>
>> </goals>
>> </execution>
>> <execution>
>> <id>stop-glassfish</id>
>> <phase>post-integration-test</phase>
>> <goals>
>> <goal>stop</goal>
>> </goals>
>> </execution>
>> </executions>
>> </plugin>
>>
>> This configuration works just fine in the version 3.0.
>> Important is the option: <instanceRoot>
>>
>> In the Version 3.1 I am getting a strange error:
>> 15.02.2012 11:30:48
>> com.sun.enterprise.v3.server.DomainXmlPersistence getPidFile
>>
>> ERROR: Cannot obtain lockfile location T:\workspace2\web-app\
>> target\glassfish\config\lockfile, configuration changes will not be
>> persisted
>> java.io.IOException: The System cannot find the specied path.
>> at java.io.WinNTFileSystem.createFileExclusively(Native Method)
>> at java.io.File.createNewFile(File.java:883)
>> at
>> com.sun.enterprise.v3.server.DomainXmlPersistence.getPidFile(DomainXm
>> lPersistence.java:92)
>> at
>> com.sun.enterprise.v3.server.DomainXmlPersistence.accessRead(DomainXm
>> lPersistence.java:114)
>> at
>> org.glassfish.config.support.DomainXml.parseDomainXml(DomainXml.java:
>> 210)
>> ...
>>
>> In the version 3.0 the directory structure will be created by the
>> plugin, in the version 3.1 not any more and then I get this errors.
>> Something change in the new version or it is a bug ?
>>
>>
>> Thanks,
>> Vasile.
>>
>
>