早上好,我创建了一个新项目
Grails 2.3.2
Java JDK 1.7.0_45
当我运行命令时:
grails run-app
Run Code Online (Sandbox Code Playgroud)
看到以下错误:
**| Configuring classpath
nov 09, 2013 1:52:27 PM java.util.prefs.WindowsPreferences <init>
| Running Grails application
*** java.lang.instrument ASSERTION FAILED ***: "!errorOutstanding" with message transform method call failed at ../../../src/share/instrument/JPLISAgent.c line: 844
Exception in thread "main"
| Error Forked Grails VM exited with error**
Run Code Online (Sandbox Code Playgroud)
谁能帮我?
谢谢
我想在我的WebView中打开一个PDF,我在这个论坛上找到并组合了代码.
但是,虽然我安装了多个PDF应用程序,包括Adobe Reader,但它仍然可以找到"找不到PDF应用程序".
这里的代码:
private class PsvWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
if (url.contains(".pdf")) {
Uri path = Uri.parse(url);
Intent pdfIntent = new Intent(Intent.ACTION_VIEW);
pdfIntent.setDataAndType(path, "application/pdf");
pdfIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
try
{
startActivity(pdfIntent);
}
catch(ActivityNotFoundException e)
{
Toast.makeText(PsvWebViewActivity.this, "No PDF application found", Toast.LENGTH_SHORT).show();
}
catch(Exception otherException)
{
Toast.makeText(PsvWebViewActivity.this, "Unknown error", Toast.LENGTH_SHORT).show();
}
}
return true;
} } }
Run Code Online (Sandbox Code Playgroud) 我正在尝试将maven项目导入Eclipse.
我正在使用Helios.我已经下载了m2eclipse.我已经导入了这个项目.
但是我在编译项目时遇到了很多麻烦.
完整项目包含5个Eclipse项目,即:prj1,prj2,prj3,prj4和prj5
如果我在prj1/pom.xml上看(Eclipse)标记我有这个麻烦:
Multiple annotations found at this line:
- Missing artifact log4j:log4j:jar:1.2.15:compile
- Missing artifact org.apache.xmlbeans:xmlbeans-xpath:jar:2.4.0:compile
- Missing artifact org.apache.ws.commons.axiom:axiom-dom:jar:1.2.5:compile
- Missing artifact org.apache.httpcomponents:httpcore:jar:4.0-alpha5:compile
Run Code Online (Sandbox Code Playgroud)
......等等......
如果我理解了maven是如何工作的那些家属必须下载我的maven,我错了吗?
为什么没有下载这些依赖项?我应该一个一个地手动下载吗?
我有EncouragementService.groovy以下方法
class EncouragementService {
def stripePaymentService
def encourageUsers(List<User> users){
if(null != users && users.size()>0){
for(User user : users){
//logic
stripePaymentService.encourage(user)
//
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
要在JAVA Universe中测试上面的代码,使用JUnit我首先要在安装程序中创建两个或三个用户.将用户列表传递给encourageUsers(...)方法,并根据结果检查我想要的内容.
我怎样才能在grails中实现同样的目标,
import com.github.jmkgreen.morphia.Datastore;
@TestFor(EncouragementService)
class EncouragementServiceSpec {
def morphiaService = new MorphiaService()
void testEncourageUsers() {
List<User> users = createUsers();
encouragementService.(users)
//
}
def createUsers(){
Datastore datastore = morphiaService.dataStoreInstance()
def user = new User()
user.setName("Prayag Upd")
//
datastore.save(user)
[user]
}
}
Run Code Online (Sandbox Code Playgroud)
我正在使用spock:0.7
plugins {
test(":spock:0.7") { exclude "spock-grails-support" } …Run Code Online (Sandbox Code Playgroud) 有没有其他人遇到这个例外?我们昨晚在负载测试中看到了它.主机名是正确的,通常正常.它昨晚刚开始抛出这个例外.无论是amanzon的随机DNS失败,还是Aws SDK for Java在加载时都会出现意外情况.
> Caused by: java.net.UnknownHostException: sdb.amazonaws.com
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:867)
at java.net.InetAddress.getAddressFromNameService(InetAddress.java:1246)
at java.net.InetAddress.getAllByName0(InetAddress.java:1197)
at java.net.InetAddress.getAllByName(InetAddress.java:1128)
at java.net.InetAddress.getAllByName(InetAddress.java:1064)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.resolveHostname(DefaultClientConnectionOperator.java:242)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:130)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:121)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:561)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:415)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:732)
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:266)
Run Code Online (Sandbox Code Playgroud) 是java.lang.reflect.Method线程安全的?
我的程序的分析结果显示,Class.getMethod()在多次调用时花费了相当多的计算时间,比我预期的要多一点.我可以调用一次,并将生成的方法存储在易于访问的地方.但是,多个Web工作线程将同时使用存储的Method对象.
这样安全吗?
我对Clojure很新.我有一个数据库结果的映射,它包含键值,例如:
{:Unique Product ID "09876" :ProductName "XYZ"}
Run Code Online (Sandbox Code Playgroud)
我想从地图中检索值,但我在获取唯一产品ID时遇到问题.
ProductID (str ( map-name ":Unique Product ID"))
Run Code Online (Sandbox Code Playgroud)
产品名称使用正常:
ProductName (str ( map-name :ProductName"))
Run Code Online (Sandbox Code Playgroud)
我不确定如何处理产品ID字段键中的空格.我该如何从地图中检索该键的值?
谢谢
我想在 Spring Data中使用Hibernate Transformation.
我有一个AgentRecord属性为的实体
@Entity
public class AgentRecord extends AbstractEntity<Long> {
@ManyToOne
private User processedBy;
private String description;
private RecordType recordType;
private AgentRecordStatus status;
}
Run Code Online (Sandbox Code Playgroud)
我遵循将所需属性设置为调用的不同DTO AgentRecordDTO并将其返回到Client-side(gwt)的做法.
public class AgentRecordDTO implements IsSerializable {
private long processedBy;
private String description;
private RecordType recordType;
private AgentRecordStatus status;
}
Run Code Online (Sandbox Code Playgroud)
而不是获取实体的所有属性,我想获取一些属性并将它们设置AgentRecordDTO为new AgentRecordDTO()我可以在hql中执行的属性,但是想要使用Spring Data Specification.

我的AgentRepository是
public interface AgentRecordRepository extends CrudRepository<AgentRecord, Long>, JpaSpecificationExecutor<AgentRecord> {
}
Run Code Online (Sandbox Code Playgroud)
public Page<AgentRecordDTO> getAgentRecords(final …Run Code Online (Sandbox Code Playgroud) 我刚刚开始学习Clojure,并且在过去的几年里一直在努力应对API的变化.特别是在1.2中,contrib中有一个http-agent函数,它允许非常简单的HTTP请求:
(http-agent "http..." :method "POST" :body "foo=1")
Run Code Online (Sandbox Code Playgroud)
此功能已被删除,现在您应该使用clojure.java.io或第三方解决方案,如http-kit或clj-http.
我真的很惊讶,因为它java.io似乎更低级别并且失去了简单性或http代理,并且使得http请求看起来像应该在核心库集中(我意识到这是非常主观的).
删除http-agent的理由是什么?它不符合Clojure的核心理念吗?什么是最佳库用于基本HTTP请求的建议?
我正在尝试但没有成功缓存Spring Data和Hibernate environmet中的查询以及以下依赖项:
compile 'org.hibernate:hibernate-validator:4.0.0.GA'
compile 'org.hibernate:hibernate-entitymanager:3.6.6.Final'
compile 'org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.0.Final'
compile 'org.hibernate:hibernate-ehcache:3.3.1.GA'
compile 'org.springframework.data:spring-data-jpa:1.2.0.RELEASE'
Run Code Online (Sandbox Code Playgroud)
public interface ServiceRepository extends CrudRepository<Service, Long>, JpaSpecificationExecutor<Service> {
@Cacheable("merchantServices")
@Query("select s from Service s JOIN s.statusList sas where s.status=?1 and s.priviligedUser.priviligedUserType IN (2,4) and (s.id IN (select st.id from Service st inner join st.tags tag where tag IN (?3)) or s.serviceType IN (?2)) and sas.active=true and sas.transactorType=?4 ORDER BY s.name")
List<Service> getAllMerchantServicesByStatusTypeAndTags(ServiceStatus status, List<ServiceType> type, List<String> tags, TransactorType …Run Code Online (Sandbox Code Playgroud)