gpt4 book ai didi

java - weblogic 12 中的 EJB 初始化错误,但 10 中没有

转载 作者:太空宇宙 更新时间:2023-11-04 11:08:06 25 4
gpt4 key购买 nike

我正在处理一些关于遗留应用程序、weblogic 和 ejb 的奇怪的事情。我有一些代码作为 EAR 部署在 weblogic 10 中,没有任何错误,但现在,我正在针对 12 版本对其进行测试。不幸的是,它没有部署成功。

我有一个名为“Monitor”的单例类,具有以下构造函数:

 private Monitor(){
if(MonitorProperties.getInstance().getEnabled()){
try{
Context objContext = new InitialContext();
monitorJmsGatewayRemote = (MonitorJmsGatewayRemote)objContext.lookup(MonitorProperties.getInstance().getJndiEjbGatewayProperty());
active = true;
if(tracer.isInfoEnabled()){
tracer.info("'"+FrameworkApplicationContext.getInstance().getApplicationId()+"' Framework monitor is initialize");
}
}catch(Exception excep){
tracer.warn("'"+FrameworkApplicationContext.getInstance().getApplicationId()+"' It's not possible to initialize the framework monitor. "+ excep.getMessage());
active = false;
}

init();
}else{
active = false;
}
}

因此,在运行时,监视器可能会启用或禁用。

另一方面,我有 MonitorJMSGateway ejb:

@Stateless(name="FwkMonitorJmsGatewayBean")
@Remote(MonitorJmsGatewayRemote.class)
public class MonitorJmsGateway implements MonitorJmsGatewayRemote {

private static Tracer tracer = null;

static{//Inicializamos el log4j
PropertyConfigurator.configure(Thread.currentThread().getContextClassLoader().getResourceAsStream(MonitorJmsGatewayConstants.LOG4J_PROPERTIES_FILE));
tracer = Tracer.getTracer(MonitorJmsGateway.class);
}

问题是我得到一个空指针,因为 log4.properties 文件不存在。没关系,好​​吧。但奇怪的是,这个应用程序在 weblogic 10 中部署正确,但在 12 中却不然。这听起来像是 10 中的延迟初始化内容(由于禁用了自定义监控,ejb 未初始化,未引发异常并且应用程序已成功部署)

日志错误跟踪如下

####<18-sep-2017, 8:42:29,43 AM CEST> <Error> <Deployer> <CASER-5041> <AdminServer> <[ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <a7a2e7ff-e3ef-4cf9-8686-75d7d0d27689-00000013> <1505716949043> <[severity-value: 8] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] > <BEA-149265> <Failure occurred in the execution of deployment request with ID "2686211063156" for task "0" on [partition-name: DOMAIN]. Error is: "weblogic.application.ModuleException: java.lang.NoClassDefFoundError: Could not initialize class es.caser.archit.monitor.jmsgateway.FwkMonitorJmsGatewayBean_nrwnbe_Impl"
weblogic.application.ModuleException: java.lang.NoClassDefFoundError: Could not initialize class es.caser.archit.monitor.jmsgateway.FwkMonitorJmsGatewayBean_nrwnbe_Impl
at weblogic.application.internal.ExtensibleModuleWrapper.prepare(ExtensibleModuleWrapper.java:114)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:100)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:192)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:187)
at weblogic.application.utils.StateMachineDriver$ParallelChange.run(StateMachineDriver.java:83)
at weblogic.work.ContextWrap.run(ContextWrap.java:46)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:666)
at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)
at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)
at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)
at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:640)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:406)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:346)
Caused By: java.lang.NoClassDefFoundError: Could not initialize class es.caser.archit.monitor.jmsgateway.FwkMonitorJmsGatewayBean_nrwnbe_Impl
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at weblogic.utils.classloaders.GenericClassLoader.defineCodeGenClass(GenericClassLoader.java:1357)
at weblogic.ejb.container.ejbc.bytecodegen.GeneratorFactory.generateClass(GeneratorFactory.java:100)
at weblogic.ejb.container.ejbc.bytecodegen.GeneratorFactory.generate(GeneratorFactory.java:51)
at weblogic.ejb.container.ejbc.EJBCompiler.generate(EJBCompiler.java:606)
at weblogic.ejb.container.ejbc.EJBCompiler.doCompile(EJBCompiler.java:201)
at weblogic.ejb.container.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:345)
at weblogic.ejb.container.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:313)
at weblogic.ejb.container.deployer.EJBDeployer.compileEjbs(EJBDeployer.java:420)
at weblogic.ejb.container.deployer.EJBDeployer.compileIfNecessary(EJBDeployer.java:351)
at weblogic.ejb.container.deployer.EJBDeployer.prepare(EJBDeployer.java:716)
at weblogic.ejb.container.deployer.EjbModuleExtension.postPrepare(EjbModuleExtension.java:97)
at weblogic.application.internal.ExtensibleModuleWrapper$PrepareStateChange.next(ExtensibleModuleWrapper.java:297)
at weblogic.application.internal.ExtensibleModuleWrapper$PrepareStateChange.next(ExtensibleModuleWrapper.java:285)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
at weblogic.application.internal.ExtensibleModuleWrapper.prepare(ExtensibleModuleWrapper.java:109)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:100)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:192)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:187)
at weblogic.application.utils.StateMachineDriver$ParallelChange.run(StateMachineDriver.java:83)
at weblogic.work.ContextWrap.run(ContextWrap.java:46)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:666)
at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)
at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)
at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)
at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:640)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:406)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:346)
>
####<18-sep-2017, 8:42:29,43 AM CEST> <Error> <Deployer> <CASER-5041> <AdminServer> <[ACTIVE] ExecuteThread: '7' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <a7a2e7ff-e3ef-4cf9-8686-75d7d0d27689-00000012> <1505716949043> <[severity-value: 8] [rid: 0] [partition-id: 0] [partition-name: DOMAIN] > <BEA-149265> <Failure occurred in the execution of deployment request with ID "2686211063156" for task "weblogic.deploy.configChangeTask.0" on [partition-name: DOMAIN]. Error is: "weblogic.application.ModuleException: java.lang.NullPointerException"
weblogic.application.ModuleException: java.lang.NullPointerException
at weblogic.application.internal.ExtensibleModuleWrapper.prepare(ExtensibleModuleWrapper.java:114)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:100)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:192)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:187)
at weblogic.application.utils.StateMachineDriver$ParallelChange.run(StateMachineDriver.java:83)
at weblogic.work.ContextWrap.run(ContextWrap.java:46)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:666)
at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)
at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)
at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)
at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:640)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:406)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:346)
Caused By: java.lang.NullPointerException
at java.util.Properties$LineReader.readLine(Properties.java:434)
at java.util.Properties.load0(Properties.java:353)
at java.util.Properties.load(Properties.java:341)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:532)
at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:427)
at es.caser.archit.monitor.jmsgateway.MonitorJmsGateway.<clinit>(MonitorJmsGateway.java:23)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at weblogic.utils.classloaders.GenericClassLoader.defineCodeGenClass(GenericClassLoader.java:1357)
at weblogic.ejb.container.ejbc.bytecodegen.GeneratorFactory.generateClass(GeneratorFactory.java:100)
at weblogic.ejb.container.ejbc.bytecodegen.GeneratorFactory.generate(GeneratorFactory.java:51)
at weblogic.ejb.container.ejbc.EJBCompiler.generate(EJBCompiler.java:606)
at weblogic.ejb.container.ejbc.EJBCompiler.doCompile(EJBCompiler.java:201)
at weblogic.ejb.container.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:345)
at weblogic.ejb.container.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:313)
at weblogic.ejb.container.deployer.EJBDeployer.compileEjbs(EJBDeployer.java:420)
at weblogic.ejb.container.deployer.EJBDeployer.compileIfNecessary(EJBDeployer.java:351)
at weblogic.ejb.container.deployer.EJBDeployer.prepare(EJBDeployer.java:716)
at weblogic.ejb.container.deployer.EjbModuleExtension.postPrepare(EjbModuleExtension.java:97)
at weblogic.application.internal.ExtensibleModuleWrapper$PrepareStateChange.next(ExtensibleModuleWrapper.java:297)
at weblogic.application.internal.ExtensibleModuleWrapper$PrepareStateChange.next(ExtensibleModuleWrapper.java:285)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
at weblogic.application.internal.ExtensibleModuleWrapper.prepare(ExtensibleModuleWrapper.java:109)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:100)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:192)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:187)
at weblogic.application.utils.StateMachineDriver$ParallelChange.run(StateMachineDriver.java:83)
at weblogic.work.ContextWrap.run(ContextWrap.java:46)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:666)
at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)
at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)
at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)
at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:640)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:406)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:346)

错误日志指出类路径中没有 log4j 属性文件。有趣的是,在 weblogic 10 中并没有出现错误。

最佳答案

我想我已经找到答案了。部署 Ear 时,weblogic 10.3 需要 ejb 描述符,而 weblogic 12 使用注释。这就是 weblogic 10 运行“良好”的原因

关于java - weblogic 12 中的 EJB 初始化错误,但 10 中没有,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46273676/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com