首页 \ 问答 \ gwt编译期间的GWT验证错误 - 没有可用的源代码(GWT validation error during gwt compile - No source code available)

gwt编译期间的GWT验证错误 - 没有可用的源代码(GWT validation error during gwt compile - No source code available)

我正在尝试使用hibernate验证器进行gwt验证。 我已按照http://code.google.com/p/google-web-toolkit/wiki/BeanValidation中的步骤操作,并根据http://code.google.com/p/上的示例验证项目配置了我的项目谷歌的web的工具包/源/浏览/中继/样品/验证/

我的.gwt.xml文件包含:

<inherits name="org.hibernate.validator.HibernateValidator" />

和我的自定义验证工厂:

<replace-with class="my.package.here.client.validation.ValidatorFactory">
<when-type-is class="javax.validation.ValidatorFactory" />
</replace-with>     

验证在开发模式下在客户端和服务器端都很完美,但在尝试gwt编译时,我得到:

gwtc-production:
     [java] Compiling module my.package.MyModule
     [java]    Validating newly compiled units
     [java]       [ERROR] Errors in 'jar:file:/hibernate-validator-4.2.0.Final-sources.jar!/org/hibernate/validator/constraints/impl/FutureValidatorForReadableInstant.java'
     [java]          [ERROR] Line 32: No source code is available for type org.joda.time.ReadableInstant; did you forget to inherit a required module?
     [java]       [ERROR] Errors in 'jar:file:/hibernate-validator-4.2.0.Final-sources.jar!/org/hibernate/validator/constraints/impl/FutureValidatorForReadablePartial.java'
     [java]          [ERROR] Line 32: No source code is available for type org.joda.time.ReadablePartial; did you forget to inherit a required module?
     [java]       [ERROR] Errors in 'jar:file:/hibernate-validator-4.2.0.Final-sources.jar!/org/hibernate/validator/constraints/impl/PastValidatorForReadableInstant.java'
     [java]       [ERROR] Errors in 'jar:file:/hibernate-validator-4.2.0.Final-sources.jar!/org/hibernate/validator/constraints/impl/SafeHtmlValidator.java'
     [java]          [ERROR] Line 22: The import org.jsoup cannot be resolved
     [java]          [ERROR] Line 23: The import org.jsoup cannot be resolved
     [java]          [ERROR] Line 35: Whitelist cannot be resolved to a type
     [java]          [ERROR] Line 40: Whitelist cannot be resolved to a type
     [java]          [ERROR] Line 40: Whitelist cannot be resolved
     [java]          [ERROR] Line 43: Whitelist cannot be resolved to a type
     [java]          [ERROR] Line 43: Whitelist cannot be resolved
     [java]          [ERROR] Line 46: Whitelist cannot be resolved to a type
     [java]          [ERROR] Line 46: Whitelist cannot be resolved
     [java]          [ERROR] Line 49: Whitelist cannot be resolved to a type
     [java]          [ERROR] Line 49: Whitelist cannot be resolved
     [java]          [ERROR] Line 52: Whitelist cannot be resolved to a type
     [java]          [ERROR] Line 52: Whitelist cannot be resolved
     [java]          [ERROR] Line 55: Whitelist cannot be resolved to a type
     [java]          [ERROR] Line 62: Jsoup cannot be resolved
     [java]          [ERROR] Line 62: Whitelist cannot be resolved to a type
     [java]       [ERROR] Errors in 'jar:file:gwt-user.jar!/org/hibernate/validator/super/org/hibernate/validator/engine/PathImpl.java'
     [java]          [ERROR] Line 72: The constructor NodeImpl(String) is undefined
     [java]          [ERROR] Line 84: The constructor NodeImpl(Path.Node) is undefined
     [java]          [ERROR] Line 95: The constructor NodeImpl(Path.Node) is undefined
     [java]          [ERROR] Line 202: The constructor NodeImpl(String) is undefined
     [java]          [ERROR] Line 204: The method setInIterable(boolean) is undefined for the type NodeImpl
     [java]          [ERROR] Line 209: The method setIndex(Integer) is undefined for the type NodeImpl
     [java]          [ERROR] Line 212: The method setKey(String) is undefined for the type NodeImpl
     [java]    [ERROR] Aborting compile due to errors in some input files

显然有一些我不见的源jar。 我(在其他方面)我的类路径:

hibernate-validator-4.2.0.Final.jar
hibernate-validator-4.2.0.Final-sources.jar

我也尝试过添加joda-time-2.1.jarjoda-time-2.1-sources.jarjsoup-1.6.3.jarjsoup-1.6.3-sources.jar

不应该继承org.hibernate.validator.HibernateValidator来处理超级源代码所以我不需要提供源代码吗? 任何人都能看到我错过的东西吗?


I am trying to get gwt validation working using the hibernate validator. I have followed the steps from http://code.google.com/p/google-web-toolkit/wiki/BeanValidation and configured my project according to the sample validation project at http://code.google.com/p/google-web-toolkit/source/browse/trunk/samples/validation/

My .gwt.xml file contains:

<inherits name="org.hibernate.validator.HibernateValidator" />

and my custom validation factory:

<replace-with class="my.package.here.client.validation.ValidatorFactory">
<when-type-is class="javax.validation.ValidatorFactory" />
</replace-with>     

Validation works perfect both on client and server side in dev mode, but when trying to gwt compile I get:

gwtc-production:
     [java] Compiling module my.package.MyModule
     [java]    Validating newly compiled units
     [java]       [ERROR] Errors in 'jar:file:/hibernate-validator-4.2.0.Final-sources.jar!/org/hibernate/validator/constraints/impl/FutureValidatorForReadableInstant.java'
     [java]          [ERROR] Line 32: No source code is available for type org.joda.time.ReadableInstant; did you forget to inherit a required module?
     [java]       [ERROR] Errors in 'jar:file:/hibernate-validator-4.2.0.Final-sources.jar!/org/hibernate/validator/constraints/impl/FutureValidatorForReadablePartial.java'
     [java]          [ERROR] Line 32: No source code is available for type org.joda.time.ReadablePartial; did you forget to inherit a required module?
     [java]       [ERROR] Errors in 'jar:file:/hibernate-validator-4.2.0.Final-sources.jar!/org/hibernate/validator/constraints/impl/PastValidatorForReadableInstant.java'
     [java]       [ERROR] Errors in 'jar:file:/hibernate-validator-4.2.0.Final-sources.jar!/org/hibernate/validator/constraints/impl/SafeHtmlValidator.java'
     [java]          [ERROR] Line 22: The import org.jsoup cannot be resolved
     [java]          [ERROR] Line 23: The import org.jsoup cannot be resolved
     [java]          [ERROR] Line 35: Whitelist cannot be resolved to a type
     [java]          [ERROR] Line 40: Whitelist cannot be resolved to a type
     [java]          [ERROR] Line 40: Whitelist cannot be resolved
     [java]          [ERROR] Line 43: Whitelist cannot be resolved to a type
     [java]          [ERROR] Line 43: Whitelist cannot be resolved
     [java]          [ERROR] Line 46: Whitelist cannot be resolved to a type
     [java]          [ERROR] Line 46: Whitelist cannot be resolved
     [java]          [ERROR] Line 49: Whitelist cannot be resolved to a type
     [java]          [ERROR] Line 49: Whitelist cannot be resolved
     [java]          [ERROR] Line 52: Whitelist cannot be resolved to a type
     [java]          [ERROR] Line 52: Whitelist cannot be resolved
     [java]          [ERROR] Line 55: Whitelist cannot be resolved to a type
     [java]          [ERROR] Line 62: Jsoup cannot be resolved
     [java]          [ERROR] Line 62: Whitelist cannot be resolved to a type
     [java]       [ERROR] Errors in 'jar:file:gwt-user.jar!/org/hibernate/validator/super/org/hibernate/validator/engine/PathImpl.java'
     [java]          [ERROR] Line 72: The constructor NodeImpl(String) is undefined
     [java]          [ERROR] Line 84: The constructor NodeImpl(Path.Node) is undefined
     [java]          [ERROR] Line 95: The constructor NodeImpl(Path.Node) is undefined
     [java]          [ERROR] Line 202: The constructor NodeImpl(String) is undefined
     [java]          [ERROR] Line 204: The method setInIterable(boolean) is undefined for the type NodeImpl
     [java]          [ERROR] Line 209: The method setIndex(Integer) is undefined for the type NodeImpl
     [java]          [ERROR] Line 212: The method setKey(String) is undefined for the type NodeImpl
     [java]    [ERROR] Aborting compile due to errors in some input files

There is obviously some source jar I'm missing. I have (among others) on my classpath:

hibernate-validator-4.2.0.Final.jar
hibernate-validator-4.2.0.Final-sources.jar

I have also tried adding joda-time-2.1.jar, joda-time-2.1-sources.jar, jsoup-1.6.3.jar and jsoup-1.6.3-sources.jar.

Shouldn't inheriting the org.hibernate.validator.HibernateValidator take care of the super sources so I don't need to provide the sources? Can anyone see what I'm missing?


原文:https://stackoverflow.com/questions/12385785
更新时间:2023-10-30 12:10

最满意答案

我认为你需要定义一个文本限定符,这在fgetcsv中称为enclosure。 例如:

$values = fgetcsv($f,8098,'"'); 
// the last part is: singlequote doublequote singlequote,
// you could also use an escape "\"" 

这是告诉解析器它不应该在文本区域内使用逗号。

你应该能够做到:

$values[0] == '"Total"'

更新:

您奇怪地打开文件的问题,可能与文件编码有关,通过创建一个新文件,您使用新的编码创建它可能是原始文件不是ANSI / UTF-8 / Unicode,然后在那里复制内容,所以现在它以那种格式保存了。我不知道为什么这会给你遇到的问题,但我假设解析器不知何故无法处理错误的编码。

尝试打开记事本并注意当你点击另存为时,你可以在按钮中选择编码,尝试使用不同编码的几个不同文件,如果你想确保它是吗?


I think you need to define a text qualifier, this is called enclosure in fgetcsv. eg:

$values = fgetcsv($f,8098,'"'); 
// the last part is: singlequote doublequote singlequote,
// you could also use an escape "\"" 

This is to tell the parser that it shouldn't take the comma inside the text area.

You should be able to do:

$values[0] == '"Total"'

UPDATE:

You problem with the file opening oddly, is probably related to the files encoding, by creating a new file, you created it with a new encoding maybe ANSI/UTF-8/Unicode something the original file wasnt, and then copied the content in there, so now it was saved in that format instead.. im not sure why this would give you the problems you are experiencing, but im assume the parser somehow cant handle the wrong encoding.

try opening notepad and notice when you click save as, you can choose encoding in the buttom, try with a few different files with different encoding if you want to make sure that was it?

相关问答

更多

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)