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.

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:



Thursday, May 5, 2011

Changing the context root of a Dynamic Web Project in Eclipse

I always hated that when I created a Dynamic Web Project in Eclipse (I used 3.4 and 3.6), the context root of the deployed application was always the same as my project name. So I can't have a descriptive project name like 'The Company - concept test 1'. I'd have to have names like 'boc' as my Eclipse project name.

So now (yes, call me slow), I found out how I can dynamically change the context root that Eclipse will deploy my project application with.

When I create a Dynamic Web Project, a .settings folder would be automatically created for me. In that folder, in an XML file called: org.eclipse.wst.common.component, there will be elements called 'property'. One of those elements has a name-value attribute pair called 'context-root'. Change the value of that attribute, and republish your project.