Re: AW: G1.1 to G2.0-M6 migration: JNDI problems

2007-07-17 Thread Xh
Hi All!

I'm making some progress with migrating from G1.1 to G2.0, 
It was a hell easier to migrate from JBoss to WebSphere Application Server 
Community Edition (based on G1.1) than to migrate from 1.1 to 2.0 ;( 

I've changed the @Stateful to @Stateless and now I can see my bean in:
http://localhost:8080/console/portal/DebugViews/DebugViews_JNDIViewer

but few things still don't work, like accessing remote interface through JNDI

as a continuation of previous reply:

-
- you 
deployed a EJB 3.0 application in an xxx-ejb.jar
-

I deployed my EJB 3.0 application as an *.ear, but the extension is not 
important at all

-
- you 
configured an openejb-jar.xml deployment plan where you set an artifactId for 
your app, let's say "MyApp"
-

just as said here:
http://cwiki.apache.org/GMOxDOC20/using-some-of-ejb-30-functionalities.html

"By annotating this class as a @Stateless session there is no need for a 
deployment descriptor to describe it separately."

my EJB module does not  have any ejb-jar.xml or openejb-jar.xml

-
- you 
have build a remote interface for your session bean (EJB 3.0 means a simple 
interface), let's say "MySessionRemote"

then the following is the right jndi name to get a 
connection to your bean

"MyApp/MySessionBean/my.package.MySessionRemote"
-

I have built @Local and @Remote interfaces

I don't have openejb-jar.xml file with artefactId elements, thus I use the 
artifactId from geronimo-application.xml


I'm trying to fetch the remote interface with this code:
Context c = new InitialContext(p);
// don't have to redeploy it each time I want test new JNDI name
// it is extracted from URL parameter s
if (request.getParameterMap().get("s") != null) {
s = ((String[])request.getParameterMap().get("s"))[0];
}
Object o = c.lookup(s + ModuleProxyRemote.class.getName());
if (o != null) {
System.out.println(o.getClass().getName());
}

always throws an exception, NameNotFound

in the http://localhost:8080/console/portal/DebugViews/DebugViews_JNDIViewer
I can see that there is my application:
+ org.xh.jee.ejb3.samples/EJB3Test/1184674652609/ear
   - EJBModule
 - EJB3EJB.jar
- SessionBeans
  - ModuleProxyBean

local interface works without any problems, its annoted with @EJB:

@EJB
private ModuleProxyLocal proxy = null;

proxy.initialize("this is only", "a local test");
System.out.println(proxy.getInfo());

any ideas?



best regards
Lukasz











___ 
What kind of emailer are you? Find out today - get a free analysis of your 
email personality. Take the quiz at the Yahoo! Mail Championship. 
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk 

Re: AW: G1.1 to G2.0-M6 migration: JNDI problems

2007-07-16 Thread Xh
Hi!

Well to clear few things.
I have defined:

@Stateful
public class ModuleProxyBean implements ModuleProxyRemote, ModuleProxyLocal {
...
}

I can access its local interface. It works. In my servlet I wrote:

@EJB
private ModuleProxyLocal proxy = null;

protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
proxy.initialize("this is only", "a local test");
// displays "this is only a local test"
System.out.println(proxy.getInfo());
}

but I cannot access the remote interface, everything I do ends with 
javax.naming.NameNotFoundException...
for example:

Properties p = new Properties();
p.put("java.naming.factory.initial", 
"org.openejb.client.RemoteInitialContextFactory"); 
p.put("java.naming.provider.url", "127.0.0.1:4201");
//p.put("java.naming.security.principal", "system");
//p.put("java.naming.security.credentials", "manager");
try {
Context c = new InitialContext(p);
Object o = c.lookup("ProxyTest/ModuleProxyBean/" + 
ModuleProxyRemote.class.getName());
if (o != null) {
System.out.println(o.getClass().getName());
}

in addition, while browsing the:
http://localhost:8080/console/portal/DebugViews/DebugViews_JNDIViewer
I don't see any SessionBeans in my EJBModule in my EAR Application, so how come 
a local interface works?

best regards
Lukasz

- Original Message 
From: "Ueberbach, Michael" <[EMAIL PROTECTED]>
To: user@geronimo.apache.org
Sent: Monday, 16 July, 2007 3:13:57 PM
Subject: AW: G1.1 to G2.0-M6 migration: JNDI problems



 
DIV {
MARGIN:0px;}



Hi  Lukasz,

 

I don't know 
exactly your situation, please check the 
following conditions:   


- you 
deployed a EJB 3.0 application in an xxx-ejb.jar

- you 
configured an openejb-jar.xml deployment plan where you set an artifactId for 
your app, let's say "MyApp"

- you 
have a session bean you want connect to, let's say 
"MySessionBean"

- you 
have build a remote interface for your session bean (EJB 3.0 means a simple 
interface), let's say "MySessionRemote"

then the following is the right jndi name to get a 
connection to your bean

"MyApp/MySessionBean/my.package.MySessionRemote"

You have to use the fully qualified class name for 
the Interface!

I tried to define a jndi name for the session bean 
inside the deployment plan, but this doesn't work (deployment is ok but lookup 
fails).

regards

Michael





Von: Xh [mailto:[EMAIL PROTECTED] 

Gesendet: Montag, 16. Juli 2007 11:23
An: User 
Geronimo
Betreff: G1.1 to G2.0-M6 migration: JNDI 
problems






Hi All,

I'm making some progress while moving my app to 
G2.0-M6.
I have some questions about JNDI.

first I've noticed that 
when connecting to remote EJB (for tests I use 127.0.0.1:4201) 
I don't have 
to provide principals and credentials, when I provide system/manager I get 
"AuthenticationException: This principal is not authorized"

to 
successfully connect to 4201 port I need to comment out java.naming.security 
properties:

Properties p = new 
Properties();
p.put("java.naming.factory.initial", 
"org.openejb.client.RemoteInitialContextFactory"); 

p.put("java.naming.provider.url", 
"127.0.0.1:4201");
//p.put("java.naming.security.principal", 
"system");
//p.put("java.naming.security.credentials", "manager");
// now 
I can connect
Context c = new InitialContext(p);

quick question: how 
to turn security back?

i'm using EJB 2.x (G1.1) and I'm trying to connect 
to EJB through the "remote" JNDI but I get:

"java.lang.RuntimeException: 
javax.naming.NameNotFoundException: /ejb/ModuleFactory does not exist in the 
system.  Check that the app was successfully 
deployed."

well,
yes, my EAR app is successfully deployed in G2.0, no 
errors were reported during deployment...

it all worked on 
G1.1...

maybe it's because I didn't provide any principals and 
credentials?

any ideas?

best regards
Lukasz





Win a BlackBerry device from O2 with Yahoo!. Enter 
now.








___ 
New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at 
the Yahoo! Mail Championships. Plus: play games and win prizes. 
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk 

AW: G1.1 to G2.0-M6 migration: JNDI problems

2007-07-16 Thread Ueberbach, Michael
Hi  Lukasz,
 
I don't know exactly your situation, please check the following
conditions:   

- you deployed a EJB 3.0 application in an xxx-ejb.jar

- you configured an openejb-jar.xml deployment plan where you set an
artifactId for your app, let's say "MyApp"

- you have a session bean you want connect to, let's say "MySessionBean"

- you have build a remote interface for your session bean (EJB 3.0 means
a simple interface), let's say "MySessionRemote"

then the following is the right jndi name to get a connection to your
bean

"MyApp/MySessionBean/my.package.MySessionRemote"

You have to use the fully qualified class name for the Interface!

I tried to define a jndi name for the session bean inside the deployment
plan, but this doesn't work (deployment is ok but lookup fails).

regards

Michael




Von: Xh [mailto:[EMAIL PROTECTED] 
Gesendet: Montag, 16. Juli 2007 11:23
An: User Geronimo
Betreff: G1.1 to G2.0-M6 migration: JNDI problems


Hi All,

I'm making some progress while moving my app to G2.0-M6.
I have some questions about JNDI.

first I've noticed that when connecting to remote EJB (for tests I use
127.0.0.1:4201) 
I don't have to provide principals and credentials, when I provide
system/manager I get "AuthenticationException: This principal is not
authorized"

to successfully connect to 4201 port I need to comment out
java.naming.security properties:

Properties p = new Properties();
p.put("java.naming.factory.initial",
"org.openejb.client.RemoteInitialContextFactory"); 
p.put("java.naming.provider.url", "127.0.0.1:4201");
//p.put("java.naming.security.principal", "system");
//p.put("java.naming.security.credentials", "manager");
// now I can connect
Context c = new InitialContext(p);

quick question: how to turn security back?

i'm using EJB 2.x (G1.1) and I'm trying to connect to EJB through the
"remote" JNDI but I get:

"java.lang.RuntimeException: javax.naming.NameNotFoundException:
/ejb/ModuleFactory does not exist in the system.  Check that the app was
successfully deployed."

well,
yes, my EAR app is successfully deployed in G2.0, no errors were
reported during deployment...

it all worked on G1.1...

maybe it's because I didn't provide any principals and credentials?

any ideas?

best regards
Lukasz




Win a BlackBerry device from O2 with Yahoo!. Enter now
 .