13 Replies Latest reply on Nov 1, 2012 12:15 PM by raevilman D

    javax.inject.DefinitionException: import not a Java type

    Suresh Korlapati Newbie

      All,

      I am trying to deploy webservices using CXF on JBoss5.1.0. Getting the below error. It works well in JBoss4.2.2.

      Any help is highly appreciated....

      DEPLOYMENTS IN ERROR:
      Deployment "vfszip:/opt/DEPLOYMENTS/rscdevtb1.com/jboss/server/rsc/deploy/cxf-projects.ear/_WebBeansBootstrapBean" is in error due to the following reason(s): javax.inject.DefinitionException: import not a Java type

      at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:993)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:939)
      at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:873)
      at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.checkComplete(MainDeployerAdapter.java:128)
      at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:369)
      at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:255)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
      at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:280)
      at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:135)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:65)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:146)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:170)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
      at java.lang.Thread.run(Thread.java:595)

        • 1. Re: javax.inject.DefinitionException: import not a Java type
          Suresh Korlapati Newbie

          BTW, I am not using jbossws-cxf-3.2.0.GA

          my war files has all the required CXF libraries as per

          http://cwiki.apache.org/CXF20DOC/writing-a-service-with-spring.html

          • 4. Re: javax.inject.DefinitionException: import not a Java type
            Jim Ma Apprentice

            This error looks not related to jbossws-cxf . Did you try to deploy this webservice(.war) file directly under deploy directory instead of nested it in an ear file ?

            • 6. Re: javax.inject.DefinitionException: import not a Java type
              Suresh Korlapati Newbie

              I tried depoying just the war file which has the cxf webservice, get this error

              2009-10-13 09:58:33,303 INFO [HDScanner] [org.jboss.webbeans.bootstrap.WebBeansBootstrap] - Web Beans 1.0.0.PREVIEW1
              2009-10-13 09:58:33,512 ERROR [HDScanner] [org.jboss.kernel.plugins.dependency.AbstractKernelController] - Error installing to Start: name=vfszip:/opt/DEPLOYMENTS/rscdevtb1.com/jboss/server/rsc/deploy/cxf-projects.war/_WebBeansBootstrapBean state=Create
              javax.inject.DefinitionException: Could not find 'import'
              at org.jboss.webbeans.xml.ParseXmlHelper.loadElementClass(ParseXmlHelper.java:62)
              at org.jboss.webbeans.xml.XmlParser.parseForBeans(XmlParser.java:149)
              at org.jboss.webbeans.xml.XmlParser.parse(XmlParser.java:64)
              at org.jboss.webbeans.bootstrap.WebBeansBootstrap.boot(WebBeansBootstrap.java:195)
              at org.jboss.webbeans.bootstrap.api.helpers.BootstrapBean.boot(BootstrapBean.java:120)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:592)
              at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
              at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)
              at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
              at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:241)
              at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
              at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:109)
              at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:70)
              at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221)
              at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
              at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
              at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
              at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
              at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
              at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
              at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
              at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
              at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:774)
              at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
              at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:121)
              at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:51)
              at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
              at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
              at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
              at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
              at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)

              • 7. Re: javax.inject.DefinitionException: import not a Java type
                Suresh Korlapati Newbie

                first of all, i want to thank you for taking time to respond

                • 8. Re: javax.inject.DefinitionException: import not a Java type
                  Suresh Korlapati Newbie

                  when i deployed as a EAR file i initially got this error

                  2009-10-13 10:25:31,618 ERROR [main] [AbstractKernelController] - Error installing to Real: name=vfszip:/opt/DEPLOYMENTS/rscdevtb1.com/jboss/server/rsc/deploy/cxf-projects.ear/ state=PreReal mode=Manual requiredState=Real
                  org.jboss.deployers.spi.DeploymentException: Error deploying: vfszip:/opt/DEPLOYMENTS/rscdevtb1.com/jboss/server/rsc/deploy/cxf-projects.ear/
                  at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
                  at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor.deploy(BeanMetaDataFactoryVisitor.java:136)
                  at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployerWithInput.deploy(AbstractRealDeployerWithInput.java:125)
                  at org.jboss.deployers.spi.deployer.helpers.AbstractComponentDeployer.deployComponents(AbstractComponentDeployer.java:102)
                  at org.jboss.deployers.spi.deployer.helpers.AbstractComponentDeployer.internalDeploy(AbstractComponentDeployer.java:82)
                  at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
                  at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
                  at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
                  at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
                  at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
                  at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                  at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
                  at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
                  at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
                  at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
                  at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
                  at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
                  at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
                  at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
                  at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
                  at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
                  at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
                  at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:361)
                  at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                  at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
                  at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
                  at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
                  at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
                  at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
                  at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
                  at org.jboss.system.server.profileservice.repository.AbstractProfileService.activateProfile(AbstractProfileService.java:306)
                  at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:271)
                  at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
                  at org.jboss.Main.boot(Main.java:221)
                  at org.jboss.Main$1.run(Main.java:556)
                  at java.lang.Thread.run(Thread.java:595)
                  Caused by: java.lang.IllegalArgumentException: Exception loading class for ScopeKey addition.
                  at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor.addBeanComponent(BeanMetaDataFactoryVisitor.java:67)
                  at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor.deploy(BeanMetaDataFactoryVisitor.java:126)
                  ... 34 more
                  Caused by: java.lang.ClassNotFoundException: org.jboss.webbeans.bootstrap.WebBeansBootstrap from BaseClassLoader@14e3d8f{VFSClassLoaderPolicy@1abb373{name=vfszip:/opt/DEPLOYMENTS/rscdevtb1.com/jboss/server/rsc/deploy/cxf-projects.ear/ domain=ClassLoaderDomain@1a2f02e{name=DefaultDomain parentPolicy=BEFORE parent=org.jboss.bootstrap.NoAnnotationURLClassLoader@158b649} roots=[MemoryContextHandler@26375716[path= context=vfsmemory://4so11q-38yz2r-g0qsvaoc-1-g0qsxiw6-36 real=vfsmemory://4so11q-38yz2r-g0qsvaoc-1-g0qsxiw6-36], DelegatingHandler@9061542[path=cxf-projects.ear context=file:/opt/DEPLOYMENTS/rscdevtb1.com/jboss/server/rsc/deploy/ real=file:/opt/DEPLOYMENTS/rscdevtb1.com/jboss/server/rsc/deploy/cxf-projects.ear]] delegates=null exported=[META-INF] <IMPORT-ALL>NON_EMPTY}}
                  at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:448)
                  at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
                  at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor.addBeanComponent(BeanMetaDataFactoryVisitor.java:63)
                  ... 35 more
                  2009-10-13 10:25:32,331 ERROR [main] [ProfileServiceBootstrap] - Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

                  DEPLOYMENTS IN ERROR:
                  Deployment "vfszip:/opt/DEPLOYMENTS/rscdevtb1.com/jboss/server/rsc/deploy/cxf-projects.ear/" is in error due to the following reason(s): java.lang.ClassNotFoundException: org.jboss.webbeans.bootstrap.WebBeansBootstrap from BaseClassLoader@14e3d8f{VFSClassLoaderPolicy@1abb373{name=vfszip:/opt/DEPLOYMENTS/rscdevtb1.com/jboss/server/rsc/deploy/cxf-projects.ear/ domain=ClassLoaderDomain@1a2f02e{name=DefaultDomain parentPolicy=BEFORE parent=org.jboss.bootstrap.NoAnnotationURLClassLoader@158b649} roots=[MemoryContextHandler@26375716[path= context=vfsmemory://4so11q-38yz2r-g0qsvaoc-1-g0qsxiw6-36 real=vfsmemory://4so11q-38yz2r-g0qsvaoc-1-g0qsxiw6-36], DelegatingHandler@9061542[path=cxf-projects.ear context=file:/opt/DEPLOYMENTS/rscdevtb1.com/jboss/server/rsc/deploy/ real=file:/opt/DEPLOYMENTS/rscdevtb1.com/jboss/server/rsc/deploy/cxf-projects.ear]] delegates=null exported=[META-INF] <IMPORT-ALL>NON_EMPTY}}
                  Deployment "vfszip:/opt/DEPLOYMENTS/rscdevtb1.com/jboss/server/rsc/deploy/30RPWSIS_1_0.ear/" is in error due to the following reason(s): java.lang.ClassNotFoundException: org.jboss.webbeans.bootstrap.WebBeansBootstrap from BaseClassLoader@1b63bc9{VFSClassLoaderPolicy@10f405e{name=vfszip:/opt/DEPLOYMENTS/rscdevtb1.com/jboss/server/rsc/deploy/30RPWSIS_1_0.ear/ domain=ClassLoaderDomain@1a2f02e{name=DefaultDomain parentPolicy=BEFORE parent=org.jboss.bootstrap.NoAnnotationURLClassLoader@158b649} roots=[MemoryContextHandler@4906999[path= context=vfsmemory://4so11q-38yz2r-g0qsvaoc-1-g0qsxivp-34 real=vfsmemory://4so11q-38yz2r-g0qsvaoc-1-g0qsxivp-34], DelegatingHandler@28702261[path=30RPWSIS_1_0.ear context=file:/opt/DEPLOYMENTS/rscdevtb1.com/jboss/server/rsc/deploy/ real=file:/opt/DEPLOYMENTS/rscdevtb1.com/jboss/server/rsc/deploy/30RPWSIS_1_0.ear], DelegatingHandler@20391934[path=30RPWSIS_1_0.ear/RPWSIS.sar context=file:/opt/DEPLOYMENTS/rscdevtb1.com/jboss/server/rsc/deploy/ real=file:/opt/DEPLOYMENTS/rscdevtb1.com/jboss/server/rsc/deploy/30RPWSIS_1_0.ear/RPWSIS.sar], DelegatingHandler@2273540[path=30RPWSIS_1_0.ear/RPWSIS.jar context=file:/opt/DEPLOYMENTS/rscdevtb1.com/jboss/server/rsc/deploy/ real=file:/opt/DEPLOYMENTS/rscdevtb1.com/jboss/server/rsc/deploy/30RPWSIS_1_0.ear/RPWSIS.jar]] delegates=null exported=[META-INF, com.prodeasystems.rsc.rpwsis.app, com.prodeasystems.rsc.rpwsis.factory, com.prodeasystems.rsc.rpwsis.processor, com.prodeasystems.rsc.rpwsis.web.impl, com.prodeasystems.rsc.rpwsis.activity.impl, com.prodeasystems.rsc.common.dto, com.prodeasystems.rsc.rpwsis.business.impl, com.prodeasystems.rsc.rpwsis.context, com.prodeasystems.rsc.rpwsis.common, com.prodeasystems.rsc.rpwsis.web, com.prodeasystems.rsc.rpwsis.util, com.prodeasystems.rsc.rpwsis.activity, com.prodeasystems.rsc.rpwsis.processor.impl, com.prodeasystems.rsc.rpwsis.business, , com.prodeasystems.rsc.rpwsis] <IMPORT-ALL>NON_EMPTY}}


                  then on some jboss forum, got to suggestion to copy webbeans-core.jar from ../server/rsc/deployers/webbeans.deployer/lib-int/webbeans-core.jar to ../server/rsc/lib. did that, after which i started getting the "import not java type " error.

                  • 9. Re: javax.inject.DefinitionException: import not a Java type
                    Richard Opalka Master

                     

                    "suresh.korlapati" wrote:
                    BTW, I am not using jbossws-cxf-3.2.0.GA

                    my war files has all the required CXF libraries as per

                    http://cwiki.apache.org/CXF20DOC/writing-a-service-with-spring.html


                    Jim Ma is right, your usecase is not supported with JBossWS CXF :(
                    Why don't you use JBossWS CXF to deploy web services?
                    Or you are missing some functionality in JBossWS CXF?

                    • 10. Re: javax.inject.DefinitionException: import not a Java type
                      Suresh Korlapati Newbie

                      Thanks a lot for the reply.

                      I tried using jbossws-cxf stack and is working for me.

                      Thanks
                      SK

                      • 11. Re: javax.inject.DefinitionException: import not a Java type
                        Jérôme Pramondon Newbie

                        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

                        • 13. Re: javax.inject.DefinitionException: import not a Java type
                          raevilman D Newbie

                          thanks a ton for explaining very cleanly. It realy helped.