2
votes

I am working on a project with seperated modules . backend for admins , client for users and core for share DAO layer amongs backend and client.
backend module uses GWT and client uses Spring MVC. At backend module , core module was included by deployment assembly. My server side , DAOs are injected by Spring.
All beans(POJOs) created in core module. My problem is I would like to use these beans from core module in my gwt project (backend module) or when using RPC calls.
I tried as answers of How can share bean from external library to GWT client? question but didn't satisfy yet. I got below error

No source code is available for type com.mycom.core.business.bean.TestBean; [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

Here is my efforted codes ...

TestBean.java

public class TestBean {
private int id;

public final int getId() {
    return id;
}

public final void setId(int id) {
    this.id = id;
}
}

beans.gwt.xml

<?xml version="1.0" encoding="UTF-8"?>
<module>
   <inherits name='com.google.gwt.user.User'/>
   <source path="com.mycom.core.business.bean.TestBean"/>
</module>

Inherit beans.gwt.xml in my App.gwt.xml as <inherits name='com.mycom.backend.beans'/> . What am I missing ?

Edit: Add sample project file

Now I created and uploaded sample modules. You can download it from google-drive URL.This archive file contains both backend and core modules.

  • core module was created as simple java project from Eclipse IDE.

  • backend module was created by gwt-ecliplse plugin (2.7 gwt version and include generated codes) and add Dynamic Web Module 2.5 project faces.

Finally , I build and run with GWT-Eclipse plugin and you can check screen-shoot for

ClassPath

enter image description hereSource LookUp Path

enter image description hereModules

enter image description here Below is error log in my console

Super Dev Mode starting up
workDir: /var/folders/mt/5287l4j94jd9rfqwqdqxr9zw0000gq/T/gwt-codeserver-7296341534601698800.tmp
Loading Java files in com.mycom.backend.App.
Ignored 1 unit with compilation errors in first pass.
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
Finding entry point classes
  Tracing compile failure path for type 'com.mycom.backend.client.Backend'
     [ERROR] Errors in 'file:/Applications/springsource/workspace/backend/src/com/mycom/backend/client/Backend.java'
        [ERROR] Line 41: No source code is available for type com.mycom.core.business.bean.TestBean; did you forget to inherit a required module?
  [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
[WARN] Server class 'com.google.gwt.dev.shell.jetty.JDBCUnloader' could not be found in the web app, but was found on the system classpath
[WARN] Adding classpath entry 'file:/Users/cataclysm/Desktop/eclipse%20(Luna)/Datas/gwt-2.7.0/gwt-dev.jar' to the web app classpath for this session
For additional info see: file:/Users/cataclysm/Desktop/eclipse%20(Luna)/Datas/gwt-2.7.0/doc/helpInfo/webAppClassPath.html
2

2 Answers

2
votes

The source path of your core module should be accessible to the GWT compile process. Make sure that it is added to either the classpath or the source lookup path.

1
votes

The module file for beans should be in the core folder/library. Try moving it to core/src/com/mycom/ and modify the source path accordingly in beans.gwt.xml:

<source path="core"/>

Remember, it is relative to the module file.

Then modify the entry in App.gwt.xml:

<inherits name='com.mycom.beans'/>

I'm not familiar with deployment assembly, but make sure that the beans.gwt.xml is present in the resulting library jar (or is copied along with the sources).