我们在 Linux 机器中运行许多 glassfish 实例,突然它们停止记录(创建了一个空白的 server.log 文件,并且没有附加任何记录数据)。
它发生在大约一周的正常记录之后。
这是我第一次尝试 CDI。我有一个 Eclipse Kepler 环境,其中有一个部署在内部 Glassfish 4.0 运行时上的 Maven Web 项目。
它有一个 servlet 和一个 JAX-RS 资源 POJO,两者都可以正常工作。接下来,我在与 servlet 和 JAX-RS POJO 相同的包中创建了一个类:
package com.example.test;
import java.util.logging.Logger;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
@ApplicationScoped
public class Bean {
@Produces @ApplicationScoped
public static Bean produce () {
return new Bean();
}
public Bean () {
Logger.getGlobal().info("Bean()");
}
}
Run Code Online (Sandbox Code Playgroud)
我修改了POJO:
package com.example.test;
import javax.annotation.Resource;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@Resource(name = "foo", type = Rest.class)
@Path("/rest")
public class Rest {
@Inject Bean …Run Code Online (Sandbox Code Playgroud) 在这个最简单的例子中,我做错了什么?(Glassfish 4.0-b87 + Eclipse Kepler m6)
Myself.java
package com.example.cancelbug;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.inject.Inject;
@Singleton
@Startup
public class Myself {
@Inject Other other;
private Future < Integer > future;
@PostConstruct
public void post_construct () {
System.out.println("post_construct started");
future = other.ton_of_work();
System.out.println("post_construct ended");
}
@PreDestroy
public void pre_destroy () {
System.out.println("pre_destroy started");
System.out.println("cancel result: " + Boolean.toString(future.cancel(true)));
try {
System.out.println("future result: " + future.get().toString());
} catch (InterruptedException | ExecutionException e) {
System.out.println("future …Run Code Online (Sandbox Code Playgroud) 我刚刚下载了带有 Glassfish 4 的 Netbeans IDE7。
我刚刚做了一个项目来测试它,看看它是如何进行的,我从一开始就遇到了这个错误:
Could not start GlassFish Server: DAS port is occupied while server is not running
[location]: Deployment error: Could not start GlassFish Server: DAS port is occupied while server is not running
See the server log for details.
BUILD FAILED (total time: 1 second)
Run Code Online (Sandbox Code Playgroud)
我已经重新安装了三次,使用 Glassfish 和不使用,然后将其添加到 Netbeans,我将 domain.xml 更改为name="admin-listener" port="4848"不同的内容
我做了这个 cmd 代码netstat -aon | find ":80" | find "LISTENING"并关闭了程序。
我以管理员身份运行我想我几乎做了每件事,但它不会简单地运行,并且它不断返回相同的错误
通常我会放弃,但该软件是学校项目所必需的。
我会尝试一切。
我希望有一个人可以帮助我。
提前谢谢
我决定使用 Wildfly 8.2.0-Final 作为应用程序服务器,而不是 Glassfish 4.1,因为我听说它的速度不错。
我做的第一件事是创建一个普通的 Java EE Web 应用程序(目前基于 ant,但我将考虑使用 Maven)。NetBeans 8.0.2 中启用了保存时编译。
然而,令我沮丧的是,如果我更改静态内容或更改简单 REST 服务的内容,例如:
@GET
@Produces("text/plain")
public String getText() {
return "Foobar";
}
Run Code Online (Sandbox Code Playgroud)
更改变得可见之前需要几秒钟的时间。对于 Java 类,我几乎可以忍受这一点,但对于静态内容,我希望在我进行大量增量小更改时立即获得反馈。
这在 Glassfish 上通常需要大约 200 毫秒(完全相同的代码),所以我不明白它在 Wildfly 上慢了 10 倍?
我需要在 glassfish3.0 上使用 JPA 2.0 和 EJB3.0 删除忽略任何完整性约束的员工列表(即成功删除尚未与任何其他实体相关的实体或跳过与其他实体相关的实体):
我迭代列表并在 try/catch 中的 require_new 事务中调用实体管理器,我希望这将在大事务中打开小嵌套事务,并且我使用 em.flush() 强制更新。
但在相关实体的迭代中它会抛出;
异常 [EclipseLink-4002](Eclipse 持久性服务 - 2.4.2.v20130514-5956486):org.eclipse.persistence.exceptions.DatabaseException 内部异常:com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:无法删除或更新父级row:外键约束失败
并继续到下一个员工,但在提交大事务时,它会回滚并抛出相同的异常!
我希望在新的小事务中抛出/捕获异常,并提交列表其余部分的成功删除的实体...
我错过了什么吗?
编辑:
这是一些代码,Facade中调用实体管理器删除bean的代码,我通过required-new注释了该函数:
public void deleteEmployeeData(Set<Employees> deleted) throws DatabaseException {
Iterator itr;
Employees emp;
//delete unused recordes
try {
itr = deleted.iterator();
while (itr.hasNext()) {
emp = (Employees) itr.next();
deleteEmployee(emp);
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("DONE");
}
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
private void deleteEmployee(Employees emp){
try {
this.remove(emp);
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
}
Run Code Online (Sandbox Code Playgroud) 我在 Mac Os X 10.14.6 上启动 glassfish 时遇到问题。
我安装了它
brew install glassfish
Run Code Online (Sandbox Code Playgroud)
然后我添加了
AS_JAVA="/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home"
Run Code Online (Sandbox Code Playgroud)
在asenv.conf中以解决java空指针异常。
现在我收到以下错误:
$ ./asadmin start-domain domain1
Waiting for domain1 to start .Error starting domain domain1.
The server exited prematurely with exit code 1.
Before it died, it produced the following output:
-Djava.endorsed.dirs=/usr/local/Cellar/glassfish/5.1.0/libexec/glassfish/modules/endorsed:/usr/local/Cellar/glassfish/5.1.0/libexec/glassfish/lib/endorsed is not supported. Endorsed standards and standalone APIs
in modular form will be supported via the concept of upgradeable modules.
Java HotSpot(TM) 64-Bit Server VM warning: Ignoring option MaxPermSize; support was removed in 8.0 …Run Code Online (Sandbox Code Playgroud) 几年前,当我下载jdk ee时,得到“jdk-8u231-windows-x64.exe”文件并安装它。它创建了“jdk1.8.0_231”文件夹,我已将其用于 JAVA_HOME。
但是当我现在尝试下载最新的 JDK EE 时,我在其中找到了“glassfish”文件夹。
这是什么变化?为什么要进行此更改?
注意:我知道 Oracle 将 Java EE 提供给了 Eclipse,现在称为 Jakarta EE。但即使在 eclipse 站点或 oracle 站点中,我也只能找到 glassfish 下载,而不是 jdk ee。
请帮助我理解这一点。
谢谢
glassfish ×8
java ×4
jakarta-ee ×2
netbeans ×2
cdi ×1
eclipse ×1
ejb ×1
ejb-3.0 ×1
endorsed ×1
glassfish-3 ×1
glassfish-4 ×1
java-ee ×1
java-ee-6 ×1
java-ee-7 ×1
java-ee-8 ×1
jpa ×1
logging ×1
netbeans-7 ×1
wildfly ×1