Hi Kevin,
I would have added the lookup for NetWeaver after all other
lookups but on NetWeaver we are having the issue that the non-matching lookups
are not failing with a NameNotFoundException but with a (more general)
NamingException. This means, I’d have to change to
try {
service = (EmployeeService)
PortableRemoteObject.narrow(context.lookup("java:comp/env/ejb/EmployeeService"),
EmployeeService.class);
} catch (NamingException notFoundException) {
try {
service = (EmployeeService)
PortableRemoteObject.narrow(context.lookup("ejb/EmployeeService"),
EmployeeService.class);
} catch (NamingException notFoundException2) {
try {
// WLS likes this one.
service = (EmployeeService)
PortableRemoteObject.narrow(context.lookup("EmployeeService#org.eclipse.persistence.testing.models.jpa.sessionbean.EmployeeService"),
EmployeeService.class);
} catch (NamingException notFoundException3) {
try {
//jboss likes this one
service = (EmployeeService) PortableRemoteObject.narrow(context.lookup("EmployeeService/remote"),
EmployeeService.class);
} catch (NamingException notFoundException4) {
try {
// NetWeaver likes this one.
service = (EmployeeService)
PortableRemoteObject.narrow(context.lookup("JavaEE/servertest/REMOTE/EmployeeServiceBean/org.eclipse.persistence.testing.models.jpa.sessionbean.EmployeeService"),
EmployeeService.class);
} catch (NamingException notFoundException5) {
throw new Error("All lookups failed.", notFoundException);
}
}
}
}
}
}
NameNotFoundExcetpion
is likely more correct but catching a NamingExceptions would be OK rom my point
of view as the test is not about asserting that JNDI raises the correct
exception. Do you think catching a NamingException instead would be OK?
Thanks for pointing
me to the NativeAPITest, which I had overlooked. Actually, I think we should
factor out the getEmployeeService method. We had not yet spotted this issues as
the NativeAPITest fails earlier with some XML parsing issue. I’ll follow
up with this in another thread …
-Adrian
===
Von: eclipselink-dev-bounces@xxxxxxxxxxx
[mailto:eclipselink-dev-bounces@xxxxxxxxxxx] Im Auftrag von
Kevin Yuan
Gesendet: Mittwoch, 9. Dezember 2009 17:54
An: Dev mailing list for Eclipse Persistence Services
Cc: toplinkqa
Betreff: Re: [eclipselink-dev] bug 297332: JNDI lookupstring for
SessionBeanTests on NetWeaver
Hi Adrian,
The changes with the test code are fine, and also verified the tests on WLS.
But the minimum change should add jndi lookup for NetWeaver after JBoss and
before "All lookups failed", and don't need to move back all other
code, just like the following:
try {
service = (EmployeeService)
PortableRemoteObject.narrow(context.lookup("java:comp/env/ejb/EmployeeService"),
EmployeeService.class);
} catch
(NameNotFoundException notFoundException) {
try {
service = (EmployeeService)
PortableRemoteObject.narrow(context.lookup("ejb/EmployeeService"),
EmployeeService.class);
} catch (NameNotFoundException notFoundException2) {
try {
// WLS likes this one.
service = (EmployeeService)
PortableRemoteObject.narrow(context.lookup("EmployeeService#org.eclipse.persistence.testing.models.jpa.sessionbean.EmployeeService"),
EmployeeService.class);
} catch (NameNotFoundException notFoundException3) {
try {
//jboss likes this one
service = (EmployeeService) PortableRemoteObject.narrow(context.lookup("EmployeeService/remote"),
EmployeeService.class);
} catch (NameNotFoundException notFoundException4) {
try {
// NetWeaver likes this one.
service = (EmployeeService)
PortableRemoteObject.narrow(context.lookup("JavaEE/servertest/REMOTE/EmployeeServiceBean/org.eclipse.persistence.testing.models.jpa.sessionbean.EmployeeService"),
EmployeeService.class);
} catch (NameNotFoundException notFoundException5) {
throw new Error("All lookups failed.", notFoundException);
}
}
}
}
}
}
By the way, if you want to run nativeapitest in server-test-lrg, you also need
to make the same changes with:
trunk\jpa\eclipselink.jpa.test\src\org\eclipse\persistence\testing\tests\nativeapitest\NativeAPITests.java
Thanks,
Kevin
Goerler, Adrian wrote:
on
NetWeaver, we are having an issue with the SessionBeanTests as the JNDI lookup
string used by NetWeaver is not among the strings tried by the test:
I
am proposing a patch, which fixes the issue on NetWeaver. Please review and
give feedback.
_______________________________________________
eclipselink-dev mailing list
eclipselink-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-dev