现在我正在处理新模块,它使用Hibernate和spring,我是这个技术的新手,因为需要尽快解决这个问题,我正在寻找建议,当我在服务器中部署我的应用程序时,我低于错误,
SRVE0180I: [RbsAdapterWeb] [/IVRAdapterWeb] [Servlet.LOG]: Loading Spring root WebApplicationContext
[11/21/11 13:00:46:709 WST] 778b4480 XmlBeanDefini I org.springframework.beans.factory.xml.XmlBeanDefinitionReader Loading XML bean definitions from class path resource [applicationContext.xml]
[11/21/11 13:00:46:763 WST] 778b4480 ContextLoader E org.springframework.web.context.ContextLoader Context initialization failed
[11/21/11 13:00:46:774 WST] 778b4480 ContextLoader E org.springframework.web.context.ContextLoader TRAS0014I: È stata registrata la seguente eccezione org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'hcm' defined in class path resource [applicationContext.xml]: Class that bean class [it.elsag.echannel.utils.HCMAbstraction] depends on not found; nested exception is java.lang.NoClassDefFoundError: it/elsag/echannel/common/PasswordRulesException
java.lang.NoClassDefFoundError: it/elsag/echannel/common/PasswordRulesException
当然它没有找到该类,但是当我通过检查耳文检查存在时,
任何人都可以帮我检查一下,我正在运行WebSphere
提前致谢
答案 0 :(得分:0)
错误表示您的应用无法在类路径中找到该类。
要解决此问题,请转储类路径以确保它包含您所期望的内容。使用此代码:
public static String determineClassPath( ClassLoader cLoader ) {
List<URL> urls = getClassPath( cLoader );
StringBuilder buffer = new StringBuilder();
String delim = "";
for( URL url : urls ) {
buffer.append( delim ).append( url );
delim = "\n";
}
return buffer.toString().trim();
}
public static List<URL> getClassPath( ClassLoader cLoader ) {
List<ClassLoader> loaders = new ArrayList<ClassLoader>();
ClassLoader current = cLoader;
while( current != null ) {
loaders.add( 0, current );
current = current.getParent();
}
List<URL> result = new ArrayList<URL>();
for( ClassLoader loader : loaders ) {
determineClassPath( result, loader );
}
return result;
}
public static List<URL> getURLs( ClassLoader cLoader ) {
List<URL> result = new ArrayList<URL>();
determineClassPath( result, cLoader );
return result;
}
private static boolean DEBUG_CLASSPATH = true;
private static void determineClassPath( List<URL> result, ClassLoader cLoader ) {
if( DEBUG_CLASSPATH ) {
Logger log = LoggerFactory.getLogger( JavaUtils.class );
log.debug( "ClassLoader {}", cLoader );
}
if( cLoader instanceof URLClassLoader ) {
URLClassLoader cl = (URLClassLoader) cLoader;
URL [] urls = cl.getURLs();
if( urls == null ) { // On IBM/WebSphere this can be null
urls = new URL[0];
}
if( DEBUG_CLASSPATH ) {
Logger log = LoggerFactory.getLogger( JavaUtils.class );
log.debug( " URLs: {}", urls );
}
result.addAll( Arrays.asList( urls ) );
} else if( cLoader != null ) {
Logger log = LoggerFactory.getLogger( JavaUtils.class );
log.warn( "Unsupported class loader " + cLoader.getClass() );
}
}
要寻找的东西:
答案 1 :(得分:0)
尝试检查服务器上已部署的EAR的路径。如果您正在使用Network Deployment,那应该是这样的:
{WAS_INSTALL_DIR}/profiles/{deployment_manager_dir}/config/cells/{cell_name}/applications/{app}.ear
如果它是一个独立的WAS,它是这样的:
{WAS_INSTALL_DIR}/profiles/{your_profile_dir}/config/cells/{cell_name}/applications/{app}.ear
如果您发现该课程不在那个耳朵中,那么您就会发现问题。
在网络部署中,这种错误经常发生,因为耳朵更新,添加了一些类,并且该更新尚未与节点同步。尝试同步服务器节点并重新启动应用程序。