Avatar billede fredand Forsker
06. marts 2009 - 21:35 Der er 3 kommentarer og
1 løsning

Do I have to use this Context factory?

Hello!

I'm playing around with a small project at home.
I got one ejb-server running in a WlS 10.3.
And a client in a standalone app.

The client is suppose to connect to the server like this with RMI/JNDI:

            Hashtable h = new Hashtable();
            h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
            h.put(Context.PROVIDER_URL, "t3://192.168.1.35:8003");
            InitialContext initialContext = new InitialContext(h);

            Object object = initialContext.lookup("my_domain/ejb/client/ORMManagerEJBHome");


            ORMManagerEJBHome ormManagerEJBHome = (ORMManagerEJBHome)PortableRemoteObject.narrow(object, ORMManagerEJBHome.class);
            ORMManagerEJBObject ormManagerEJBObject = ormManagerEJBHome.create();

But when I run this I got a lot of NoClassDefFoundError, so I had been adding alot of jars to my maven repo and I'm not done yet.

So my question now is if I must use the class "weblogic.jndi.WLInitialContextFactory" just because I use weblogic?
Or is there an generic class I can use hopefully provided from sun?

Best regards
Fredrik
Avatar billede arne_v Ekspert
06. marts 2009 - 22:28 #1
You need to use a class that knows how to talk to your app server.
Avatar billede fredand Forsker
07. marts 2009 - 13:52 #2
Hello Arne!

Thanks for clearing that out!

That was what I was afraid of.

Please give a svar so I can reward you.

By the way, does this then sound like I'm on the right track:
Since I think that I'm bound to use weblogic.jndi.WLInitialContextFactory. It looks like I have to also add alot of other classes scattered among several other jars from Bea (hopefully available inside the WLS 10 dist).
Does it sound correct that I have to assemble all this jars inside my standalone java app?

It looks like the jar is getting very big.

Do you think of any better solution to tackle this problem?

Best regards
Fredrik
Avatar billede arne_v Ekspert
09. marts 2009 - 17:14 #3
You can add a Class-Path directive to the manifest of your jar file that refers to the other jars.

BTW, JBoss has both a lot of small jars and a single big jar that has everything the clients need.

Svar.
Avatar billede fredand Forsker
10. marts 2009 - 07:23 #4
Ok
Thanks alot!
(Really good to know sincemy next step will be to use JBoss also)
I will try to find out if Bea WLS is provided with anything like that.

Best regards
Fredrik
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