2

I am using gwt2.0.3 version in my application.There are two projects in this application.One for client side and other is for server side.In the client side project I have given reference of server side project.So I am able to get all the method and properties of the server side in to the client side.

My all the beans are located at the server side.So while I import beans in the client side then It it not giving any issues.

But at the compile time it is giving issues of referencing.and it is giving issues like below:

[ERROR] Errors in 'file:/E:/NTWrokSpace1June2011/AdminClient/src/com/nextenders/client/util/factory/DocumentMetadataFactory.java'

[ERROR] Line 26: No source code is available for type com.nextenders.facadeimplementation.beans.metadata.Table; did you forget to inherit a required module?

Hello All I am using gwt2.0.3 version in my application.There are two projects in this application.One for client side and other is for server side.In the client side project I have given reference of server side project.So I am able to get all the method and properties of the server side in to the client side.

My all the beans are located at the server side.So while I import beans in the client side then It it not giving any issues.

But at the compile time it is giving issues of referencing.and it is giving issues like below:

[ERROR] Errors in 'file:/E:/NTWrokSpace1June2011/AdminClient/src/com/nextenders/client/util/factory/DocumentMetadataFactory.java'

[ERROR] Line 26: No source code is available for type com.nextenders.facadeimplementation.beans.metadata.Table; did you forget to inherit a required module?

Here AdminClient is my client project.

And com.nextenders.facadeimplementation.beans.metadata package at the server side.And while importing in the class it is not giving nay issues.

But compile time it is giving issues.

Please help me out from this.

Sanjay Jain
  • 3,518
  • 8
  • 59
  • 93
  • I solved the solution by some other trick.So I would like to share it.I made an another gwt project and putted all the beans in that project.Followed this steps Right click project > select properties > Libraries tab > Add other projects then goto Projects tab > Add other project put this in the project.gwt.xml file -> goto debug configurations > project > classpath > user entries > add project then add src folder > goto Advanced > add folder > select src folder – Sanjay Jain Jun 30 '11 at 12:34

4 Answers4

1

The error message indicates that the class

com.nextenders.facadeimplementation.beans.metadata.Table;

references (imports) one or more java classes which cannot be compiled to javascript by the gwt.

daniel.herken
  • 1,095
  • 7
  • 19
  • This issues occurs when I started to compilation.And If I put a jar of bean in client project it works fine.At that time it got reference.I am not getting that eclipse doesn't shoe any issues while import them, But while compiling GWT compiler not able to get the reference of the bean??? – Sanjay Jain Jun 29 '11 at 13:35
  • 2
    No gwt compiler can't simply cross-compile everything from java to javascript there are limitations. For example you can't use any java class in your client when it has an import to java.util.calendar because gwt can't compile java.util.calendar to javascript... – daniel.herken Jun 29 '11 at 13:38
1

The normal way would be to split you project into three packages: server, client and shared.

In client you put GWT code, in server obviously server code. In the shared you put code that belong to both client and server: most notably classes that pass RPC.

You have to tell GWT where your sources are then. You must reference those two in your .gwt.xml (if your gwt.xml file is in folder just above client and shared):

<source path='client'/>
<source path='shared'/>
Peter Knego
  • 79,991
  • 11
  • 123
  • 154
1

I suspect that part of your problem is in your module definition. GWT compiler will look in the source paths you define in your module file to determine which classes to attempt to compile to Javascript. You are likely referencing the Table class from client code, but that bean does not exist in any of the source paths specified in your module xml file.

Having the beans in a separate project may cause issues, but I've not tested it myself. The source paths specified in your module file are relative paths rather than package paths I believe, so it may not work at all.

Brad Gardner
  • 1,627
  • 14
  • 14
  • I also tried by putting a Jar of the bean at the client side, still it is not working.Any work around ?? – Sanjay Jain Jun 29 '11 at 14:02
  • 1
    Best bet is to keep your server and client code in the same project setup as Peter suggested. This allows the Google compiler to crawl the right directories. I don't think it has the ability to selectively crawl into jar files to find client compatible code. – Brad Gardner Jun 29 '11 at 14:30
0

If you use Maven then it will help you.

The maven-gwt-plugin with parameter compileSourcesArtifacts will download -sources.jar and compile GWT module without adding sources to the resulting jar.

Example pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <dependencies>
        <dependency>
            <groupId>com.my.group</groupId>
            <artifactId>my-artifact</artifactId>
            <version>1.0</version>
        </dependency>
    </dependencies>

    <!-- ... -->

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>2.5.0</version>
                <!-- ... -->
                <configuration>
                    <compileSourcesArtifacts>
                        <compileSourcesArtifact>com.my.group:my-artifact</compileSourcesArtifact>
                    </compileSourcesArtifacts>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
Viacheslav Dobromyslov
  • 3,168
  • 1
  • 33
  • 45