File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes BEA/Weblogic and the fly likes Log4j error while deploying EJB 3.0 in weblogic 10 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Log4j error while deploying EJB 3.0 in weblogic 10" Watch "Log4j error while deploying EJB 3.0 in weblogic 10" New topic
Author

Log4j error while deploying EJB 3.0 in weblogic 10

sachin rathore
Greenhorn

Joined: Jan 29, 2010
Posts: 8
Hi,

I have migrated an application EJB from 2.0 to 3.0 annotations.

The log4j for the project is configured in this way, it is added to the startWeblogic.cmd in weblogic 10 as :
set JAVA_OPTIONS=%JAVA_OPTIONS% -Dlog4j.configuration=log4j.properties

Now i am trying to deploy my EAR file that contains an EJB 3.0 Project and a Web project , it gives following error while deployment.
###<Jan 29, 2010 8:21:01 PM EST> <Warning> <Deployer> <ALPITSWXP00001> <wlw-pricingdev-s10> <[STANDBY] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1264814461242> <BEA-149078> <Stack trace for message 149004
weblogic.application.ModuleException: Exception preparing module: EJBModule(streamlinesuspenseEJB.jar)
[EJB:011023]An error occurred while reading the deployment descriptor. The error was:
org.apache.log4j.spi.RootCategory.<init>(Lorg/apache/log4j/Level;)V.
at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:452)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:387)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:58)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:42)
at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:615)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191)
at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:16)
at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:155)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:197)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:89)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:723)
at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1190)
at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:248)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:157)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:12)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:45)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
java.lang.NoSuchMethodError: org.apache.log4j.spi.RootCategory.<init>(Lorg/apache/log4j/Level;)V
at org.apache.log4j.LogManager.<clinit>(LogManager.java:113)
at org.apache.log4j.Logger.getLogger(Logger.java:124)
at com.jmfamily.common.log.LogManager.getLogger(LogManager.java:33)
at com.jmfamily.common.log.LogManager.getLogger(LogManager.java:42)
at com.jmfamily.jma.contract.ejb.SuspendedContractSOBean.<clinit>(SuspendedContractSOBean.java:33)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at weblogic.ejb.container.dd.xml.EjbAnnotationProcessor.processWLSAnnotations(EjbAnnotationProcessor.java:1699)
at weblogic.ejb.container.dd.xml.EjbDescriptorReaderImpl.processWLSAnnotations(EjbDescriptorReaderImpl.java:346)
at weblogic.ejb.container.dd.xml.EjbDescriptorReaderImpl.createReadOnlyDescriptorFromJarFile(EjbDescriptorReaderImpl.java:192)
at weblogic.ejb.spi.EjbDescriptorFactory.createReadOnlyDescriptorFromJarFile(EjbDescriptorFactory.java:93)
at weblogic.ejb.container.deployer.EJBModule.loadEJBDescriptor(EJBModule.java:1198)
at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:380)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:387)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:58)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:42)
at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:615)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191)
at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:16)
at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:155)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:197)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:89)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:723)
at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1190)
at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:248)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:157)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:12)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:45)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
>

If i remove the "set JAVA_OPTIONS=%JAVA_OPTIONS% -Dlog4j.configuration=log4j.properties" from the weblogic statrup script and install the EAR it will be installed , but the logger is not initialized.

If the option "set JAVA_OPTIONS=%JAVA_OPTIONS% -Dlog4j.configuration=log4j.properties" added to the startup script and i deployed the OLD EJB 2.0 app , it is installed successfully, but it didnt let me deploy EJB 3.0 app.

I am hitting my head around it for a day now, no success so far..

Please provide you suggestions , thanks a lot to all in advance.

Thanks
Sachin
Andy Kay
Greenhorn

Joined: Oct 26, 2009
Posts: 29
Sachin,

Did you trying adding log4 jar file to server classpath?

Andy


http://ananthkannan.blogspot.com
sachin rathore
Greenhorn

Joined: Jan 29, 2010
Posts: 8
Hi Andy,

I tried kept the log4j-1.2.3.jar in the server/lib and its already there in my EAR/lib and the classpath is added to Manifest.mf file for EJB project.
Please let me know what else can i do? Since i have an old EAR with EJB2.0 and try to deploy that it and it gets deployed.
I also compared the ear structure and its similar. No clues whats goin on.

-Sachin
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

Is this being used along with commons logging ? My question is does commons logging actually load your log4j jar implementation.

If that is the case try to ask weblogic to prefer to load the jars in your application and that might solve the problem for you.

This thread has some relevant details -> http://www.coderanch.com/t/478489/BEA-Weblogic/Deployment-error-NoClassDefFoundError-org-hibernate


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Andy Kay
Greenhorn

Joined: Oct 26, 2009
Posts: 29
Sachin,

Are you using logkit jar in your application?

Andy
sachin rathore
Greenhorn

Joined: Jan 29, 2010
Posts: 8
Hi Andy,

Thanks for the reply.
I am not using any logkit jar.

Thanks
Sachin
Joseph Antoine Raja
Ranch Hand

Joined: Feb 01, 2010
Posts: 32
Hi Sachin,

From the error it seems to be that the exact issue lies on

java.lang.NoSuchMethodError: org.apache.log4j.spi.RootCategory.<init>(Lorg/apache/log4j/Level;)V

Please ensure you have added the proper version of log4j.jar on CLASSPATH and you are using the valid properties in the config file with high level of case sensitivity.

Please refer your log4j.properties or Code also for "RootCategory" parameter.
sachin rathore
Greenhorn

Joined: Jan 29, 2010
Posts: 8
Hi Friends,

Thanks a lot to everyone for posting there replies.
It was the issue with the classpath and the lo4j jar exact name.
The jar we were using is log4j-1.2.3.jar and the one which was set in classpath was log4j.jar.
Changing the name in classpath fixed it.

Thanks again to all..

-Sachin
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Log4j error while deploying EJB 3.0 in weblogic 10