views:

1678

answers:

3

I'm having problems deploying a simple WebServices app (like "Hello World" simple) to OC4J. The same code works fine under Jetty, but breaks in OC4J, and I'm wondering if anyone else has faced the same issue. I'm using Enterprise Manager to deploy the app, but the deployment fails with this message:

    [Jan 23, 2009 8:46:20 AM] Binding TestWs web-module for application TestWs to site default-web-site under context root /TestWs 
    [Jan 23, 2009 8:46:22 AM] Operation failed with error: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://cxf.apache.org/jaxws] 
Offending resource: ServletContext resource [/WEB-INF/beans.xml]

Looking at the beans.xml, the offending code seems to be the XML namespace declarations:

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:jaxws="http://cxf.apache.org/jaxws"
    xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"&gt;

    <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

    <jaxws:endpoint
     id="helloService"
     implementor="com.test.endpoint.HelloImpl"
     address="/HelloWorld" />
</beans>

The stack trace is not terribly illuminating:

    09/01/23 08:57:28 oracle.oc4j.admin.internal.DeployerException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://cxf.apache.org/jaxws]
    Offending resource: ServletContext resource [/WEB-INF/beans.xml]

    09/01/23 08:57:28   at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
    09/01/23 08:57:28   at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
    09/01/23 08:57:28   at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80)
    09/01/23 08:57:28   at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:261)
    09/01/23 08:57:28   at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1120)
...

Has anyone else run into similar problems? And if so, what's the best way to go about fixing it? My XML skills are middling, and I'm a complete noob with WebServices. But this may be an OC4J issue.

Thanks in advance for your help!

EDIT: This is not, as far as I can tell, a classpath issue, unless OC4J is odd about what jars it want to see where (as I know Tomcat can be). My WEB-INF/lib folder has the CXF jar, the Spring jars (beans, context, core, and web), xml-resolver-1.2.jar, and XmlSchema-1.4.2.jar. If I need to list everything in the WEB-INF/lib folder, I will. But again, the program works in Jetty.

Another Edit: Based on what I'm reading here, this appears to be an issue between Spring and the CXF jar -- there's a NamespaceHandler class in the CXF jar (in org.apache.cxf.frontend.spring to be precise), but there seems to be a configuration issue preventing Spring from seeing it.

Last Edit: Thank you everyone for your help. I never ended up getting CXF working in OC4J, because my client is on version 10.1.3.3.0. It's not J2EE 5 compliant, and I'm pretty sure they're not going to go for unpacking their oc4j.jar in order to change the boot.xml. But without the document Daniel pointed me to, I never would have known that.

So I switched to XFire version 1.2.6, and got my test app working after a few hiccups. Along the way I learned some interesting things about OC4J:

  • When deploying in Enterprise Manager, make sure you choose to load the local classpath first.
  • OC4J uses non-standard XML files, so make sure your app is not using any of OC4J's native XML files (in the Deployment Settings, uncheck all the currently selected imports -- that way, you can ensure that the app is using only files you provide in WEB-INF/lib)
  • If you can, use another app server. :P

Thank you all again!

+1  A: 

I would think its a CLASSPATH issue.

I'm not that familiar with OC4J, but how are you packaging/deploying your web-application?

You need to ensure that the CXF jar is in the WEB-INF/lib directory of your WAR?

Update: A little confused by your comments - if your spring config is in the META-INF directory of your EAR, then this is not the same classpath as that used by your web-app. So, in fact, sticking the CXF jar in WEB-INF/lib isn't going to work. You will either need to stick the JAR in the top-level of your EAR, or in some lib shared by all classloaders of OC4J. I suggest studying the enterprise-app/web-app classloader hierarchy documentation of OC4J to see if this can give more advice?

toolkit
That was actually my first thought, but the WEB-INF/lib has all the libraries the app needs, including the cxf jar.
rtperson
As for your second question, OC4J is kind of odd in how it deploys. It won't take a WAR unless you pack that in turn into its own EAR. The idea, as far as I can tell, is for the EAR's META-INF to hold the application XML files, which OC4J then uses to deploy the app.
rtperson
+1  A: 

Looks like a configuration issue with Spring:

Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://cxf.apache.org/jaxws]
Offending resource: ServletContext resource [/WEB-INF/beans.xml]

Do you have anything in your web.xml to read that when the app starts up? Do you see a NamespaceHandler declared for that namespace anywhere in your code?

duffymo
Duffy, thanks for your answer, but I'm a little confused as to what "that" refers to. Assuming that "that" is Spring's NamespaceHandler, what would I set in the web.xml to read it?
rtperson
+2  A: 

I hate to ask the obvious, but have you looked at all the stuff for configuring OS4J and CXF together from the CXF web site? http://cwiki.apache.org/CXF20DOC/appserverguide.html#AppServerGuide-OC4J

Daniel Kulp
I hadn't -- so thank you for asking the obvious. That document is going to be Exhibit A in my quest to get my client to switch app servers. :)
rtperson