2

MavenベースのGWT-Applicationがあります。

Maven を介して JBoss AS 7.1.1 にコンパイル、ビルド、デプロイすると、GWT-RPC-Service で ClassNotFoundException が発生します。含める前に、デプロイしてGWTウィジェットを表示できたので、GWT-Jarsがそこにあるはずです...

私の Maven 依存関係は次のようになります。

<dependency>
  <groupId>com.google.gwt</groupId>
  <artifactId>gwt-dev</artifactId>
  <version>2.5.0</version>
  <scope>compile</scope>
</dependency>
<dependency>
  <groupId>com.google.gwt</groupId>
  <artifactId>gwt-user</artifactId>
  <version>2.5.0</version>
  <scope>compile</scope>
</dependency>
<dependency>
  <groupId>com.google.gwt</groupId>
  <artifactId>gwt-servlet</artifactId>
  <version>2.5.0</version>
  <scope>compile</scope>
</dependency>

私のEARは次のようになります。

-myEar.ear
|  |
|  |- core.jar
|
|--|- gwt-ui.war
|  |
|  |-- gwt-ui
|  |   |--  gwt
|  |   |--  sc
|  |   |--  wgt-ui.nocache.js
|  |
|  |-- META-INF
|  |   | (is Empty)
|  |
|  |-- WEB-INF
|  |   |-- classes
|  |   |     |
|  |   |     |- mygwtProj.client
|  |   |     |   |- services
|  |   |     |   |   | - MyService.class
|  |   |     |   |   | - MyServiceAsync.class
|  |   |     |   |- dto
|  |   |     |   |   | - DTO.class
|  |   |     |
|  |   |     |- mygwtProj.server
|  |   |     |   |- MyServiceImpl.class
|  |   |-- deploy
|  |   |-- lib
|  |   |     | (all gwt-jars-files)
|  |   |-- beans.xml
|  |   |-- web.xml

マイサービス:

import java.util.List;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import mygwtProj.client.dto.DTO;

@RemoteServiceRelativePath("myService")
public interface ShopService extends RemoteService{
    List<DTO> getAircrafts();
}

MyServiceAsync

import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
import mygwtProj.client.dto.DTO;

@RemoteServiceRelativePath("myService")
public interface ShopService extends RemoteService{
    void getAircrafts(AsyncCallback<List<DTO>> callback); 
}

MyServiceImpl

import java.util.ArrayList;
import java.util.List;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import mygwtProj.client.dto.DTO;
import mygwtProj.client.services.MyService;

public class MyServiceImpl extends RemoteServiceServlet implements MyService {
    private static final long serialVersionUID = 1L;

@Override
public List<DTO> getAircrafts() {

    List<DTO> list = new ArrayList<DTO>(1);
    list.add(new ShopItemDTO(1, "man", "typ", 1.0));
    return list;
}
}

スタックトレース:

15:28:24,684 WARN  [org.jboss.modules] (MSC service thread 1-6) Failed to define class mygwtProj.server.MyServiceImpl in Module "deployment.myEar.ear.gwt-UI.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link mygwtProj/server/MyServiceImpl (Module "deployment.myEar.ear.gwt-UI.war:main" from Service Module Loader)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)
at org.jboss.modules.Module.loadModuleClass(Module.java:517)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
at org.jboss.as.weld.WeldModuleResourceLoader.classForName(WeldModuleResourceLoader.java:68) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.weld.bootstrap.BeanDeployer.loadClass(BeanDeployer.java:107) [weld-core-1.1.5.AS71.Final.jar:2012-10-12 10:00]
at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:77) [weld-core-1.1.5.AS71.Final.jar:2012-10-12 10:00]
at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:135) [weld-core-1.1.5.AS71.Final.jar:2012-10-12 10:00]
at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:184) [weld-core-1.1.5.AS71.Final.jar:2012-10-12 10:00]
at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:349) [weld-core-1.1.5.AS71.Final.jar:2012-10-12 10:00]
at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:82) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.weld.services.WeldService.start(WeldService.java:76) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_03]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_03]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_03]
Caused by: java.lang.NoClassDefFoundError: myProj/client/services/MyService
at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_03]
at java.lang.ClassLoader.defineClass(ClassLoader.java:791) [rt.jar:1.7.0_03]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) [rt.jar:1.7.0_03]
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391)
... 21 more
Caused by: java.lang.ClassNotFoundException: myProj.client.services.MyService from [Module "deployment.myEar.ear.gwt-UI.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
... 26 more

15:28:24,700 INFO  [org.jboss.weld.ClassLoading] (MSC service thread 1-6) WELD-000119 Not generating any bean definitions from myProj.server.MyServiceImpl because of underlying class loading error
15:28:24,700 INFO  [org.jboss.weld.ClassLoading] (MSC service thread 1-6) catching: org.jboss.weld.resources.spi.ResourceLoadingException: java.lang.ClassNotFoundException: myProj.server.MyServiceImpl from [Module "deployment.myEar.ear.gwt-UI.war:main" from Service Module Loader]
at org.jboss.as.weld.WeldModuleResourceLoader.classForName(WeldModuleResourceLoader.java:74) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.weld.bootstrap.BeanDeployer.loadClass(BeanDeployer.java:107) [weld-core-1.1.5.AS71.Final.jar:2012-10-12 10:00]
at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:77) [weld-core-1.1.5.AS71.Final.jar:2012-10-12 10:00]
at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:135) [weld-core-1.1.5.AS71.Final.jar:2012-10-12 10:00]
at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:184) [weld-core-1.1.5.AS71.Final.jar:2012-10-12 10:00]
at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:349) [weld-core-1.1.5.AS71.Final.jar:2012-10-12 10:00]
at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:82) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.weld.services.WeldService.start(WeldService.java:76) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_03]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_03]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_03]
Caused by: java.lang.ClassNotFoundException: myProj.server.MyServiceImpl from [Module "deployment.myEar.ear.gwt-UI.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
at org.jboss.as.weld.WeldModuleResourceLoader.classForName(WeldModuleResourceLoader.java:68) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]
... 12 more

何が問題なのか手がかりはありますか?

4

1 に答える 1

1

ご意見ありがとうございます。私は今、問題を理解しています。

愚かな間違いでした。Maven 構成では、client-Package 内のすべてのクラスは JS にコンパイルされるため、パッケージに含めないように設定しました。これには私の Service-Interface が含まれていました...それを新しい Package shared に移動し、それを gwt.xml に含めました。

また、gwt-user と gwt-dev を提供された Maven スコープに変更し、gwt-servlet をランタイムに変更しました。

この構成で動作します:-)

于 2012-11-30T17:57:01.053 に答える