我正在使用Netbeans 8.0,Windows 8,Java EE 7,Maven Web应用程序项目和glassfish 4。
当我尝试使用可嵌入的EJB容器运行单元测试时,容器的创建失败,并出现以下异常:
SEVERE: Error while expanding archive file
java.io.FileNotFoundException: C:\Users\...\AppData\Local\Temp\gfembed1338945565251414358tmp\applications\classes\license\LICENSE (The system cannot find the file specified)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
at com.sun.enterprise.deploy.shared.FileArchive.putNextEntry(FileArchive.java:716)
at org.glassfish.internal.deployment.GenericHandler.expand(GenericHandler.java:99)
at com.sun.enterprise.v3.server.ApplicationLifecycle.getContext(ApplicationLifecycle.java:1807)
at com.sun.enterprise.v3.server.ApplicationLifecycle.access$200(ApplicationLifecycle.java:115)
at com.sun.enterprise.v3.server.ApplicationLifecycle$DeploymentContextBuidlerImpl.build(ApplicationLifecycle.java:1670)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:424) at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:356)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:133)
at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:109)
at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:138)
at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:134)
at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:127)
当我尝试使用netbeans web app项目(没有maven项目)运行简单的单元测试时,一切正常(使用相同的临时文件夹)。两个单元测试只不过是创建嵌入式EJB容器。