Avatar billede fredand Forsker
16. marts 2006 - 11:12 Der er 5 kommentarer og
1 løsning

What is the correct dir-structure for a ejbapp?

Hello!

I got one webapp and a ejbapp. (The full scenario is that the webapp puts jmsmessages on a queue, the ejbapp resides outside the webapp and is a subscriber on that queue (ejbapp=a message driven bean)).

How ever our ejbapp imports a specific package, but during runtime I get a NoClassDefFoundError saying that classes in that package we import is not found by the ejbapp. My guess is that we have not a correct file structute.

So now is my question:
How should the filestructure look like for a ejb-app so it will find *.jars to import?

Our file structure looks like:
project (application.xml)
project\classes (All our *.class)
project\classes\META-INF (ejb-jar.xml, weblogic-ejb-jar.xml)
project\dist (a jar consists of all *.class and META_INF)
project\lib (All our *jar)



I'm not sure that the dist-dir must exist but I'm not sure??

We are using Weblogic 8.13, but I do not think that matters.

Hope this is all info you need to give me a hint!!

Perhaps this is a clue, in weblogic, the path to the deployed ejbapp looks like:
(Path: D:\Fredrik\project\classes
The location of the EJB JAR file or exploded JAR directory.)

This perhaps looks like that the lib-dir is invisible???

But how should it look like?? 


Best regarads
Fredrik
Avatar billede arne_v Ekspert
16. marts 2006 - 13:11 #1
web apps (a war) has:
  *.jsp
  WEB-INF/web.xml
  WEB-INF/lib/utility.jar
  WEB-INF/lib/min-ejb.jar
  WEB-INF/classes/minpakke/MinServlet.class
where all code can use everything in WEB-INF/lib and WEB-INF/classes (including
EJB jars !)

EJB jars are different

minpakke/MinKlasse.class

it does not have anything similar for utility.jar

you can use a good old fashioned Class-Path directive in the manifest

you can put the utility.jar in a place where it will be in CLASSPATH

you can use a classloader model where it can be taken from another app
Avatar billede fredand Forsker
16. marts 2006 - 13:31 #2
Hello!

Thanks for your reply!

Could you describe the classloader model a bit, I'm not familiar to it at all?

Best regards
Fredrik
Avatar billede arne_v Ekspert
16. marts 2006 - 14:06 #3
most app server can be configued in two ways:

1)  one classloader for each app => apps can not see each others classes

2)  one classloader shared by all app => apps can see each others classes

The specific implementation depends on the app server.

#1 is the smartes because it isolates apps and makes hot redeploy possible.

#2 is sometimes practical though for classpath reasons
Avatar billede arne_v Ekspert
16. marts 2006 - 14:06 #4
smartesr
Avatar billede fredand Forsker
22. marts 2006 - 08:02 #5
Hello!
Thanks for your reply we solved it like your no. 1 with 2 different servers inside weblogic! I guess this means we now got one classloader for each app, correct me if I am wrong.

Please give a svar!

Best regards
Fredrik
Avatar billede arne_v Ekspert
22. marts 2006 - 13:20 #6
that is correct

answer
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester