Hi Sergey,
Le 05/08/2011 12:32, Sergey Beryozkin a écrit :
Hi
On Thu, Aug 4, 2011 at 10:59 AM, Philippe Merle<[email protected]> wrote:
Hi,
I am deploying a CXF-based application on Google App Engine. Have a look at
http://ow2-frascati.appspot.com/
I am using Apache CXF 2.4.1.
Its class org.apache.cxf.transport.servlet.ServletContextResourceResolver
uses two classes (javax.naming.InitialContext and
javax.naming.NamingException) which are not allowed to be used on GAE. The
use is done in the method 'resolve':
public final<T> T resolve(final String entryName, final Class<T> clz) {
Object obj = null;
try {
if (entryName != null) {
InitialContext ic = new InitialContext();
try {
obj = ic.lookup(entryName);
} finally {
ic.close();
}
}
} catch (NamingException e) {
//do nothing
}
...
When I am commenting this try/catch block then the class
ServletContextResourceResolver seems to work well on GAE.
I would like to know:
* is this try/catch block really required?
* if not, could it be removed in a future version of CXF?
* if yes, which could be the solution in order to have this behavior when
needed and removed it when using CXF on GAE?
I'm not sure when this code is used, I don't think we should have any
tests in CXF, but
it's most likely there for a reason, so I added the reflection-based
code instead - I've added
it to 2.5.0-SNAPSHOT only and will merge it to 2.4.2-SNAPSHOT - this
should be a safe change,
but would like to see if someone has any concerns, just in case
Thank you.
Another possibility is to add:
} catch (ClassNotFoundException e) {
//do nothing
}
Then this need not to use Java reflection and deal with the case of a
JRE which does not provide the InitialContext class.
A+
Philippe Merle
Cheers, Sergey
Thank you in advance and A+
Philippe Merle