我有gwt应用程序连接到后端的postgres DB,以及一个java类'判断'映射数据库中的表'判断',当我试图将判断持久化到db时,它抛出了以下错误:
Caused by: org.hibernate.exception.SQLGrammarException: could not get next sequence value
...
Caused by: org.postgresql.util.PSQLException: ERROR: relation "hibernate_sequence" does not exist
Run Code Online (Sandbox Code Playgroud)
我的审判级看起来像这样
@Entity
@Table(name = "JUDGEMENTS")
public class Judgement implements Serializable, Cloneable {
private static final long serialVersionUID = -7049957706738879274L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "JUD_ID")
private Long _judId;
...
Run Code Online (Sandbox Code Playgroud)
我的表判断是:
Column | Type | Modifiers
-------------+-----------------------------+---------------------------------------------------------
jud_id | bigint | not null default nextval('judgements_id_seq'::regclass)
rating | character varying(255) |
last_update | timestamp without time zone |
user_id | …Run Code Online (Sandbox Code Playgroud) 我正在我的Mac上开发GWT应用程序,现在我应该在我的PC上在IE中测试它.
但是,我不想将代码复制到PC以重建项目并最终进行测试.
我也不想在我的Mac上设置整个Apache + Tomcat服务器来部署项目,以便我的PC可以访问该Web应用程序.
有没有什么办法可以在我的Mac上以调试模式运行我的GWT应用程序,并在我的PC上的IE中测试它?我正在使用Spring + Maven + Eclipse + GWT.
当逐行扫描hbase表时,如何获得行键?这是我的代码:
for (Result rr : scanner) {
System.out.println(rr);
}
Run Code Online (Sandbox Code Playgroud)
有没有像我可以使用的getKey()方法?谢谢.
我尝试java.util.Calendar在我的GWT应用程序中使用如下:
Calendar cal = Calendar.getInstance();
Run Code Online (Sandbox Code Playgroud)
然后我收到了这个错误:
没有源代码可用于类型
java.util.Calendar; 你忘了继承一个必需的模块吗?
有人知道它有什么问题吗?
我使用mongo聚合函数来查找集合中的重复文档,其中集合如下所示:
{_id, placement_id, placement_name, program_id, target}
Run Code Online (Sandbox Code Playgroud)
我需要找到除_id和placement_id之外具有完全相同字段的所有文档,因此这两个文档是相同的:
{_id:3, placement_id:23, placement_name:"pl1", program_id:5, target:"-"}
{_id:7, placement_id:55, placement_name:"pl1", program_id:5, target:"-"}
Run Code Online (Sandbox Code Playgroud)
我想出的集合函数是:
db.placements.aggregate({$group:{_id:{placement_name:"$placement_name", program_id:"$program_id", target:"$target"}, total:{$sum:1}}},{$match:{total:{$gte:2}}});
Run Code Online (Sandbox Code Playgroud)
然后mongo刚回来:
Error: Printing Stack Trace
at printStackTrace (src/mongo/shell/utils.js:37:15)
at DBCollection.aggregate (src/mongo/shell/collection.js:897:9)
at (shell):1:15
Wed Apr 2 07:43:23.090 aggregate failed: {
"errmsg" : "exception: aggregation result exceeds maximum document size (16MB)",
"code" : 16389,
"ok" : 0
} at src/mongo/shell/collection.js:898
Run Code Online (Sandbox Code Playgroud)
聚合是正确的,我在较小的集合上测试它并且它工作正常,但生产集合有大约80M文档.我想知道在80M文档上尝试find()函数时,它可以工作并要求你输入'it'来获取更多记录.为什么聚合函数没有这个功能呢?我还尝试将limit()附加到聚合函数的末尾,但它也不起作用.有什么工作吗?谢谢.
我正在为我的应用程序运行gwt测试,这就像一场噩梦,一个接一个地遇到问题,不知道出了什么问题.
首先,我创建了一个虚拟测试用例:
public class ListItemTest extends GWTTestCase {
/**
* Specifies a module to use when running this test case. The returned
* module must include the source for this class.
*
* @see com.google.gwt.junit.client.GWTTestCase#getModuleName()
*/
@Override
public String getModuleName() {
return "com.dyihi.services.sample.Sample";
}
/**
* Add as many tests as you like
*/
public void testSimple() {
assertTrue(true);
}
}
Run Code Online (Sandbox Code Playgroud)
当我运行'mvn test'时,这个简单的测试失败了.错误消息是:
initializationError0
java.lang.NoClassDefFoundError: com/google/gwt/dev/cfg/Condition
Run Code Online (Sandbox Code Playgroud)
我搜索了一下,发现我需要在我的pom中包含gwt-dev,然后我就这样做了,再次运行测试,现在它抛出了错误:
[ERROR] Unable to find 'Sample.gwt.xml' on your classpath; could be a typo, or …
我使用Apache HttpComponents访问Web服务,并且不知道如何在请求中设置用户/密码,这是我的代码:
URI url = new URI(query);
HttpGet httpget = new HttpGet(url);
DefaultHttpClient httpclient = new DefaultHttpClient();
Credentials defaultcreds = new UsernamePasswordCredentials("test", "test");
httpclient.getCredentialsProvider().setCredentials(new AuthScope(HOST, AuthScope.ANY_PORT), defaultcreds);
HttpResponse response = httpclient.execute(httpget);
Run Code Online (Sandbox Code Playgroud)
..
但仍然有401未经授权的错误.
HTTP/1.1 401 Unauthorized [Server: Apache-Coyote/1.1, Pragma: No-cache, Cache-Control: no-cache, Expires: Wed, 31 Dec 1969 16:00:00 PST, WWW-Authenticate: Basic realm="MemoryRealm", Content-Type: text/html;charset=utf-8, Content-Length: 954, Date: Wed, 04 Apr 2012 02:28:49 GMT]
Run Code Online (Sandbox Code Playgroud)
我不确定它是否是设置用户/密码的正确方法?谁有人可以帮忙?谢谢.
我有一个集合展示位置,每个记录都有字段:placement_id,program_id,category,...我需要查找所有具有program_id = 3或5的展示位置,并且只返回placement_id列表.
当我尝试这个命令:
db.placements.find({program_id:{$in: [3, 5]}}, {placement_id:1, _id:0})
Run Code Online (Sandbox Code Playgroud)
我有记录:
{ "placement_id" : 196 }
{ "placement_id" : 197 }
{ "placement_id" : 198 }
...
Run Code Online (Sandbox Code Playgroud)
有没有办法只返回:
[196, 197, 198...]
Run Code Online (Sandbox Code Playgroud) 我需要使用Xvfb在无头模式下运行selenium测试,在pom.xml中我有:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>xvfb</id>
<phase>pre-integration-test</phase>
<goals>
<goal>xvfb</goal>
</goals>
<!--
<configuration>
<display>:2</display>
</configuration>
-->
</execution>
<execution>
<id>selenium</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start-server</goal>
</goals>
<configuration>
<background>true</background>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
当我运行mvn integration-test时,它无法加载Xvfb,selenium测试仍然在firefox中运行,我检查了以下内容:
(EE) AIGLX error: dlopen of /usr/X11/lib/dri/swrast_dri.so failed (dlopen(/usr/X11/lib/dri/swrast_dri.so, 5): image not found)
(EE) GLX: could not load software renderer
(EE) XKB: Couldn't open rules file /usr/X11/share/X11/xkb/rules/base
(EE) XKB: No components provided for device Virtual core keyboard
Run Code Online (Sandbox Code Playgroud)
有谁知道这意味着什么?谢谢.
我有一个Spring Boot应用程序,该代码需要访问resources文件夹下的文件.这是我的application.properties文件:
cert.file=classpath:/resources/cert.p12
Run Code Online (Sandbox Code Playgroud)
但总是抱怨:
java.io.FileNotFoundException: classpath:/resources/cert.p12 (No such file or directory)
Run Code Online (Sandbox Code Playgroud)
我仔细检查了文件夹my_project/target/classes,以确保文件cert.p12退出.
并在代码中我试图访问该文件:
@Value("${cert.file}")
private String certFile;
....
@Bean
public Sender sender() {
return new Sender(certFile);
}
Run Code Online (Sandbox Code Playgroud)
这个类路径究竟是什么?为什么它找不到文件?谢谢!
java ×4
gwt ×3
mongodb ×2
classpath ×1
hbase ×1
hibernate ×1
httpclient ×1
maven ×1
postgresql ×1
selenium ×1
spring-boot ×1