M2 EJB basics

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

M2 EJB basics

nsowatsk
Hi

It may be that I too much of a newbie to Maven to be considering M2, but I
am trying anyway :-)

In the example below I have some EJB code that won't compile as it can't
find the EJB jars.

What I can't see is how to set the location of the EJB jars though. If this
were Maven 1.x I would use properties as part of the solution, but for M2 I
just don't know where to start.

I half suspect that I need to create a dependency, but to what and where and
how I don't know.

If someone wants to tell me that M2 is not ready for newbies, that's fine
and I will go look at 1.x. If someone can help me get this to work though,
then I will persevere and maybe help make M2 a better thing.

Thanks

Nathan


G:\nm_poc\ejb\jar>m2 install
[INFO] inventory-service-pom: using locally installed snapshot
[INFO]
-------------------------------------------------------------------------
---
[INFO] Building Inventory Service
[INFO]
-------------------------------------------------------------------------
---
[INFO] maven-jar-plugin: resolved to version 2.0-alpha-2 from local
repository
[INFO] maven-resources-plugin: resolved to version 2.0-alpha-2 from local
reposi
tory
[INFO] maven-compiler-plugin: resolved to version 2.0-alpha-2 from local
reposit
ory
[INFO] maven-surefire-plugin: resolved to version 2.0-alpha-2 from local
reposit
ory
[INFO] maven-install-plugin: resolved to version 2.0-alpha-2 from local
reposito
ry
[INFO] [resources:resources]
[INFO] [compiler:compile]
Compiling 17 source files to G:\nm_poc\ejb\jar\target\classes
[INFO]
-------------------------------------------------------------------------
---
[INFO] BUILD FAILURE
[INFO]
-------------------------------------------------------------------------
---
[INFO] Reason: Compilation failure
[INFO]
-------------------------------------------------------------------------
---
[INFO]
G:\nm_poc\ejb\jar\src\main\java\com\cisco\nm\poc\inventory\ejb\InventoryS
ession.java:[12,17]  package javax.ejb does not exist
G:\nm_poc\ejb\jar\src\main\java\com\cisco\nm\poc\inventory\ejb\InventorySess
ion.
java:[13,17]  package javax.ejb does not exist
...
]  package javax.ejb does not exist
G:\nm_poc\ejb\jar\src\main\java\com\cisco\nm\poc\inventory\ejb\InventorySess
ion.
java:[125,15]  InventoryQueryResponse(java.util.Collection) in
com.cisco.nm.poc.
inventory.util.InventoryQueryResponse cannot be applied to ()

[INFO]
-------------------------------------------------------------------------
---
[INFO] Total time: 6 seconds
[INFO] Finished at: Thu Jun 09 11:24:30 CEST 2005
[INFO] Final Memory: 1M/7M

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: M2 EJB basics

Nicolas Chalumeau
Hi Nathan

2005/6/9, Nathan Sowatskey (nsowatsk) <[hidden email]>:

> Hi
>
> It may be that I too much of a newbie to Maven to be considering M2, but I
> am trying anyway :-)
>
> In the example below I have some EJB code that won't compile as it can't
> find the EJB jars.
>
> What I can't see is how to set the location of the EJB jars though. If this
> were Maven 1.x I would use properties as part of the solution, but for M2 I
> just don't know where to start.
>
> I half suspect that I need to create a dependency, but to what and where and
> how I don't know.

You have the solution here : you need to add a j2ee-XX.jar dependency
in your pom for this project. But as it will not be on ibiblio you
need to download and install it in your m2 repository manually.

>
> If someone wants to tell me that M2 is not ready for newbies, that's fine
> and I will go look at 1.x. If someone can help me get this to work though,
> then I will persevere and maybe help make M2 a better thing.

We all are newbies in M2 ;-) (only the great dev team is not...)

Nicolas,

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: M2 EJB basics

nsowatsk
Thanks :-)

I have shown below what worked for me. A few questions though:

1 - I would normally (I think) wanted to have been able to refer to the file
called jboss-j2ee.jar in the $JBOSS_HOME/server/all/lib dir. Of course I can
copy and rename as I have below, but that doesn't seem right. What do other
people do here?

2 - It seems as though the relationship between a dependency and a jar is
1:1. If I wanted to just add all of the jars in a given directory, how would
I do that?

So, this is what did work for me.

In my pom.xml:

  <dependency>
      <groupId>jboss</groupId>
      <artifactId>j2ee</artifactId>
      <version>2.1</version>
    </dependency>

And, in my repository I copy the jboss-j2ee.jar to j2ee-2.1.jar and create a
pom, like this:

G:\nm_poc\ejb\jar>ls "D:\Documents and
Settings\nsowatsk\.m2\repository\jboss\j2
ee\2.1"
j2ee-2.1.jar     j2ee-2.1.pom  

G:\nm_poc\ejb\jar>more "D:\Documents and
Settings\nsowatsk\.m2\repository\jboss\
j2ee\2.1/j2ee-2.1.pom"

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>jboss</groupId>
  <artifactId>j2ee</artifactId>
  <version>2.1</version>
</project>

So now I have:

G:\nm_poc\ejb\jar>m2 install
[INFO] inventory-service-pom: using locally installed snapshot
[INFO]
------------------------------------------------------------------------
---
[INFO] Building Inventory Service
[INFO]
------------------------------------------------------------------------
---
[INFO] maven-jar-plugin: resolved to version 2.0-alpha-2 from local
repository
[INFO] maven-resources-plugin: resolved to version 2.0-alpha-2 from local
repos
tory
[INFO] maven-compiler-plugin: resolved to version 2.0-alpha-2 from local
reposi
ory
[INFO] maven-surefire-plugin: resolved to version 2.0-alpha-2 from local
reposi
ory
[INFO] maven-install-plugin: resolved to version 2.0-alpha-2 from local
reposit
ry
[INFO] [resources:resources]
[INFO] [compiler:compile]
Compiling 17 source files to G:\nm_poc\ejb\jar\target\classes
[INFO]
------------------------------------------------------------------------
---
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
---
[INFO] Reason: Compilation failure
[INFO]
------------------------------------------------------------------------
---
[INFO]
G:\nm_poc\ejb\jar\src\main\java\com\cisco\nm\poc\inventory\ejb\Inventory
ession.java:[125,15]  InventoryQueryResponse(java.util.Collection) in
com.cisco
nm.poc.inventory.util.InventoryQueryResponse cannot be applied to ()

[INFO]
------------------------------------------------------------------------
---
[INFO] Total time: 6 seconds
[INFO] Finished at: Thu Jun 09 12:05:42 CEST 2005
[INFO] Final Memory: 1M/7M
[INFO]
------------------------------------------------------------------------
---

G:\nm_poc\ejb\jar>

-----Original Message-----
From: Nicolas Chalumeau [mailto:[hidden email]]
Sent: Thursday, June 09, 2005 11:41 AM
To: Maven Users List; [hidden email]
Subject: Re: M2 EJB basics

Hi Nathan

2005/6/9, Nathan Sowatskey (nsowatsk) <[hidden email]>:

> Hi
>
> It may be that I too much of a newbie to Maven to be considering M2,
> but I am trying anyway :-)
>
> In the example below I have some EJB code that won't compile as it
> can't find the EJB jars.
>
> What I can't see is how to set the location of the EJB jars though. If
> this were Maven 1.x I would use properties as part of the solution,
> but for M2 I just don't know where to start.
>
> I half suspect that I need to create a dependency, but to what and
> where and how I don't know.

You have the solution here : you need to add a j2ee-XX.jar dependency in
your pom for this project. But as it will not be on ibiblio you need to
download and install it in your m2 repository manually.

>
> If someone wants to tell me that M2 is not ready for newbies, that's
> fine and I will go look at 1.x. If someone can help me get this to
> work though, then I will persevere and maybe help make M2 a better thing.

We all are newbies in M2 ;-) (only the great dev team is not...)

Nicolas,

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: M2 EJB basics

Brett Porter
On 6/9/05, Nathan Sowatskey (nsowatsk) <[hidden email]> wrote:
> 1 - I would normally (I think) wanted to have been able to refer to the file
> called jboss-j2ee.jar in the $JBOSS_HOME/server/all/lib dir. Of course I can
> copy and rename as I have below, but that doesn't seem right. What do other
> people do here?

You have a few options:
- install in the local repo, as you have
- use a reference implementation - j2ee from sun for compilation
- use geronimo-spec for compilation (it is available in the repo already)

> 2 - It seems as though the relationship between a dependency and a jar is
> 1:1. If I wanted to just add all of the jars in a given directory, how would
> I do that?

Create another dependency with packaging = pom, say j2ee-all, that
declared dependencies on all the others, then refer to that from your
projects.

> [INFO]
> G:\nm_poc\ejb\jar\src\main\java\com\cisco\nm\poc\inventory\ejb\Inventory
> ession.java:[125,15]  InventoryQueryResponse(java.util.Collection) in
> com.cisco
> nm.poc.inventory.util.InventoryQueryResponse cannot be applied to ()

This appears to me to be a compile error in your code.

Cheers,
Brett

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: M2 EJB basics

nsowatsk
Many thanks for the pointers. This is what worked:

  <dependency>
      <groupId>geronimo-spec</groupId>
      <artifactId>geronimo-spec-j2ee</artifactId>
      <version>1.4-rc4</version>
    </dependency>

I was not sure what to do with the point about using a reference
implementation from Sun. What changes would I make to my pom.xml for that?

Regards

Nathan

-----Original Message-----
From: Brett Porter [mailto:[hidden email]]
Sent: Thursday, June 09, 2005 12:25 PM
To: Maven Users List; [hidden email]
Cc: Nicolas Chalumeau
Subject: Re: M2 EJB basics

On 6/9/05, Nathan Sowatskey (nsowatsk) <[hidden email]> wrote:
> 1 - I would normally (I think) wanted to have been able to refer to
> the file called jboss-j2ee.jar in the $JBOSS_HOME/server/all/lib dir.
> Of course I can copy and rename as I have below, but that doesn't seem
> right. What do other people do here?

You have a few options:
- install in the local repo, as you have
- use a reference implementation - j2ee from sun for compilation
- use geronimo-spec for compilation (it is available in the repo already)

> 2 - It seems as though the relationship between a dependency and a jar
> is 1:1. If I wanted to just add all of the jars in a given directory,
> how would I do that?

Create another dependency with packaging = pom, say j2ee-all, that declared
dependencies on all the others, then refer to that from your projects.

> [INFO]
> G:\nm_poc\ejb\jar\src\main\java\com\cisco\nm\poc\inventory\ejb\Invento
> ry ession.java:[125,15]  InventoryQueryResponse(java.util.Collection)
> in com.cisco nm.poc.inventory.util.InventoryQueryResponse cannot be
> applied to ()

This appears to me to be a compile error in your code.

Cheers,
Brett

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]