java.lang.classnotfoundexception:wildfly-9.0.2.final中的com.sun.rowset.cachedrowsetimpl

chhkpiq4  于 2021-07-03  发布在  Java
关注(0)|答案(1)|浏览(497)

环境-as@wildfly-9.0.2.final,jdk-java版本“1.8.0\u66”,构建工具-ant
包含以下代码的java文件被配置为一个模块(module add--name=jaroneapi--resources=~/downloads/jaroneapi.jar),我认为我需要的类都在jdk的rt.jar中。

package api.jarone.com.pojo;
import com.sun.rowset.CachedRowSetImpl;
public class TestJarOneDetails {
public void getOperatorInfo() throws Exception{
    try{
        System.out.println(" Getting error while accesing CachedRowSetImpl java class in wildfly-9.0.2.Final,This
java class has been packaged in jaroneapi.jar. Now 1. Go to $WILDFLY_HOME/bin directory and invoke command ./jboss-cli.sh --connect
2. module add --name=jaroneapi --resources=~/Downloads/jaroneapi.jar");
        CachedRowSetImpl localCachedRowSetImpl = new CachedRowSetImpl();
      }
    catch(Exception e){
        e.printStackTrace();
        throw e;
  }
}
}

异常日志

10:54:00,343 ERROR [org.jboss.as.ejb3.invocation] (default task-1) WFLYEJB0034: EJB Invocation failed on component ClientTestHelperBean for method public abstract java.lang.String client.test.ejb.session.ClientTestHelperLocal.getValueByParamName(int,java.lang.String,java.lang.String) throws java.lang.Exception: javax.ejb.EJBException: WFLYEJB0442: Unexpected Error
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:184)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:327)
Caused by: java.lang.NoClassDefFoundError: com/sun/rowset/CachedRowSetImpl
at api.jarone.com.pojo.TestJarOneDetails.getOperatorInfo(TestJarOneDetails.java:12)
at client.test.ejb.session.ClientTestHelperBean.getValueByParamName(ClientTestHelperBean.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Caused by: java.lang.ClassNotFoundException: com.sun.rowset.CachedRowSetImpl from [Module "jaroneapi:main" from local module loader @707f7052 (finder: local module finder @11028347 (roots: /wildfly-9.0.2.Final/modules,/Downloads/wildfly-9.0.2.Final/modules/system/layers/base))]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404)
10:54:00,356 ERROR [stderr] (default task-1) javax.ejb.EJBException: WFLYEJB0442: Unexpected Error
10:54:00,357 ERROR [stderr] (default task-1)    at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:184)
10:54:00,357 ERROR [stderr] (default task-1)    at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277)
10:54:00,357 ERROR [stderr] (default task-1)    at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:327)
10:54:00,424 ERROR [stderr] (default task-1) Caused by: java.lang.NoClassDefFoundError: com/sun/rowset/CachedRowSetImpl
10:54:00,424 ERROR [stderr] (default task-1)    at api.jarone.com.pojo.TestJarOneDetails.getOperatorInfo(TestJarOneDetails.java:12)
10:54:00,425 ERROR [stderr] (default task-1)    at client.test.ejb.session.ClientTestHelperBean.getValueByParamName(ClientTestHelperBean.java:46)
10:54:00,425 ERROR [stderr] (default task-1)    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
10:54:00,425 ERROR [stderr] (default task-1)    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
10:54:00,440 ERROR [stderr] (default task-1) Caused by: java.lang.ClassNotFoundException: com.sun.rowset.CachedRowSetImpl from [Module "jaroneapi:main" from local module loader @707f7052 (finder: local module finder @11028347 (roots: /wildfly-9.0.2.Final/modules,/wildfly-9.0.2.Final/modules/system/layers/base))]
10:54:00,441 ERROR [stderr] (default task-1)    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205)
10:54:00,441 ERROR [stderr] (default task-1)    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455)
10:54:00,441 ERROR [stderr] (default task-1)    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404)
10:54:00,441 ERROR [stderr] (default task-1)    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:385)

搜索后,我做了以下两个步骤
1.在modules/com/sun/rowset/main下创建了一个module.xml,其中包含

<?xml version="1.0" encoding="UTF-8"?>  
<module xmlns="urn:jboss:module:1.1" name="com.sun.rowset">  
    <dependencies>  
        <system export="true">  
            <paths>  
                <path name="com/sun/rowset"/>  
            </paths>  
        </system>  
    </dependencies>  
</module>

2.修改模块jaroneapi如下
模块add--name=jaroneapi--resources=~/downloads/jaroneapi.jar--dependencies=com.sun.rowset
但仍发生以下错误。

11:10:44,543 ERROR [stderr] (default task-1) javax.sql.rowset.spi.SyncFactoryException: Resource javax/sql/rowset/rowset.properties not found
11:10:44,549 ERROR [stderr] (default task-1)    at javax.sql.rowset.spi.SyncFactory.lambda$initMapIfNecessary$79(SyncFactory.java:393)
11:10:44,550 ERROR [stderr] (default task-1)    at java.security.AccessController.doPrivileged(Native Method)
11:10:44,551 ERROR [stderr] (default task-1)    at javax.sql.rowset.spi.SyncFactory.initMapIfNecessary(SyncFactory.java:388)
11:10:44,552 ERROR [stderr] (default task-1)    at javax.sql.rowset.spi.SyncFactory.getInstance(SyncFactory.java:557)

为什么会发生此错误?有什么我遗漏的或一些模块,我需要包括在这里?任何建议都将不胜感激。

l7mqbcuq

l7mqbcuq1#

将此依赖项添加到您的 pom.xml ```

javax.sql
rowset
1.0.1

相关问题