java 应用程序不使用gwt-servlet

aamkag61  于 2023-05-21  发布在  Java
关注(0)|答案(1)|浏览(159)

我做的一切都像在教程中,但由于某种原因,仍然有一个错误,在组装。
GwtRpcService.java:

@RemoteServiceRelativePath("gwtRpcService")
public interface GwtRpcService extends RemoteService {
    BaseRpcResult sendToPrint(EntityProxy model);
}

GwtRpcServiceAsync.java:

public interface GwtRpcServiceAsync {
    void sendToPrint(EntityProxy data, AsyncCallback<BaseRpcResult> async);
}

GwtRpcServiceImpl.java:

@Service
public class GwtRpcServiceImpl extends RemoteServiceServlet implements GwtRpcService {
    @Autowired
    private PrintService printService;

    @Override
    public BaseRpcResult sendToPrint(EntityProxy entityProxy) throws IllegalArgumentException {
        // some...
    }
}

GWT日志构建:

[ERROR] Line 38: No source code is available for type <project_path>.gwt.server.GwtRpcServiceImpl; did you forget to inherit a required module?
[ERROR] Unable to find type '<project_path>.gwt.client.AppBundle'
[ERROR] Hint: Previous compiler errors may have made this type unavailable
[ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly

请帮我解决这个问题。
我以为问题是没有库或者servlet声明不正确,但一切似乎都很好。
Main.gwt.xml:

<module rename-to="gwt">

    <source path='client'/>
    <source path='shared'/>

    <inherits name='com.google.gwt.user.User'/>
    <inherits name='com.google.gwt.logging.Logging'/>
    <inherits name="com.google.gwt.uibinder.UiBinder"/>
    <inherits name="com.google.web.bindery.requestfactory.RequestFactory"/>
    <inherits name="org.hibernate.validator.HibernateValidator" />

web.xml:

<servlet>
        <servlet-name>gwtRpcService</servlet-name>
        <servlet-class> <project_path>.gwt.server.GwtRpcServiceImpl </servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>gwtRpcService</servlet-name>
        <url-pattern>/main/gwtRpc</url-pattern>
    </servlet-mapping>

pom.xml:

<dependency>
     <groupId>com.google.gwt</groupId>
     <artifactId>gwt-servlet</artifactId>
     <version>${com.google.gwt.version}</version> // 2.6.1 version
</dependency>
8yoxcaq7

8yoxcaq71#

在创建rpc示例时使用Async接口,在通过GWT创建时使用默认接口

public static final GwtRpcServiceAsync GWT_RPC_SERVICE = GWT.create(GwtRpcService.class);

相关问题