Tuesday, May 17, 2011

Bug "One or more constraints have not been satisfied"

I get the error message:


"Errors were encountered while creating the project.


Reason:
One or more constraints have not been satisfied"


This happens when I try to create a combined Java / Flex project using WTP (Web Tools Platform) in Eclipse 3.6 (Helios). Searching the Internet, this problem doesn't seem very widespread. Indeed a lot of people recommended to simply separate the Java side of the Flex Remote application and the Flex side of the Flex Remote application into 2 separate projects.


I have considered this, but I would still like to have both parts in the same Eclipse project. So how do I do this?


The idea is to not use the WTP wizard to create the combined Java / Flex project, but to do it manually myself. Below is a screen cast that will make it clear.






Here is a summary of what I did in the screen cast:

  1. create a Dynamic Web Project
  2. deploy to Glassfish
  3. copy BlazeDS jar files to WEB-INF/libs folder
  4. create WEB-INF/flex folder
  5. copy BlazeDS config files to WEB-INF/flex folder
  6. edit web.xml to deploy the BlazeDS MessageBroker servlet
  7. add Flex Project nature to the project, setting "bin-debug" as the output folder
  8. edit .settings 

In the screen cast, I paste some standard BlazeDS configuration. Here's what I pasted:





  <servlet>
  <servlet-name>MessageBrokerServlet</servlet-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>
  <init-param>
  <param-name>flex.write.path</param-name>
  <param-value>/WEB-INF/flex</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>

3 comments:

  1. Thanks Gerard! This is a very helpful article. I faced the same problem with WTP, and this post & video was a timely help.

    ReplyDelete
  2. Thanks Gerard, This was very helpful for me.

    ReplyDelete
  3. It's so nicccccccccccccccce for u to do that~

    ReplyDelete