Je n'arrive pas à appeler mes services via une vue Flex 3.0
Bonjour,
Je suis débutante en Flex 3.0, j'ai utilisé une template pour réaliser la maquette de mon projet de fin d'étude. Mais ça fait presque un mois que je suis bloquée dans la partie flex, je n'arrive pas à appeler mes services à partir de mes vues flex.
Voila ce que j'ai essayé de faire:
Vue AddCentre: :
Code:
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
|
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" horizontalAlign="center" width="100%" height="100%" backgroundColor="#000000"
styleName="back" paddingLeft="20" paddingBottom="0" verticalScrollPolicy="off" paddingRight="20" paddingTop="0" viewSourceURL="srcview/index.html">
<mx:Script>
<![CDATA[
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
private function doCall():void{
roService.test1();
}
/**
* Méthode invoquée en cas de succès de l'appel RPC
*/
private function onResult(event : ResultEvent):void{
// Afficher la réponse
txtCodeCollaborateur.text = event.result as String;
}
/**
* Méthode invoquée en cas d'échec de l'appel RPC
*/
private function onFault(event : FaultEvent):void{
// Afficher le message d'erreur
txtCodeCollaborateur.text = event.fault.message;
}
]]>
</mx:Script>
<mx:RemoteObject id="roService"
destination="serviceDest"
result="onResult(event)"
fault="onFault(event)"/>
<mx:Style source="css/classicOrange.css"/>
<mx:DropShadowFilter blurY="5" blurX="5" angle="90" color="#000000" alpha=".6" id="dropShadowFilter"/>
<mx:DropShadowFilter blurY="2" blurX="2" angle="45" distance="2" color="#000000" alpha=".8" id="dropShadowFilter2"/>
<mx:GlowFilter blurX="20" id="glowFilter" color="#000000"/>
<mx:VBox backgroundColor="#cccccc" width="1000" height="100%" verticalGap="10" paddingLeft="10" paddingRight="10" filters="{[glowFilter]}" paddingBottom="20" borderSides="['left','right']" borderStyle="inset" borderColor="#808080">
<mx:ApplicationControlBar width="100%" height="50" verticalAlign="middle" filters="{[dropShadowFilter]}" paddingTop="0" paddingLeft="20" paddingRight="20">
<mx:Image source="images/logo.png" height="40"/>
<mx:Spacer width="100%"/>
<mx:HBox verticalAlign="top" height="100%" paddingTop="1" paddingRight="10">
<mx:LinkBar dataProvider="{pages}"/>
<mx:ViewStack id="pages" width="1" height="100%">
<mx:Canvas label="A propos de nous "/>
<mx:Canvas label="Contact"/>
<mx:Canvas label="Se déconnecter"/>
</mx:ViewStack>
</mx:HBox>
</mx:ApplicationControlBar>
<mx:MenuBar width="100%" x="0" y="0" height="20" labelField="@label"/>
<mx:HBox width="100%" height="100%">
<mx:Panel width="100%" height="100%" title="Bienvenue" styleName="Panel2" layout="vertical">
<mx:Accordion width="100%" height="100%">
<mx:VBox width="100%" height="100%" label="Ajouter un Centre" horizontalAlign="center" >
<mx:HBox width="100%" paddingLeft="10" paddingRight="10" horizontalAlign="center">
<mx:Label width="200" color="#030303" text="Code Centre"/>
<mx:Text width="152" color="#060606" id="txtCodeCollaborateur" fontFamily="Arial" fontSize="12"/>
<mx:RadioButtonGroup id="MyG"/>
</mx:HBox>
<mx:HBox width="100%" paddingLeft="10" paddingRight="10" horizontalAlign="center">
<mx:Label text="Libelle Centre" width="200" color="#040404"/>
<mx:Text width="152" color="#060606" id="txtPrenomCollaborateur" fontFamily="Arial" fontSize="12"/>
</mx:HBox>
<mx:HBox width="100%" paddingLeft="10" paddingRight="10" color="#030202" horizontalAlign="center">
<mx:Label text="Ville" width="200"/>
<mx:Text width="152" color="#060606" id="txtNomCollaborateur" fontFamily="Arial" fontSize="12"/>
</mx:HBox>
<mx:HBox width="100%" paddingLeft="10" paddingRight="10" horizontalAlign="center">
<mx:Label text="Nom gérant" width="200" color="#040404"/>
<mx:Text width="152" color="#060606" id="txtCINCollaborateur" fontFamily="Arial" fontSize="12"/>
</mx:HBox>
<mx:HBox width="100%" paddingLeft="10" paddingRight="10" horizontalAlign="center">
<mx:RadioButtonGroup id="MyG6"/>
<mx:Button id= "btnAjouter" label="Ajouter" click="doCall()"/>
<mx:Button id= "btnModifier" label="Modifier"/>
<mx:Button label="Supprimer"/>
<mx:Button label="Annuler" themeColor="#F9F5F5" borderColor="#F3F7FA" fontFamily="Arial"/>
</mx:HBox>
</mx:VBox>
</mx:Accordion>
</mx:Panel>
</mx:HBox>
</mx:VBox>
</mx:Application> |
Fichier web.xml :
Code:
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>EdsEstivageVues</display-name>
<description>BlazeDS Application</description>
<context-param>
<param-name>flex.class.path</param-name>
<param-value>/WEB-INF/flex/hotfixes,/WEB-INF/flex/jars</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/applicationContext.xml</param-value>
</context-param>
<!-- Chemin d'acces au fichier de configuration Spring -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/applicationContext.xml</param-value>
</context-param>
<!-- Spring listener -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Http Flex Session attribute and binding listener support -->
<listener>
<listener-class>flex.messaging.HttpFlexSession</listener-class>
</listener>
<!-- MessageBroker Servlet -->
<servlet>
<servlet-name>MessageBrokerServlet</servlet-name>
<display-name>MessageBrokerServlet</display-name>
<servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>
<init-param>
<param-name>services.configuration.file</param-name>
<param-value>/WEB-INF/flex/services-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MessageBrokerServlet</servlet-name>
<url-pattern>/messagebroker/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
</welcome-file-list>
<!-- for WebSphere deployment, please uncomment -->
<!--
<resource-ref>
<description>Flex Messaging WorkManager</description>
<res-ref-name>wm/MessagingWorkManager</res-ref-name>
<res-type>com.ibm.websphere.asynchbeans.WorkManager</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
-->
</web-app> |
Fichier "applicationContext.xml" :
Code:
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN //EN" " http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- ========================= RESOURCE DEFINITIONS ========================= -->
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://localhost:3306/dbEstivage</value>
</property>
<property name="username">
<value>root</value>
</property>
<property name="password">
<value>root</value>
</property>
</bean>
<!-- Hibernate SessionFactory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource" />
</property>
<property name="mappingResources">
<list>
<value>Role.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<!--**** Transaction manager for a single Hibernate SessionFactory (alternative to JTA)****** -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
<!--**************Data access object: Hibernate implementation.********************-->
<bean id="tester" class="service.RoleDaoImpl">
<property name="dao" ref="dao" />
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="dao" class="dataAcessObject.DaoRoleImpl">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
</beans> |
Fichier "services-config.xml" :
Code:
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
|
<?xml version="1.0" encoding="UTF-8"?>
<services-config>
<services>
<service-include file-path="remoting-config.xml" />
<service-include file-path="proxy-config.xml" />
<service-include file-path="messaging-config.xml" />
</services>
<security>
<login-command class="flex.messaging.security.TomcatLoginCommand" server="Tomcat"/>
<!-- Uncomment the correct app server
<login-command class="flex.messaging.security.TomcatLoginCommand" server="JBoss">
<login-command class="flex.messaging.security.JRunLoginCommand" server="JRun"/>
<login-command class="flex.messaging.security.WeblogicLoginCommand" server="Weblogic"/>
<login-command class="flex.messaging.security.WebSphereLoginCommand" server="WebSphere"/>
-->
<!--
<security-constraint id="basic-read-access">
<auth-method>Basic</auth-method>
<roles>
<role>guests</role>
<role>accountants</role>
<role>employees</role>
<role>managers</role>
</roles>
</security-constraint>
-->
</security>
<channels>
<channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
</channel-definition>
<channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel">
<endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
<properties>
<add-no-cache-headers>false</add-no-cache-headers>
</properties>
</channel-definition>
<channel-definition id="my-polling-amf" class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/>
<properties>
<polling-enabled>true</polling-enabled>
<polling-interval-seconds>4</polling-interval-seconds>
</properties>
</channel-definition>
<!--
<channel-definition id="my-http" class="mx.messaging.channels.HTTPChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/http" class="flex.messaging.endpoints.HTTPEndpoint"/>
</channel-definition>
<channel-definition id="my-secure-http" class="mx.messaging.channels.SecureHTTPChannel">
<endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/httpsecure" class="flex.messaging.endpoints.SecureHTTPEndpoint"/>
<properties>
<add-no-cache-headers>false</add-no-cache-headers>
</properties>
</channel-definition>
-->
</channels>
<logging>
<target class="flex.messaging.log.ConsoleTarget" level="Error">
<properties>
<prefix>[BlazeDS] </prefix>
<includeDate>false</includeDate>
<includeTime>false</includeTime>
<includeLevel>false</includeLevel>
<includeCategory>false</includeCategory>
</properties>
<filters>
<pattern>Endpoint.*</pattern>
<pattern>Service.*</pattern>
<pattern>Configuration</pattern>
</filters>
</target>
</logging>
<system>
<redeploy>
<enabled>false</enabled>
<!--
<watch-interval>20</watch-interval>
<watch-file>{context.root}/WEB-INF/flex/services-config.xml</watch-file>
<watch-file>{context.root}/WEB-INF/flex/proxy-config.xml</watch-file>
<watch-file>{context.root}/WEB-INF/flex/remoting-config.xml</watch-file>
<watch-file>{context.root}/WEB-INF/flex/messaging-config.xml</watch-file>
<watch-file>{context.root}/WEB-INF/flex/data-management-config.xml</watch-file>
<touch-file>{context.root}/WEB-INF/web.xml</touch-file>
-->
</redeploy>
</system>
<factories>
<factory id="SpringFactory" class="test.SpringFactory" />
</factories>
</services-config> |
Fichier "remoting-config.xml" :
Code:
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
|
<?xml version="1.0" encoding="UTF-8"?>
<service id="remoting-service"
class="flex.messaging.services.RemotingService">
<adapters>
<adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>
</adapters>
<default-channels>
<channel ref="my-amf"/>
</default-channels>
<destination id="serviceDest">
<properties>
<factory>SpringFactory</factory>
<source>tester</source>
</properties>
</destination>
</service> |
La classe "Tester.java" :
Code:
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
|
package test;
import model.Role;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import service.IRoleDao;
import junit.framework.TestCase;
public class Tester extends TestCase {
static ApplicationContext context;
protected void setUp() throws Exception {
context = new ClassPathXmlApplicationContext("applicationContext.xml");
}
public void test1() {
IRoleDao service = (IRoleDao) context.getBean("tester");
Role p = service.getRole(5);
p.setLibellerole("aicha");
service.UpdateRole(p);
}
} |
Merci infiniment d'avance de votre aide, je suis vraiment bloquée .
Je souhaite avoir n'importe quel conseil ou guide, des cours ou des turoriels que vous jugerez utiles.
Je serai vraiment reconnaissante.
Merci beaucoup
Flex 3.0 : Problème dans le fichier « services-config.xml»
Bonjour tout le monde :
Merci Ellène pour votre réponse.
Je m’excuse, J’ai copié par erreur un test unitaire au lieu de ma classe de service.
Voila ma classe « ServicTest»que je tente d’appeler :
Code:
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
|
package test;
import java.io.Serializable;
import model.Role;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import service.IRoleDao;
public class ServicTest implements Serializable {
public ServicTest() {
super();
}
private static final long serialVersionUID = 1L;
static ApplicationContext context;
protected void setUp() throws Exception {
context = new ClassPathXmlApplicationContext("applicationContext.xml");
}
public void test1() {
IRoleDao service = (IRoleDao) context.getBean("tester");
Role p = service.getRole(5);
p.setLibellerole("aicha");
service.UpdateRole(p);
}
} |
Vue « AddCentre.mxml » :
Code:
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
|
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" horizontalAlign="center" width="100%" height="100%" backgroundColor="#000000"
styleName="back" paddingLeft="20" paddingBottom="0" verticalScrollPolicy="off" paddingRight="20" paddingTop="0" viewSourceURL="srcview/index.html">
<mx:Script>
<![CDATA[
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
private function doCall():void{
roService.test1();
}
/**
* Méthode invoquée en cas de succès de l'appel RPC
*/
private function onResult(event : ResultEvent):void{
// Afficher la réponse
txtCodeCollaborateur.text = event.result as String;
}
/**
* Méthode invoquée en cas d'échec de l'appel RPC
*/
private function onFault(event : FaultEvent):void{
// Afficher le message d'erreur
txtCodeCollaborateur.text = event.fault.message;
}
]]>
</mx:Script>
<mx:RemoteObject id="roService" destination="serviceDest" result="onResult(event)" fault="onFault(event)"/>
<mx:Style source="css/classicOrange.css"/>
<mx:DropShadowFilter blurY="5" blurX="5" angle="90" color="#000000" alpha=".6" id="dropShadowFilter"/>
<mx:DropShadowFilter blurY="2" blurX="2" angle="45" distance="2" color="#000000" alpha=".8" id="dropShadowFilter2"/>
<mx:GlowFilter blurX="20" id="glowFilter" color="#000000"/>
<mx:VBox backgroundColor="#cccccc" width="1000" height="100%" verticalGap="10" paddingLeft="10" paddingRight="10" filters="{[glowFilter]}" paddingBottom="20" borderSides="['left','right']" borderStyle="inset" borderColor="#808080">
<mx:ApplicationControlBar width="100%" height="50" verticalAlign="middle" filters="{[dropShadowFilter]}" paddingTop="0" paddingLeft="20" paddingRight="20">
<mx:Image source="images/logo.png" height="40"/>
<mx:Spacer width="100%"/>
<mx:HBox verticalAlign="top" height="100%" paddingTop="1" paddingRight="10">
<mx:LinkBar dataProvider="{pages}"/>
<mx:ViewStack id="pages" width="1" height="100%">
<mx:Canvas label="A propos de nous "/>
<mx:Canvas label="Contact"/>
<mx:Canvas label="Se déconnecter"/>
</mx:ViewStack>
</mx:HBox>
</mx:ApplicationControlBar>
<mx:MenuBar width="100%" x="0" y="0" height="20" labelField="@label"/>
<mx:HBox width="100%" height="100%">
<mx:Panel width="100%" height="100%" title="Bienvenue" styleName="Panel2" layout="vertical">
<mx:Accordion width="100%" height="100%">
<mx:VBox width="100%" height="100%" label="Ajouter un Centre" horizontalAlign="center" >
<mx:HBox width="100%" paddingLeft="10" paddingRight="10" horizontalAlign="center">
<mx:Label width="200" color="#030303" text="Code Centre"/>
<mx:Text width="152" color="#060606" id="txtCodeCollaborateur" fontFamily="Arial" fontSize="12"/>
<mx:RadioButtonGroup id="MyG"/>
</mx:HBox>
<mx:HBox width="100%" paddingLeft="10" paddingRight="10" horizontalAlign="center">
<mx:Label text="Libelle Centre" width="200" color="#040404"/>
<mx:Text width="152" color="#060606" id="txtPrenomCollaborateur" fontFamily="Arial" fontSize="12"/>
</mx:HBox>
<mx:HBox width="100%" paddingLeft="10" paddingRight="10" color="#030202" horizontalAlign="center">
<mx:Label text="Ville" width="200"/>
<mx:Text width="152" color="#060606" id="txtNomCollaborateur" fontFamily="Arial" fontSize="12"/>
</mx:HBox>
<mx:HBox width="100%" paddingLeft="10" paddingRight="10" horizontalAlign="center">
<mx:Label text="Nom gérant" width="200" color="#040404"/>
<mx:Text width="152" color="#060606" id="txtCINCollaborateur" fontFamily="Arial" fontSize="12"/>
</mx:HBox>
<mx:HBox width="100%" paddingLeft="10" paddingRight="10" horizontalAlign="center">
<mx:RadioButtonGroup id="MyG6"/>
<mx:Button id= "btnAjouter" label="Ajouter" click="doCall()"/>
<mx:Button id= "btnModifier" label="Modifier"/>
<mx:Button label="Supprimer"/>
<mx:Button label="Annuler" themeColor="#F9F5F5" borderColor="#F3F7FA" fontFamily="Arial"/>
</mx:HBox>
</mx:VBox>
</mx:Accordion>
</mx:Panel>
</mx:HBox>
</mx:VBox>
</mx:Application> |
Fichier « applicationContext.xml » :
Code:
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN //EN" " http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- ========================= RESOURCE DEFINITIONS ========================= -->
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://localhost:3306/dbEstivage</value>
</property>
<property name="username">
<value>root</value>
</property>
<property name="password">
<value>root</value>
</property>
</bean>
<!-- Hibernate SessionFactory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource" />
</property>
<property name="mappingResources">
<list>
<value>Role.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<!--**** Transaction manager for a single Hibernate SessionFactory (alternative to JTA)****** -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
<!--**************Data access object: Hibernate implementation.********************-->
<bean id="ServicTest" class="service.RoleDaoImpl">
<property name="dao" ref="dao" />
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="dao" class="dataAcessObject.DaoRoleImpl">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
</beans> |
Fichier "services-config.xml" :
Code:
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
|
<?xml version="1.0" encoding="UTF-8"?>
<services-config>
<services>
<service-include file-path="remoting-config.xml" />
<service-include file-path="proxy-config.xml" />
<service-include file-path="messaging-config.xml" />
</services>
<security>
<login-command class="flex.messaging.security.TomcatLoginCommand" server="Tomcat"/>
<!-- Uncomment the correct app server
<login-command class="flex.messaging.security.TomcatLoginCommand" server="JBoss">
<login-command class="flex.messaging.security.JRunLoginCommand" server="JRun"/>
<login-command class="flex.messaging.security.WeblogicLoginCommand" server="Weblogic"/>
<login-command class="flex.messaging.security.WebSphereLoginCommand" server="WebSphere"/>
-->
<!--
<security-constraint id="basic-read-access">
<auth-method>Basic</auth-method>
<roles>
<role>guests</role>
<role>accountants</role>
<role>employees</role>
<role>managers</role>
</roles>
</security-constraint>
-->
</security>
<channels>
<channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
</channel-definition>
<channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel">
<endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
<properties>
<add-no-cache-headers>false</add-no-cache-headers>
</properties>
</channel-definition>
<channel-definition id="my-polling-amf" class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/>
<properties>
<polling-enabled>true</polling-enabled>
<polling-interval-seconds>4</polling-interval-seconds>
</properties>
</channel-definition>
<!--
<channel-definition id="my-http" class="mx.messaging.channels.HTTPChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/http" class="flex.messaging.endpoints.HTTPEndpoint"/>
</channel-definition>
<channel-definition id="my-secure-http" class="mx.messaging.channels.SecureHTTPChannel">
<endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/httpsecure" class="flex.messaging.endpoints.SecureHTTPEndpoint"/>
<properties>
<add-no-cache-headers>false</add-no-cache-headers>
</properties>
</channel-definition>
-->
</channels>
<logging>
<target class="flex.messaging.log.ConsoleTarget" level="Error">
<properties>
<prefix>[BlazeDS] </prefix>
<includeDate>false</includeDate>
<includeTime>false</includeTime>
<includeLevel>false</includeLevel>
<includeCategory>false</includeCategory>
</properties>
<filters>
<pattern>Endpoint.*</pattern>
<pattern>Service.*</pattern>
<pattern>Configuration</pattern>
</filters>
</target>
</logging>
<system>
<redeploy>
<enabled>false</enabled>
<!--
<watch-interval>20</watch-interval>
<watch-file>{context.root}/WEB-INF/flex/services-config.xml</watch-file>
<watch-file>{context.root}/WEB-INF/flex/proxy-config.xml</watch-file>
<watch-file>{context.root}/WEB-INF/flex/remoting-config.xml</watch-file>
<watch-file>{context.root}/WEB-INF/flex/messaging-config.xml</watch-file>
<watch-file>{context.root}/WEB-INF/flex/data-management-config.xml</watch-file>
<touch-file>{context.root}/WEB-INF/web.xml</touch-file>
-->
</redeploy>
</system>
<factories>
<factory id="SpringFactory" class="test.SpringFactory" />
</factories>
</services-config> |
Fichier "remoting-config.xml" :
Code:
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
|
<?xml version="1.0" encoding="UTF-8"?>
<service id="remoting-service"
class="flex.messaging.services.RemotingService">
<adapters>
<adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>
</adapters>
<default-channels>
<channel ref="my-amf"/>
</default-channels>
<destination id="serviceDest">
<properties>
<factory>SpringFactory</factory>
<source>ServicDest</source>
</properties>
</destination>
</service> |
Fichier web.xml :
Code:
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 55 56 57 58 59 60 61 62 63 64 65 66 67
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>EdsEstivageVues</display-name>
<description>BlazeDS Application</description>
<context-param>
<param-name>flex.class.path</param-name>
<param-value>/WEB-INF/flex/hotfixes,/WEB-INF/flex/jars</param-value>
</context-param>
<!-- Chemin d'acces au fichier de configuration Spring -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/applicationContext.xml</param-value>
</context-param>
<!-- Spring listener -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Http Flex Session attribute and binding listener support -->
<listener>
<listener-class>flex.messaging.HttpFlexSession</listener-class>
</listener>
<!-- MessageBroker Servlet -->
<servlet>
<servlet-name>MessageBrokerServlet</servlet-name>
<display-name>MessageBrokerServlet</display-name>
<servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>
<init-param>
<param-name>services.configuration.file</param-name>
<param-value>/WEB-INF/flex/services-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MessageBrokerServlet</servlet-name>
<url-pattern>/messagebroker/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
</welcome-file-list>
<!-- for WebSphere deployment, please uncomment -->
<!--
<resource-ref>
<description>Flex Messaging WorkManager</description>
<res-ref-name>wm/MessagingWorkManager</res-ref-name>
<res-type>com.ibm.websphere.asynchbeans.WorkManager</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
-->
</web-app> |
Quand je clique sur le bouton possédant l’identifiant id= "btnAjouter" je reçois l’erreur suivante :
Citation:
faultCode:InvokeFailed faultString:'[MessagingError message='Destination 'serviceDest' either does not exist or the destination has no channels defined (and the application does not define any default channels.)']' faultDetail:'Couldn't establish a connection to 'serviceDest''
Voici la trace d’erreur :
Citation:
**** MessageBrokerServlet failed to initialize due to runtime exception: Error: java.lang.NoSuchFieldError: ANY_HOST_CONFIGURATION
at org.apache.commons.httpclient.params.HttpConnectionManagerParams.setDefaultMaxConnectionsPerHost(HttpConnectionManagerParams.java:85)
at flex.messaging.services.http.HTTPProxyAdapter.initHttpConnectionManagerParams(HTTPProxyAdapter.java:698)
at flex.messaging.services.http.HTTPProxyAdapter.setConnectionManagerSettings(HTTPProxyAdapter.java:513)
at flex.messaging.services.http.HTTPProxyAdapter.initialize(HTTPProxyAdapter.java:348)
at flex.messaging.config.MessagingConfiguration.createAdapter(MessagingConfiguration.java:375)
at flex.messaging.config.MessagingConfiguration.createDestination(MessagingConfiguration.java:364)
at flex.messaging.config.MessagingConfiguration.createServices(MessagingConfiguration.java:332)
at flex.messaging.config.MessagingConfiguration.configureBroker(MessagingConfiguration.java:100)
at flex.messaging.MessageBrokerServlet.init(MessageBrokerServlet.java:129)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3917)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4201)
at org.apache.catalina.core.StandardContext.reload(StandardContext.java:2990)
at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:403)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1277)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1569)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1558)
at java.lang.Thread.run(Thread.java:595)
1 avr. 2010 14:05:47 org.apache.catalina.core.ApplicationContext log
INFO: La servlet MessageBrokerServlet est marqué comme indisponible
1 avr. 2010 14:05:47 org.apache.catalina.core.StandardContext loadOnStartup
GRAVE: La servlet /EdsEstivageVues a généré une exception "load()"
javax.servlet.UnavailableException: ANY_HOST_CONFIGURATION
at flex.messaging.MessageBrokerServlet.init(MessageBrokerServlet.java:170)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3917)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4201)
at org.apache.catalina.core.StandardContext.reload(StandardContext.java:2990)
at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:403)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1277)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1569)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1558)
at java.lang.Thread.run(Thread.java:595)
J’ai besoin vraiment de vos suggestions.
Merci infiniment d’avance.