Reputation: 1001
I'm new to GWT and trying to run my fist GWT app. I have classes that uses API from javax.persistence package. When I try to compile the code using GWT compiler it fails for not being able to find the mentioned package in the classpath. I have the libraries added to the class though.
<property name="gwt.sdk" location="C:/gwt-2.4.0" />
<!-- Arguments to gwtc and devmode targets -->
<property name="gwt.args" value="" />
<path id="gwt.class.path">
<fileset dir="${devLib}"> <!-- here is all the dependent libraries-->
<include name="*.jar" />
</fileset>
<pathelement location="${gwt.sdk}/gwt-user.jar"/>
<fileset dir="${gwt.sdk}" includes="gwt-dev*.jar"/>
</path>
<target name="gwtc" description="GWT compile to JavaScript (production mode)">
<echo message="${gwt.class.path}"/>
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<path refid="gwt.class.path"/>
<pathelement location="gwt/project/src"/>
</classpath>
<!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
<jvmarg value="-Xmx256M"/>
<arg line="-war"/>
<arg value="web/five/gwtUI"/>
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg line="${gwt.args}"/>
<arg value="org.scheduling.Scheduling"/>
</java>
</target>
here is the error that I see when run the ant target gwtc. Can someone help me to correct this?
[java] Compiling module org.scheduling.Scheduling
[java] Validating newly compiled units
[java] Ignored 91 units with compilation errors in first pass.
[java] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
[java] Computing all possible rebind results for 'com.google.gwt.user.client.UserAgentAsserter'
[java] Rebinding com.google.gwt.user.client.UserAgentAsserter
[java] Checking rule <generate-with class='com.google.gwt.editor.rebind.SimpleBeanEditorDriverGenerator'/>
[java] [WARN] Detected warnings related to 'com.google.gwt.editor.client.SimpleBeanEditorDriver'. Are validation-api-<version>.jar and validation-api-<version>-sources.jar on the classpath?
[java] Specify -logLevel DEBUG to see all errors.
[java] [WARN] Unknown type 'com.google.gwt.editor.client.SimpleBeanEditorDriver' specified in deferred binding rule
[java] Scanning for additional dependencies: file:/C:/Tolven_skandula/org.component.scheduling/gwt/project/src/org/scheduling/gwt/common/client/SchedulingEntryPoint.java
[java] Computing all possible rebind results for 'org.scheduling.common.service.SchedulingService'
[java] Rebinding org.scheduling.common.service.SchedulingService
[java] Checking rule <generate-with class='com.google.gwt.user.rebind.rpc.ServiceInterfaceProxyGenerator'/>
[java] [ERROR] Errors in 'file:/C:/Tolven_skandula/org.component.scheduling/gwt/project/src/org/scheduling/common/model/Appointment.java'
[java] [ERROR] Line 5: The import javax.persistence cannot be resolved
[java] [ERROR] Line 6: The import javax.persistence cannot be resolved
[java] [ERROR] Line 7: The import javax.persistence cannot be resolved
[java] [ERROR] Line 8: The import javax.persistence cannot be resolved
[java] [ERROR] Line 9: The import javax.persistence cannot be resolved
Upvotes: 2
Views: 3217
Reputation: 394
I have run into this issue using GWT 2.6.0. Rollbacking to GWT 2.5.1 solved it for me.
It's quite a wierd behaviour, as Java should treat annotations as mandatory. Not having sources should result in ignoring annotations, so annotations do not become tight coupling.
Upvotes: 0
Reputation: 71
I had same problem. I've downloaded: javamail from: http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-eeplat-419426.html#javamail-1.4.7-oth-JPR
and I've added : mailapi.jar to mu buildpath and GWT found javax.mail.*.
Good luck; Anna
Upvotes: 0
Reputation: 80340
Ahhh yes, an old problem: your domain classes annotated with JPA annotations can not be used by GWT. You probably need to send those objects via RPC?
People have been solving this for some time - google around:
GWT + entities + JPA + DTO + Dozer
http://objectgeneration.com/eclipse/16-GWT.html
http://uptick.com.au/content/transferring-jpa-objects-server-browser
Upvotes: 0
Reputation: 1509
Have a look at http://code.google.com/intl/de-DE/webtoolkit/doc/latest/RefJreEmulation.html, which describes the classes from the standard JRE GWT is emulating. javax.persistence doesn't seem to be supported.
That's the thing with gwt. Only a small subset of the standard JRE is supported (given by the fact that JavaScript will never have the same functionality, as it runs in a browser environment). Also, whilst the google guys are trying to integrate more and more classes, they are only that fast.
But you can always create your own classes and libraries.
Upvotes: 2