[jbossws-cxf-users] [JBoss Web Services CXF] - Re: javax.inject.DefinitionException: import not a Java type

jpramondon do-not-reply at jboss.com
Sun Nov 15 14:15:56 EST 2009


Hi there,

I see you've found a solution to this by using stack, but you could also solve this issue by keeping Apache CXF core configuration.
I came across the same issue today and found a simple solution. Here's the long story shorted.
I'm used to develop a service with Tomcat as a simple runner first. So I started creating my service following Apache CXF's "how-to" pages, ending up with : 
- a file named /WEB-INF/beans.xml describing my endpoint and my Spring application context.
- a web.xml file referencing this Spring context configuration file this way : 

  | <context-param>
  | 	<param-name>contextConfigLocation</param-name>
  | 	<param-value>WEB-INF/alpha-beans.xml</param-value>
  | </context-param>
  | 

It worked well with Tomcat, but when deployed to JBoss, the XML parsing fails with the stack you showed us in a previous post, something like : 

Caused by: javax.inject.DefinitionException: import not a Java type

So I started looking for the 'import' word in my xml files and guess what I found very quickly. There are some imports done in the context configuration file to reference CXF xml files located in the jars. If you followed Apache CXF "how-to" section you're more than likely to have them in your "beans.xml" file. You should see something like this : 


  | <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" />
  | 

So I commented these just to see what it would change in Jboss' behaviour. It did and it was now crashing on the word 'bean'. (which at the moment was the first uncommented tag of the "beans.xml" file).

Caused by: javax.inject.DefinitionException: bean not a Java type

>From that I understood I could not use the reserved name "beans.xml" in my war and renamed this file to "alpha-beans.xml". I also changed the reference to this file in the web.xml like this :


  | <context-param>
  | 	<param-name>contextConfigLocation</param-name>
  | 	<param-value>WEB-INF/alpha-beans.xml</param-value>
  | </context-param>
  | 

and it did the trick perfectly.

Cheers,

Jerome

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4265754#4265754

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4265754


More information about the jbossws-cxf-users mailing list