Deploy assembly to glassfish

View: New views
5 Messages — Rating Filter:   Alert me  

Deploy assembly to glassfish

by Marcin Kwapisz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
Is it possible to deploy jar (ejb) created by assembly plugin to glassfish server?
Now, when I choose "Run project", maven tries to deploy jar package without dependencies (and of course fails). The only one solution is to deploy assembled jar package manually.

My assembly plugin configuration is as follows:
<plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2-beta-2</version>
                <executions>
                    <execution>
                        <id>create-ejb-module</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <archiverConfig>
                                <duplicateBehavior>fail</duplicateBehavior>
                            </archiverConfig>
                            <descriptors>
                                <descriptor>src/main/assembly/ejbModule.xml</descriptor>
                            </descriptors>
                            <archive>
                            </archive>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Thanks in advance
Regards
--
Marcin Kwapisz
Division of Computer Networks
Technical Univeristy of Lodz, Poland



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Deploy assembly to glassfish

by Wouter van Reeven :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

On Mon, Dec 08, 2008 at 11:58:08AM +0100, Marcin Kwapisz wrote:
> Is it possible to deploy jar (ejb) created by assembly plugin to glassfish server?
> Now, when I choose "Run project", maven tries to deploy jar package without dependencies (and of course fails). The only one solution is to deploy assembled jar package manually.

One option may be to use the Maven GlassFish plugin, see

https://maven-glassfish-plugin.dev.java.net/


HTH, Wouter van Reeven

--

People: "If she weighs the same as a Duck, she's made of wood!"
Sir Bedevere: "And therefore...?"

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



RE: Deploy assembly to glassfish

by Marcin Kwapisz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> One option may be to use the Maven GlassFish plugin, see
>
> https://maven-glassfish-plugin.dev.java.net/

[Marcin Kwapisz]
Yes, I think it could be the solution. I will check that plugin. Thanks.

Maven support was integrated into NB6.5. I think it should be possible to choose what artifact is deployed to glassfish from IDE.
Below is log from my NB. PersonAccountModule-1.0-SNAPSHOT.jar is chosen by default. This is wrong jar, due to missing configuration which is added during assembly process.

NetBeans: Deploying on GlassFish V2
    debug mode: false
    force redeploy: true
Checking for missing drivers
Start registering the project's server resources
Finished registering server resources
Distributing D:\JavaProg\MySamples\EJB\Samplev7\JEEMavenProject2\PersonAccountModule\target\PersonAccountModule-1.0-SNAPSHOT.jar to [localhost:4848_server]
Start registering the project's server resources
Finished registering server resources
deployment started : 0%
Deploying application in domain failed; Error loading deployment descriptors for module [PersonAccountModule-1.0-SNAPSHOT] -- Invalid ejb jar [D:\AppServer\glassfish-v2ur2\domains\domain1\applications\j2ee-modules\PersonAccountModule-1.0-SNAPSHOT]: it contains zero ejb.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Deploy assembly to glassfish

by Bugzilla from mkleint@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

a sample project demonstrating the setup, files as issue in netbeans
issue tracking system
(http://www.netbeans.org/issues/enter_bug.cgi?component=maven)
would help.

Milos

On Mon, Dec 8, 2008 at 2:35 PM, Marcin Kwapisz <mkwapisz@...> wrote:

>> One option may be to use the Maven GlassFish plugin, see
>>
>> https://maven-glassfish-plugin.dev.java.net/
>
> [Marcin Kwapisz]
> Yes, I think it could be the solution. I will check that plugin. Thanks.
>
> Maven support was integrated into NB6.5. I think it should be possible to choose what artifact is deployed to glassfish from IDE.
> Below is log from my NB. PersonAccountModule-1.0-SNAPSHOT.jar is chosen by default. This is wrong jar, due to missing configuration which is added during assembly process.
>
> NetBeans: Deploying on GlassFish V2
>    debug mode: false
>    force redeploy: true
> Checking for missing drivers
> Start registering the project's server resources
> Finished registering server resources
> Distributing D:\JavaProg\MySamples\EJB\Samplev7\JEEMavenProject2\PersonAccountModule\target\PersonAccountModule-1.0-SNAPSHOT.jar to [localhost:4848_server]
> Start registering the project's server resources
> Finished registering server resources
> deployment started : 0%
> Deploying application in domain failed; Error loading deployment descriptors for module [PersonAccountModule-1.0-SNAPSHOT] -- Invalid ejb jar [D:\AppServer\glassfish-v2ur2\domains\domain1\applications\j2ee-modules\PersonAccountModule-1.0-SNAPSHOT]: it contains zero ejb.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



RE: Deploy assembly to glassfish

by Marcin Kwapisz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> a sample project demonstrating the setup, files as issue in netbeans
> issue tracking system
> (http://www.netbeans.org/issues/enter_bug.cgi?component=maven)
> would help.
[Marcin Kwapisz]
I will try to describe the problem and a workaround here.

1. ejb-plugin configuration

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ejb-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                        </manifest>
                    </archive>
                    <generateClient>true</generateClient>
                    <clientIncludes>
                        <clientInclude>pl/zsk/sos/ejb/endpoint/*Remote.class</clientInclude>
                    </clientIncludes>
                    <ejbVersion>3.0</ejbVersion>
                </configuration>
            </plugin>

2. Assembly plugin configuration
<plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>2.2-beta-2</version>
                        <executions>
                            <execution>
                                <id>create-ejb-module</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <archiverConfig>
                                        <duplicateBehavior>fail</duplicateBehavior>
                                    </archiverConfig>
                                    <descriptors>
                                        <descriptor>src/main/assembly/ejbModule.xml</descriptor>
                                    </descriptors>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

The ejb-plugin creates two jars:
PersonAccountModule-1.0-SNAPSHOT.jar
PersonAccountModule-1.0-SNAPSHOT-client.jar

The assembly-plugin creates third jar:
PersonAccountModule-1.0-SNAPSHOT-ejb-with-dependencies.jar
The name of this jar is ${project.build.finalName}-assembly_id.jar, where assembly_id is assembly id in ejbModule.xml descriptor (ejb-with-dependencies, see below)

3. Assembly descriptor (ejbModule.xml)

<?xml version="1.0" encoding="UTF-8"?>
<assembly>
    <id>ejb-with-dependencies</id>
    <formats>
        <format>jar</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <dependencySets>
        <dependencySet>
            <outputDirectory></outputDirectory>
            <outputFileNameMapping></outputFileNameMapping>
            <useProjectArtifact>false</useProjectArtifact>
            <unpack>true</unpack>
            <unpackOptions>
                <excludes>
                    <exclude>**/META-INF/*.xml</exclude>
                </excludes>
            </unpackOptions>
            <scope>runtime</scope>
            <useTransitiveDependencies>false</useTransitiveDependencies>
        </dependencySet>
    </dependencySets>
    <fileSets>
        <fileSet>
            <directory>target/classes</directory>
            <outputDirectory></outputDirectory>
        </fileSet>
    </fileSets>
</assembly>

In that situation NB65 tries to deploy on Glassfish PersonAccountModule-1.0-SNAPSHOT.jar, what is wrong.
The workaround is very simple -> assembly_id in assembly descriptor should be empty
...
<assembly>
    <id></id>
    <formats>...

PersonAccountModule-1.0-SNAPSHOT.jar created by the ejb-plugin is overwritten by a jar created by the assembly-plugin now, so the correct one is deployed on Glassfish.

I do not know if it is correct to have empty id in assembly descriptor, but it works.

Regards
--
Marcin Kwapisz
Division of Computer Networks
Technical Univeristy of Lodz, Poland


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email