Index: earproject/org/eclipse/jst/jee/internal/deployables/JEEDeployableFactory.java
===================================================================
RCS file: /cvsroot/webtools/jeetools/plugins/org.eclipse.jst.jee/earproject/org/eclipse/jst/jee/internal/deployables/JEEDeployableFactory.java,v
retrieving revision 1.2.2.1.2.1
diff -u -r1.2.2.1.2.1 JEEDeployableFactory.java
--- earproject/org/eclipse/jst/jee/internal/deployables/JEEDeployableFactory.java	24 Mar 2008 19:12:30 -0000	1.2.2.1.2.1
+++ earproject/org/eclipse/jst/jee/internal/deployables/JEEDeployableFactory.java	7 May 2008 20:09:13 -0000
@@ -30,6 +30,7 @@
 import org.eclipse.jst.j2ee.internal.deployables.J2EEFlexProjDeployable;
 import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
 import org.eclipse.jst.j2ee.jca.Connector;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
 import org.eclipse.jst.j2ee.webapplication.WebApp;
 import org.eclipse.wst.common.componentcore.ArtifactEdit;
 import org.eclipse.wst.common.componentcore.ComponentCore;
@@ -141,28 +142,60 @@
 						ArtifactEdit moduleEdit = null;
 						try {
 							if (j2eeModule.isEjbModule()) {
-								moduleEdit = ComponentUtilities.getArtifactEditForRead(moduleComponent, J2EEProjectUtilities.EJB);
-								EJBJar ejbJar = (EJBJar) moduleEdit.getContentModelRoot();
-								moduleType = J2EEProjectUtilities.EJB;
-								moduleVersion = ejbJar.getVersion();
+								try {
+									moduleEdit = ComponentUtilities.getArtifactEditForRead(moduleComponent, J2EEProjectUtilities.EJB);
+									EJBJar ejbJar = (EJBJar) moduleEdit.getContentModelRoot();
+									moduleType = J2EEProjectUtilities.EJB;
+									moduleVersion = ejbJar.getVersion();
+								} catch( NullPointerException npe ) {
+									moduleType = IJ2EEFacetConstants.EJB; 
+									moduleVersion = IJ2EEFacetConstants.EJB_30.getVersionString();
+								} catch( ClassCastException cce ) {
+									moduleType = IJ2EEFacetConstants.EJB; 
+									moduleVersion = IJ2EEFacetConstants.EJB_30.getVersionString();
+								}
 							}
 							else if (j2eeModule.isWebModule()) {
-								moduleEdit = ComponentUtilities.getArtifactEditForRead(moduleComponent, J2EEProjectUtilities.DYNAMIC_WEB);
-								WebApp webApp = (WebApp) moduleEdit.getContentModelRoot();
-								moduleType = J2EEProjectUtilities.DYNAMIC_WEB;
-								moduleVersion = webApp.getVersion();
+								try {
+									moduleEdit = ComponentUtilities.getArtifactEditForRead(moduleComponent, J2EEProjectUtilities.DYNAMIC_WEB);
+									WebApp webApp = (WebApp) moduleEdit.getContentModelRoot();
+									moduleType = J2EEProjectUtilities.DYNAMIC_WEB;
+									moduleVersion = webApp.getVersion();
+								} catch( NullPointerException npe ) {
+									moduleType = IJ2EEFacetConstants.DYNAMIC_WEB;
+									moduleVersion = IJ2EEFacetConstants.DYNAMIC_WEB_24.getVersionString();
+								} catch( ClassCastException cce ) {
+									moduleType = IJ2EEFacetConstants.DYNAMIC_WEB;
+									moduleVersion = IJ2EEFacetConstants.DYNAMIC_WEB_24.getVersionString();
+								}
 							}
 							else if (j2eeModule.isConnectorModule()) {
-								moduleEdit = ComponentUtilities.getArtifactEditForRead(moduleComponent, J2EEProjectUtilities.JCA);
-								Connector connector = (Connector) moduleEdit.getContentModelRoot();
-								moduleType = J2EEProjectUtilities.JCA;
-								moduleVersion = connector.getVersion();
+								try {
+									moduleEdit = ComponentUtilities.getArtifactEditForRead(moduleComponent, J2EEProjectUtilities.JCA);
+									Connector connector = (Connector) moduleEdit.getContentModelRoot();
+									moduleType = J2EEProjectUtilities.JCA;
+									moduleVersion = connector.getVersion();
+								} catch( NullPointerException npe ) {
+									moduleType = IJ2EEFacetConstants.JCA;
+									moduleVersion = "1.5";
+								} catch( ClassCastException cce ) {
+									moduleType = IJ2EEFacetConstants.JCA;
+									moduleVersion = "1.5";
+								}
 							}
 							else if (j2eeModule.isJavaModule()) {
-								moduleEdit = ComponentUtilities.getArtifactEditForRead(moduleComponent, J2EEProjectUtilities.APPLICATION_CLIENT);
-								ApplicationClient appClient = (ApplicationClient) moduleEdit.getContentModelRoot();
-								moduleType = J2EEProjectUtilities.APPLICATION_CLIENT;
-								moduleVersion = appClient.getVersion();
+								try {
+									moduleEdit = ComponentUtilities.getArtifactEditForRead(moduleComponent, J2EEProjectUtilities.APPLICATION_CLIENT);
+									ApplicationClient appClient = (ApplicationClient) moduleEdit.getContentModelRoot();
+									moduleType = J2EEProjectUtilities.APPLICATION_CLIENT;
+									moduleVersion = appClient.getVersion();
+								} catch( NullPointerException npe ) {
+									moduleType = IJ2EEFacetConstants.APPLICATION_CLIENT;
+									moduleVersion = IJ2EEFacetConstants.APPLICATION_CLIENT_50.getVersionString();
+								} catch( ClassCastException cce ) {
+									moduleType = IJ2EEFacetConstants.APPLICATION_CLIENT;
+									moduleVersion = IJ2EEFacetConstants.APPLICATION_CLIENT_50.getVersionString();
+								}
 							}
 						} finally {
 							if (moduleEdit!=null)
@@ -207,4 +240,4 @@
 	protected void clearCache() {
 		moduleDelegates = new HashMap(5);
 	}
-}
+}
\ No newline at end of file
