IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Services Web Java Discussion :

Erreur de Configuration CXF + Spring


Sujet :

Services Web Java

  1. #1
    Membre à l'essai
    Homme Profil pro
    Développeur Java
    Inscrit en
    Février 2012
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Développeur Java

    Informations forums :
    Inscription : Février 2012
    Messages : 25
    Points : 15
    Points
    15
    Par défaut Erreur de Configuration CXF + Spring
    Bonsoir à tous !

    Depuis quelques jours j'essaie de mettre en place un web service SOAP avec le framework CXF avec Maven. j'ai bien suivi le petit tutoriel de Denis Thomas (Atatorus) bien évidemment en l'adaptant à mes besoins. Sauf que je bloque au niveau de l'accès à mon service. ci-dessous l'erreur que j'obtiens :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
     
    HTTP Status 500 - Servlet.init() for servlet CXFServlet threw exception
     
    type Exception report
     
    message Servlet.init() for servlet CXFServlet threw exception
     
    description The server encountered an internal error that prevented it from fulfilling this request.
     
    exception
     
    javax.servlet.ServletException: Servlet.init() for servlet CXFServlet threw exception
    	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    	org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
    	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
    	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
    	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
    	org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
    	org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
    	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    	java.lang.Thread.run(Thread.java:745)
    root cause
     
    org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'cxf' is defined
    	org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:698)
    	org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1175)
    	org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:284)
    	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    	org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:962)
    	org.apache.cxf.transport.servlet.CXFServlet.loadBus(CXFServlet.java:80)
    	org.apache.cxf.transport.servlet.CXFNonSpringServlet.init(CXFNonSpringServlet.java:77)
    	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    	org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
    	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
    	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
    	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
    	org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
    	org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
    	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    	java.lang.Thread.run(Thread.java:745)
    note The full stack trace of the root cause is available in the Apache Tomcat/8.0.28 logs.
    Après analyse je me rends compte qu'il y a des fichiers tels que : cxf.xml, cxf-extension-soap.xml et cxf-servlet.xml qu'il faut intégrer dans le fichier de context spring. Mais je me dis aussi que j'utilise maven donc il devrait se débrouuiller pour trouver ces fichiers tout comme l'a fait @Atatorus ! Néanmoins même en l'ajoutant rien à faire j'ai toujours l'erreur. Et à ce stade je ne sais plus où j'ai foiré !
    Ci-dessous mes fichiers et la config maven :
    spring-context :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
     
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://cxf.apache.org/configuration/beans"
        xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:soap="http://cxf.apache.org/bindings/soap"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
        http://www.cxf.apache.org/bindings/soap
        http://www.cxf.apache.org/bindings/schemas/configuration/soap.xsd
        http://cxf.apache.org/jaxws
        http://cxf.apache.org/schemas/jaxws.xsd">
     
        <jaxws:endpoint id ="back"
            implementor="com.web.backoffice.ws.soap.BackOfficeImpl" address="/backoffice">
        </jaxws:endpoint>
    </beans>
    web.xml

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
     
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    	id="WebApp_ID" version="3.0">
     
    	<description></description>
     
    	<context-param>
    		<param-name>contextClass</param-name>
    		<param-value>org.springframework.web.context.support.AnnotationConfigWebApplicationContext</param-value>
    	</context-param>
     
    	<context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/spring-context.xml</param-value>
        </context-param>
     
    	<!-- Bootstrap the root application context as usual using ContextLoaderListener -->
    	<listener>
    		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    	</listener>
     
     
     
    	<!-- Initialization of application -->
    	<servlet>
    		<servlet-name>ApplicationServlet</servlet-name>
    		<servlet-class>com.web.backoffice.servlet.ApplicationServlet</servlet-class>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
     
    	<!-- Web Service SOAP -->
     
     
    	<!-- Apache CXF -->
    	<context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/spring-context.xml</param-value>
        </context-param>
     
    	<servlet>
            <servlet-name>CXFServlet</servlet-name>
            <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
     
        <servlet-mapping>
            <servlet-name>CXFServlet</servlet-name>
            <url-pattern>/services/*</url-pattern>
        </servlet-mapping>
     
    </web-app>
    pom.xml
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
     
    		<!-- Apache CXF -->
    		<dependency>
            	<groupId>org.apache.cxf</groupId>
    			<artifactId>cxf-rt-databinding-jaxb</artifactId>
            	<version>${cxf.version}</version>
        	</dependency>
    	    <dependency>
    	        <groupId>org.apache.cxf</groupId>
    	        <artifactId>cxf-rt-frontend-jaxws</artifactId>
    	        <version>${cxf.version}</version>
    	    </dependency>
    	    <dependency>
    	        <groupId>org.apache.cxf</groupId>
    	        <artifactId>cxf-rt-transports-http</artifactId>
    	        <version>${cxf.version}</version>
    	    </dependency>
    ci-joint les jar spring que j'utilise

    Nom : Capture.PNG
Affichages : 400
Taille : 13,4 Ko

    Si quelqu'un a une idée ça serait vraiment sympa.
    Merci d'avance !

  2. #2
    Membre extrêmement actif Avatar de ddoumeche
    Homme Profil pro
    Ingénieur recherche et développement
    Inscrit en
    Octobre 2007
    Messages
    1 676
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Singapour

    Informations professionnelles :
    Activité : Ingénieur recherche et développement

    Informations forums :
    Inscription : Octobre 2007
    Messages : 1 676
    Points : 2 009
    Points
    2 009
    Par défaut
    Il faut importer le fichier de configuration cfx.xml comme indiqué dans la documentation.
    La joie de l'âme est dans la planification -- Louis Hubert Liautey

  3. #3
    Membre à l'essai
    Homme Profil pro
    Développeur Java
    Inscrit en
    Février 2012
    Messages
    25
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Développeur Java

    Informations forums :
    Inscription : Février 2012
    Messages : 25
    Points : 15
    Points
    15
    Par défaut
    Bonjour,
    oui je l'ai déjà fait, mais en vain

Discussions similaires

  1. [Framework] Erreur dans la configuration de spring
    Par haajoura dans le forum Spring
    Réponses: 1
    Dernier message: 27/09/2011, 12h29
  2. [Framework] Coincé : Spring POA "erreur de configuration"
    Par otam_otam dans le forum Spring
    Réponses: 1
    Dernier message: 25/05/2008, 23h35
  3. erreur de configuration
    Par tonton12 dans le forum WebDev
    Réponses: 1
    Dernier message: 29/08/2006, 21h24
  4. [Continuum] Bug ou erreur de configuration ?
    Par elitost dans le forum Intégration Continue
    Réponses: 2
    Dernier message: 15/08/2006, 23h11
  5. [VB.NET] Erreur de configuration
    Par toniolol dans le forum ASP.NET
    Réponses: 2
    Dernier message: 04/12/2005, 11h35

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo