Continuing troubleshooting a payment plugin, the plugin configuration was found, but then a new error was being thrown:
Error:Failed to initialize the payment plug-in ThePluginName. The reported exception is: javax.naming.NameNotFoundException: Context: localhost/nodes/localhost/servers/server1, name: ejb/com/company/payment/plugin/ThePluginNameHome: First component in name payment/plugin/ThePluginNameHome not found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0].

The payment plugin project was there. It was imported and could be found at the path specified. A quick prepare for deployment and publish should fix the issue.

However, the imported project into Rational Application Developer was not being treated as an EJB project. Therefore, prepare for deployment wasn’t an option.

RAD, as well as Eclipse, use facets to determine the project type. Taking WebSphereCommerceServerExtensionsData as an example, right clicking on the project and selecting properties, and then selecting Project Facets shows the EJB Module facet:
rad project facets

The new project not only doesn’t have the EJB Module checked, it doesn’t even have the EJB Module as an option!

Eclipse documentation states that only the facets available for that project will be listed. Now the problem is getting those facets to be available.

First, look at the .project file. There are likely a couple of differences, however, this could easily be checked in to SVN/Git or which source control system you use. If this file truly was the cause of the facets showing, why isn’t it?

The differences between a .project file that works and one that doesn’t will likely be the projects element. The working file for WebSphereCommerceServerExtensionsData has:

	<projects>
		<project>WC</project>
	</projects>

Additionally, it has a few more natures:

	<nature>com.ibm.datatools.core.ui.DatabaseDesignNature</nature>
	<nature>org.eclipse.jem.beaninfo.BeanInfoNature</nature>

I like to add those changes, but that’s not enough.

Next, look at the folder named .settings. For a working project, you will see a com.ibm.etools.ejbdeploy.prefs file.

As the name implies, it’s directly related to EJBs and is usually not a file that is included when checking code in. Adding that file to the .settings folder of the project that isn’t work is required.

Copy it over from a working project, or create a new file that has that name. The contents should be:

com.ibm.etools.ejbdeploy.generateRefStubs=true
com.ibm.etools.ejbdeploy.generateUnqualifiedSQL=false
com.ibm.etools.ejbdeploy.generationFolder=ejbModule
com.ibm.etools.ejbdeploy.rmicSysProperties=
com.ibm.etools.ejbdeploy.rmicVerboseOutput=false
eclipse.preferences.version=1

Either close the project and reopen it, or just close RAD and restart it. The project should now have the little EJB bean icon next to it.

You are almost there, but you still need to add the module to the EAR for it to be found…and to fully get rid of errors like:
WSVR0501E: Error creating component com.ibm.ws.runtime.component.CompositionUnitMgrImpl@59651741
com.ibm.ws.exception.RuntimeWarning: com.ibm.ws.exception.RuntimeError: org.eclipse.jst.j2ee.commonarchivecore.internal.exception.NoModuleFileException: A file does not exist for module element having uri: TheEJBProject.jar

To fix that, open the application.xml file from the WC project. On the design tab, click on Application (WebSphereCommerceServer) and hit the Add… button. Choose Module and your new project should be listed. Select it and click Finish.

Now you should be able to do a prepare for deployment and a publish to get everything working as expected. An alternative approach is to use the jar file to import instead of a folder. Importing the jar creates the project as an EJB project correctly without the need to manually set facets.