7

In my RAD workspace, I have an EAR project. Now I have a WAS 6.1 instance which i created from inside RAD. When I right click the WAS 6.1 instance and do 'Add Remove projects' and select the EAR, I get error:

Cannot add an EAR project to the server unless it contains a Web, EJB, or Connector module.

Now this is not true because in my EAR project there is META-INF/application.xml and it has the contents:

<?xml version="1.0" encoding="UTF-8"?>
<application id="Application_ID" version="1.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
    <display-name>
    someEAR</display-name>
    <module id="EjbModule_1291759813449">
        <ejb>someEJB.jar</ejb>
    </module>
    <module>
        <web>
            <web-uri>someWeb.war</web-uri>
            <context-root>someWeb</context-root>
        </web>
    </module>
</application>

So clearly it has a <web> and <ejb> module. Why is RAD complaining?

Victor
  • 16,609
  • 71
  • 229
  • 409

4 Answers4

7

A couple of potential solutions:

  1. Uninstall your application, stop the server, reinstall your application, start the server.

  2. right click on the EAR and check "Deployment Assembly" and make sure your modules are being exported. if so, it is a good idea to remove them and re add them.

  3. Check "Project References" and make sure they are checked.

Saed Alavinia
  • 234
  • 3
  • 12
1

To add the project back to the server,

  1. Right click on your jar project and go to properties, click Java EE module dependencies. Select the project jar checkboxes under Available Java EE modules. This will get the project back.
  2. Now right click on your was server and try add/remove project. It will appear in the left panel for selection.
niemmi
  • 17,113
  • 7
  • 35
  • 42
1

In my case the solution was:

1-Make sure the web project had already run Maven so as to have the .war inside Target.

2-Right click on ear project, go to Properties > Deployment Assembly.

3-Click “Add” button, choose Archives from Workspaces. Click Add, and choose your war.

4-The War now is at Deployment Assembly list.

5-Start server.

0

In my case I went to "Project Facets" first uncheck Dynamic web module and applied the changes. Again I selected the Dynamic web module. This helped to replace the corrupted war file and resolved the issue.

enter image description here

MR_AD
  • 71
  • 4