• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

I'm trying to understand this darkest EJB

 
Greenhorn
Posts: 11
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all, I'm trying to learn EJB technology. I have made a simple project to test the stateless EJB3 following some tutorial.
Using Jboss eap 6.2 as server, and Maven to create a project that is my EJB, under this project i created a module "myweb" that is the client which shows, using a servlet, the EJB datas.

The entire projects is here: https://github.com/AndreaCatania/ejb2

During the deployment i receive this:


The full stack is that:


What's wrong?
If you need more infos, please let me know.
Thanks for your time in advance
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Andrea,
This looks backwards to me. A web project (war) should contain an ejb project. You have the other way around. It looks like your ejb jar contains the war.

Also, I gave you a cow for the excellent question formation. It had the stack trace and all the code (github) to understand what is going on.
 
Andrea Catania
Greenhorn
Posts: 11
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Very very thanks for the feedback and your response.
Now I have created another project using your advices; Now the WAR file contains the EJB that's called "myejbs".

The entire projects is here: https://github.com/AndreaCatania/ejbtest

The problem remain, i know the cause but i don't know how to resolve it.
The interface "NamerRemote" used into the servlet Test.java is not found when the class is compiled becouse it's into the "myejb" module (here).
I remind you that I get this error during deployment, I deploy for first the "myejb" module than the WAR file.

I miss something to understand...

The new stack trace
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've added this to our Maven forum since I think you are having build problems (and not just EJB problems.)

Does the Maven project in github build for you? The POM references two modules:


Only the second is in github. And the parent pom is of packaging type pom. I'm trying to find two things in your project:
1) The pom.xml that generates an ejb
2) The pom.xml that generates a war

Knowing where these live will confirm you have something consistent. Also, why are you deploying the ejb separately than the war? At least when beginning, it is good to use a local ejb call. In which case the EJB project is a dependency for the WAR project and not something that gets deployed separately.
 
Andrea Catania
Greenhorn
Posts: 11
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:I've added this to our Maven forum since I think you are having build problems (and not just EJB problems.)

Does the Maven project in github build for you? The POM references two modules:


Only the second is in github. And the parent pom is of packaging type pom. I'm trying to find two things in your project:
1) The pom.xml that generates an ejb
2) The pom.xml that generates a war

Knowing where these live will confirm you have something consistent. Also, why are you deploying the ejb separately than the war? At least when beginning, it is good to use a local ejb call. In which case the EJB project is a dependency for the WAR project and not something that gets deployed separately.



I explain what I have to do, let me know if I miss something.
I have to build a projects that look like this:


I will have 3 pom, 1 for the "MyProject" that contains the reference to modules WEB and CORE
The WEB module has a pom that generate a WAR, and CORE module has a pom that generate a EJB.

When I have to choose what I have to deploy into the server I have to select only "MyProject" because his POM will generate automatically the module (WEB, CORE).

If All it's right, which artifact should I use during the creation of "MyProject"?
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm out of date on the nuances of EJBs (except for the JPA parts), but shouldn't that be bundled in an EAR?
 
Andrea Catania
Greenhorn
Posts: 11
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ohhh,Thanks to you all now working ( new repository: https://github.com/AndreaCatania/EjbTest)

But last thing.. To avoid the exception of "java.lang.NoClassDefFoundError" I added the dependecy on the pom of MyWeb module like written below.

The pom of MyWeb: https://github.com/AndreaCatania/EjbTest/blob/master/MyWeb/pom.xml


But I notice that there are two equal EJB running on the server, one for "MyWeb" and the other for "MyEjbs". I think it's absolutly wrong!
What is the correct way?


I have deployed both the EAR, WAR, EJB; and not only the EAR because when I deploy only the EAR the other modules are not deployed.
Thanks a lot for the support.
 
Andrea Catania
Greenhorn
Posts: 11
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After some research I found that if i set into the POM the dependency like written below, maven get only the interfaces.

So I made a simple test.

I added new WAR module called "MyWeb2" that have a servlet that modify (using EJB) the text of a static variable; when I try to take the text of this varible using EJB from the module "MyWeb" I get the initial text servlet...

So i'm sure that there are more than 1 context from this static varible...
reply
    Bookmark Topic Watch Topic
  • New Topic