我想使用user.dirdir作为我的单元测试的基础目录(创建了大量文件).此属性是否指向当前工作目录(例如,通过'cd'命令设置)是否正确?
是否可以在Raspberry pi上的例如jboss或glassfish服务器上运行普通的Java应用服务器?任何限制?有没有人有覆盆子pi的Java开发经验?
至少任何适用于RPi的JVM都会很好.
我正在尝试理解该hashCode()方法的本机实现.这种方法到底是什么回归?它是一个内存地址还是一个随机值?
我正在尝试将一些实体发送到基于ejb的Web服务.这是我的Web服务客户端代码:
package ejbserviceclient;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
public class EjbServiceClient {
public static void main(String[] args) throws MalformedURLException, JAXBException {
JAXBContext context = JAXBContext.newInstance(EjbServiceClient.class);
URL url = new URL("http://ipsedin:8080/WebServiceBeanService/WebServiceBean?wsdl");
QName serviceName = new QName(
"http://ejb.rpt.softcomputer.com/",
"WebServiceBeanService");
QName portName = new QName(
"http://ejb.rpt.softcomputer.com/",
"WebServiceBeanPort");
Service service = Service.create(url, serviceName);
Echo ejbService = service.getPort(portName, Echo.class);
System.out.println(ejbService.echo("lololo"));
System.out.println(ejbService.processExCourse(new ExCourse()));
}
}
Run Code Online (Sandbox Code Playgroud)
这是实体:
package ejbserviceclient;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class ExCourse {
int id;
}
Run Code Online (Sandbox Code Playgroud)
但有例外: …
在发生异常后运行单元测试时:
org.apache.maven.lifecycle.LifecycleExecutionException: ExecutionException; nested exception is java.util.concurrent.ExecutionException: java.lang.RuntimeException: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ?
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Run Code Online (Sandbox Code Playgroud)
有什么建议?
从控制台运行java应用程序时我得到一个例外,其中包含以下行:
......还有5个
是否有可能看到完整的痕迹?有没有cmd参数?
谢谢.
我想介绍一个逻辑,用单元测试创建文件.是否可以模拟File类并避免实际创建文件?
我试图使用DatabaseMetaData.getTables()方法获取所有数据库表.但是这种方法需要数据库模式名称模式.是否可以获取当前数据库连接的模式名称?
是否可以在pom.xml中设置junit测试使用的env变量?Netbeans可以获得env vars并构建项目.但是当我使用命令行(mvn clean - > mvn install)时,由于测试错误,构建失败.
谢谢.
是否可以从xsd文件生成具有Claendar类型字段的实体?我正在尝试xs:date和xs:dateTime但仍然获得XMLGregarionCalendar.我正在使用cxf-codegen-plugin和jaxb bninding.谢谢.保罗.