RAD not adding an EAR project to a WAS instance
Asked Answered
K

4

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?

Kidwell answered 23/1, 2013 at 23:20 Comment(2)
You have Web and EJB projects also in RAD that are the ones referenced by that application.xml?Berceuse
Yes I have those projects that are referencedKidwell
S
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.

Spirelet answered 24/1, 2013 at 3:54 Comment(2)
Thanks. I understand #2 since it is related to application.xml. But why recommend #3?Kidwell
#2 helped me . Thanks!Mandal
R
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.
Reticulum answered 5/1, 2017 at 5:58 Comment(0)
A
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.

Allister answered 14/9, 2018 at 19:15 Comment(0)
V
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

Vive answered 21/8, 2022 at 13:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.