我是GWT的新手并试图运行我的第一个GWT应用程序。我有使用javax.persistence包中的API的类。当我尝试使用GWT编译器编译代码时,它无法在类路径中找不到提到的包。我虽然已将这些库添加到课程中。
<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>
这是我在运行ant target gwtc时看到的错误。有人可以帮我纠正这个吗?
[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
答案 0 :(得分:2)
查看http://code.google.com/intl/de-DE/webtoolkit/doc/latest/RefJreEmulation.html,其中描述了标准JRE GWT正在模拟的类。似乎不支持javax.persistence。
这就是gwt。仅支持标准JRE的一小部分(由于JavaScript在浏览器环境中运行时将永远不会具有相同的功能)。此外,虽然谷歌家伙正试图整合越来越多的课程,但他们只是那么快。
但是你总是可以创建自己的类和库。
答案 1 :(得分:0)
啊,是的,一个老问题:GWT注释不能使用JPA注释注释的域类。您可能需要通过RPC发送这些对象?
人们已经解决了一段时间 - 谷歌周围:
GWT + entities + JPA + DTO + Dozer
http://objectgeneration.com/eclipse/16-GWT.html
http://uptick.com.au/content/transferring-jpa-objects-server-browser
答案 2 :(得分:0)
我有同样的问题。我已下载:javamail来自: http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-eeplat-419426.html#javamail-1.4.7-oth-JPR
我添加了:mailapi.jar到mu buildpath,GWT找到了javax.mail。*。
祝你好运; 安娜答案 3 :(得分:0)
我使用GWT 2.6.0遇到了这个问题。回滚到 GWT 2.5.1 为我解决了这个问题。
这是一个非常奇怪的行为,因为Java应该将注释视为强制性的。没有源应该导致忽略注释,因此注释不会成为紧密耦合。