Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 为什么Wildfly中com/sun/rowset/CachedRowSetImpl的NoClassDefFoundError会出错?_Java_Jboss_Wildfly_Cachedrowset - Fatal编程技术网

Java 为什么Wildfly中com/sun/rowset/CachedRowSetImpl的NoClassDefFoundError会出错?

Java 为什么Wildfly中com/sun/rowset/CachedRowSetImpl的NoClassDefFoundError会出错?,java,jboss,wildfly,cachedrowset,Java,Jboss,Wildfly,Cachedrowset,我的操作系统是Windows 7 64位。我正在与Eclipse Luna合作。我正在探索从JBoss4.2.3到Wildfly 8.2.1的迁移 我创建了一个简单的web应用程序来测试com.sun.rowset.CachedRowSetImpl,我相信它是JDK的一部分 我创建了一个类rowsetadapter,作为CachedRowSetImpl类的包装器: package com.srh.util; import java.io.Serializable; import java.sq

我的操作系统是Windows 7 64位。我正在与Eclipse Luna合作。我正在探索从JBoss4.2.3到Wildfly 8.2.1的迁移

我创建了一个简单的web应用程序来测试com.sun.rowset.CachedRowSetImpl,我相信它是JDK的一部分

我创建了一个类
rowsetadapter
,作为CachedRowSetImpl类的包装器:

package com.srh.util;

import java.io.Serializable;
import java.sql.SQLException;
import com.sun.rowset.CachedRowSetImpl;

public class RowSetAdaptor implements Serializable {
   private CachedRowSetImpl rowset;
   public RowSetAdaptor() {
      try {
         rowset = new CachedRowSetImpl();
      } catch (SQLException sqle) {
         System.out.println("RowSetAdaptor: constructor: SQLException=" + sqle);            
      }     
   }
}
然后我创建一个侦听器类
AppContextListener

package com.srh.listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import com.srh.util.RowSetAdaptor;

public class AppContextListener implements ServletContextListener {
    public AppContextListener() {
    }

    public void contextInitialized(ServletContextEvent arg0) {
        RowSetAdaptor rsa = null;
        rsa = new RowSetAdaptor();
        System.out.println("AppContextListener: after create: rsa=" + rsa);
    }

    public void contextDestroyed(ServletContextEvent arg0) {
    }
}
将应用程序部署到Jboss 4.2.3,并在server.log中获得正确的输出:

AppContextListener:创建后: rsa=com.srh.util。RowSetAdaptor@2a9073ef

将同一应用程序部署到Wildfly 8.2.1,并在server.log中获取CachedRowSetImpl的NoClassDefFoundError:

原因:java.lang.NoClassDefFoundError: com/sun/rowset/CachedRowSetImpl

既然com.sun.rowset.CachedRowSetImpl是JDK的一部分,那么为什么Wildfly会给出这个错误呢?我很困惑。如何解决这个问题


谢谢

我按照以下步骤解决了此问题:

打开位于
modules/system/layers/base/sun/JDK/main
目录中的JDK的
module.xml

在“路径”元素下包括以下3行:

<path name="com/sun/rowset"/>
<path name="com/sun/rowset/internal"/>
<path name="com/sun/rowset/providers"/>

保存
module.xml

重新启动Wildfly

不知道为什么Wildfly JDK模块没有这3行代码