1 23 24 25 package com.sun.enterprise.tools.verifier.tests.persistence; 26 27 import com.sun.enterprise.tools.verifier.tests.VerifierTest; 28 import com.sun.enterprise.tools.verifier.tests.VerifierCheck; 29 import com.sun.enterprise.tools.verifier.Result; 30 import com.sun.enterprise.deployment.Descriptor; 31 import com.sun.enterprise.deployment.PersistenceUnitDescriptor; 32 33 39 public class ClassNotFound extends VerifierTest implements VerifierCheck { 40 public Result check(Descriptor descriptor) { 41 Result result = getInitializedResult(); 42 addErrorDetails(result, getVerifierContext().getComponentNameConstructor()); 43 result.setStatus(Result.PASSED); 44 final PersistenceUnitDescriptor pu = PersistenceUnitDescriptor.class.cast(descriptor); 45 for(String className : pu.getClasses()) { 46 try { 47 Class.forName(className, false, getVerifierContext().getClassLoader()); 48 } catch (ClassNotFoundException e) { 49 result.failed(smh.getLocalString(getClass().getName() + "failed1", 50 "Class [ {0} ] could not be loaded", new Object []{className})); 51 } catch (NoClassDefFoundError e) { 52 result.failed(smh.getLocalString(getClass().getName() + "failed2", 53 "Class [ {0} ] could not be loaded " + 54 "because a dependent class could not be loaded. See reason:\n [ {1} ]", 55 new Object []{className,e.getMessage()})); 56 } 57 } 58 return result; 59 } 60 } 61 | Popular Tags |