由于升级到Java 1.8而在GGTS(eclipse)中运行grails应用程序时遇到一些问题.
堆栈以:
Mar 05, 2015 3:51:31 PM org.springsource.loaded.jvm.JVM copyMethod
SEVERE: Problems copying method. Incompatible JVM?
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor91.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springsource.loaded.jvm.JVM.copyMethod(JVM.java:134)
at org.springsource.loaded.ri.OriginalClassInvoker.createJavaMethod(OriginalClassInvoker.java:68)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlClassGetDeclaredMethods(ReflectiveInterceptor.java:151)
at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:84)
at java.security.AccessController.doPrivileged(Native Method)
at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:81)
...
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270)
at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:236)
at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:264)
Caused by: java.lang.IllegalArgumentException: Can not copy a non-root Method
at java.lang.reflect.Method.copy(Method.java:151)
... 280 more
Run Code Online (Sandbox Code Playgroud)
我曾经在Java 1.7中运行相同的应用程序.我的同事升级到1.8,不再能够运行它.
我使用SUN JDK进行了测试,现在我再次使用OpenJDK,这对当前JDK openjdk版本"1.8.0_40"没有帮助
JAVA_HOME,JAVA_PATH和任何其他变量似乎都指向正确的JDK安装.我已经删除了所有以前的(从操作系统JDK 1.6和1.7,以确保没有引用它们).
出于某种原因,GGTS仍然抱怨错误的JVM.我理解错误可能与编译器1.7尝试编译1.8中的文件有关,但我不确定这个引用在eclipse中的来源.
我的Eclipse安装信息在Java下列出了以下内容:
-vm
/usr/lib64/jvm/jre-1.8.0-openjdk/bin/java
eclipse.home.location=file:/home/arb/dev/applications/ggts-3.6.3.SR1/
eclipse.launcher=/home/arb/dev/applications/ggts-3.6.3.SR1/GGTS
eclipse.launcher.name=GGTS
eclipse.p2.data.area=@config.dir/../p2
eclipse.p2.profile=DefaultProfile
eclipse.product=org.springsource.ggts.ide
eclipse.startTime=1425566898624
eclipse.stateSaveDelayInterval=30000 …
Run Code Online (Sandbox Code Playgroud) 我想使用bootstrap-fileupload.js(http://jasny.github.com/bootstrap/javascript.html#fileupload),但我对事件触发器感到困惑.
一旦选择了媒体资产,如何触发将图像发送到Web脚本(例如php)的事件?
可能不重要,但Grails中的IntelliJ重载选项有问题吗?
从IntelliJ Run App集启动应用程序
Reloading active: false
我尝试通过控制台(powershwell)清理并重新启动应用程序.重新加载是真实的并按预期设置.
运行IntelliJ 14.1.1/Grails 3.0.1/JDK 1.8.025
我想知道通过ZF2中的ServiceManager启动和重用logger实例的最佳方法是什么.当然,我可以在任何类中使用一种简单的方法,例如:
public function getLogger () {
$this->logger = new Logger();
$this->logger->addWriter(new Writer\Stream('/log/cms_errors.log'));
return $logger;
}
Run Code Online (Sandbox Code Playgroud)
但我想知道在global.php中注册类似结构的最佳方法是什么.到目前为止,我可以
将以下内容添加到global.php中
'Zend\Log'=>array(
'timestampFormat' => 'Y-m-d',
array(
'writerName' => 'Stream',
'writerParams' => array(
'stream' => '/log/zend.log',
),
'formatterName' => 'Simple',
),
),
Run Code Online (Sandbox Code Playgroud)
如果我尝试通过以下方式调用它:
$this->getServiceLocator()->get('Zend\Log')
Run Code Online (Sandbox Code Playgroud)
我得到一个:
Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for Zend\Log
Run Code Online (Sandbox Code Playgroud) Grails上有一些ENUM的例子(这里也是SO),但我无法得到理想的结果.
解决方案包括1)将ENUM放在src/groovy 域类下的单独 类中
class Offer {
PaymentMethod acceptedPaymentMethod
..
}
Run Code Online (Sandbox Code Playgroud)
src/groovy PaymentMethod
public enum PaymentMethod {
BYBANKTRANSFERINADVANCE('BANKADVANCE'),
BYINVOICE('ByInvoice'),
CASH('Cash'),
CHECKINADVANCE('CheckInAdvance'),
PAYPAL('PayPal'),
String id
PaymentMethod(String id) {
this.id = id
}
}
Run Code Online (Sandbox Code Playgroud)
在这种情况下,在发出错误的域类中根本不识别Enum类.看起来这个曾经在版本2之前用于Grails.
我在这里错过了什么吗?如何在Grails的域中使用外部ENUM类?
2)将ENUM放在域类中.
在这种情况下,grails在编译时不会抱怨,但是脚手架不包含ENUM值的任何信息(就像在scaffolding过程中不包含属性acceptedPaymentMethod)示例:
class Offer {
PaymentMethod acceptedPaymentMethod
..
enum PaymentMethod {
BYBANKTRANSFERINADVANCE('BANKADVANCE'),
BYINVOICE('ByInvoice'),
CASH('Cash'),
CHECKINADVANCE('CheckInAdvance'),
PAYPAL('PayPal'),
String id
PaymentMethod(String id) {
this.id = id
}
}
}
Run Code Online (Sandbox Code Playgroud)
检查数据库表的结构,该字段不是ENUM而是简单的VarChar:
| accepted_payment_method | varchar(255) | YES | | NULL | |
Run Code Online (Sandbox Code Playgroud)
是否支持Grails Gorm上的ENUM?
在 IntelliJ 运行控制台(Windows)上查看日志颜色时遇到问题。
我在Crucible和Git commit方面遇到问题。坩埚挂在上面
>git whatchanged --always --reverse --date-order -m --no-abbrev --no-renames 9e00d1317c4363f73b7deb5caf5096c69e646b81..641c20936dbec78308d1bfa06d14f174f9d7df1d --pretty=format:C:%H%nP:%P%nA:%aN%nE:%aE%nR:%cN%nF:%cE%nD:%at%nS:%s%nB:%b%n@@fe_body_end@@
Run Code Online (Sandbox Code Playgroud)
与错误:
fatal: Invalid revision range 9e00d1317c4363f73b7deb5caf5096c69e646b81..641c20936dbec78308d1bfa06d14f174f9d7df1d
Run Code Online (Sandbox Code Playgroud)
显然在
>git show 641c20936dbec78308d1bfa06d14f174f9d7df1d
fatal: bad object 641c20936dbec78308d1bfa06d14f174f9d7df1d
Run Code Online (Sandbox Code Playgroud)
解决此类问题的最佳方法是什么?Git fsck不会导致任何错误...
git fsck --full检查对象目录:100%(256/256),完成。检查对象:已完成100%(21169/21169)。悬空提交50062154743dbc78837af62cc49388f9fabe5b58悬空blob 4b82dcbd1bb49f865e5069f31d50cd9304e31c3e
请检查更新,因为他们有其他信息...显然在特定的pdf客户端找到问题,但不能以开放的赏金关闭问题...
我正在使用grails渲染插件生成pdf .PDF里面有几张图片,其中"有些"没有被输出!
我根据插件的要求通过数据uris内联渲染图像.这意味着我的所有图像都是这样的:
<img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQECWAJYAAD...">
Run Code Online (Sandbox Code Playgroud)
如果我在普通的html视图中渲染它们,我可以看到图像就好了!如果我使用相同的插件将模板渲染到JPG/PNG,那么图像再次渲染都很好.
如果我渲染为PDF,那么被octed-stream检索的图像就会被破坏!
就像是:
看起来图像开始渲染然后发生了一些事情......
它发生在大尺寸图像上,也发生在同一图像的缩略图版本上.
任何人都有一些提示,为什么会出现这种情况?
UPDATE
没有显示的文件是带有mime application/octet-stream的文件 所以显然我可以从文件中检索字节,但是当它们为PDF渲染传输时,图像不会出现......
又一次更新 该问题似乎与PDF查看器有关.使用基于Linux的PDF查看器(PDF Viewer 0.1.8)并且特定图像被破坏.在所有其他PDF查看器中,我可以测试一切正常.无法解决问题,因为有一个赏金开放:(对不起,赏金和问题现在似乎毫无意义,但你永远不知道,有人可能知道如何解决这个问题,即使对于PDF Viewer 0.1.8.
我有一个有一堆常量字符串的类.
我需要通过反射加载这个类并检索这些常量.我可以起床:
controllerClass = Class.forName(constantsClassName);
Object someclass = controllerClass.newInstance();
Run Code Online (Sandbox Code Playgroud)
但我对如何检索这个类中的字段感到困惑.
一切都在1.9.6正常工作.我改为1.10,现在基本上每个应用程序资源都有很多警告.
看起来ZF正在我设置的"自定义资源"路径中寻找应用程序资源:pluginpaths.App_Application_Resource ="应用程序/应用程序/资源.有什么方法可以避免这种情况!"(提前感谢您的支持时间)
application.ini:
resources.locale.default = sq_AL
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
resources.frontController.throwExceptions = 0
; VIEW & HTML Markup Options
resources.view.doctype = "HTML5"
resources.view.language = "en"
resources.view.setSeparator=" - "
resources.view.helperPath.View_Helper = APPLICATION_PATH "/views/helpers"
resources.view[] =
; custom resources
**pluginpaths.App_Application_Resource = "App/Application/Resource"**
Run Code Online (Sandbox Code Playgroud)
在库/ App/Application/Resource/Cache我有一个类"App_Application_Resource_Cache扩展Zend_Application_Resource_ResourceAbstract",我需要缓存.问题是,现在在第一页我有很多警告,如:
Warning: is_readable() [function.is-readable]: open_basedir restriction in effect. File(/usr/share/php/App/Application/Resource/Locale.php) is not within the allowed path(s): (/var/home//httpdocs:/tmp:/var/home/) in /var/home//library/Zend/Loader.php on line 190
Warning: is_readable() [function.is-readable]: open_basedir restriction in effect. File(/usr/lib64/php/modules/App/Application/Resource/Locale.php) is not within the allowed …
Run Code Online (Sandbox Code Playgroud) 尝试从Grails中的另一个视图渲染视图.
<g:render contextPath="??" template="first_view" />
Run Code Online (Sandbox Code Playgroud)
我在index.gsp并且愿意渲染在特定控制器下找到的视图(例如:user/first_view.gsp).我理解视图的正确路径应该在文档中所述的"contextPath"中设置:http://grails.org/doc/latest/ref/Tags/render.html
应用程序视图的contextPath是什么?
尝试使用来自http://grails.org/plugin/jquery-ui的Jquery-UI插件, 但是当讨论使用带有资源框架的插件时,显然文档是不正确的,因为下面的说明会导致错误:
Error processing GroovyPageView: Error executing tag <r:layoutResources>: No module found with name [jquery-ui]
Run Code Online (Sandbox Code Playgroud)
显然,同样的问题是众所周知的,但是无法在网上找到解决方案(例如:此处的一些讨论以及其他一些没有解决方案的解决方案或提示解决方案).
有没有人设法用资源框架成功配置grails中的jquery-ui?