我必须在服务器上运行简单的定期任务,当时只有 weblogic 8.1 服务器在运行,所以要求是在 weblogic 上运行该任务。
我从创建最简单的耳朵开始,它将运行一个类。我在其他项目中发现了 weblogic-application.xml 中启动类的调用:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE weblogic-application
PUBLIC "-//BEA Systems, Inc.//DTD WebLogic Application 8.1.0//EN"
"http://www.bea.com/servers/wls810/dtd/weblogic-application_2_0.dtd">
<weblogic-application>
<startup>
<startup-class>myStartupClass</startup-class>
<startup-uri>my-ejb.jar</startup-uri>
</startup>
</weblogic-application>
据我了解,java 代码必须在单独的 EJB 项目中,因此我创建了仅包含 myStartupClass 的项目,并将其添加为 ejb 类型的 maven 依赖项。我正在使用 maven-ear-plugin 构建耳朵:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<defaultLibBundleDir>lib</defaultLibBundleDir>
</configuration>
</plugin>
最后,耳朵已经建成,我正在部署它,没有任何信息:
[Deployer:149233]An unexpected error was encountered during the deployment process.
[Deployer:149033]preparing application finder-ear-1 on myserver
[Deployer:149033]failed application finder-ear-1 on myserver
[Deployer:149034]An exception occurred for task [Deployer:149026]Deploy application finder-ear-1 on myserver.: [Deployer:149233]An unexpected error was encountered during the deployment process..
我检查了日志以找到一些详细信息,但不幸的是,它们没有给我任何提示 weblogic 想要我做什么:
####<2012-02-23 13:41:00 GMT> <Warning> <DRS> <PA-STK-074> <myserver> <ExecuteThread: '3' for queue: 'weblogic.kernel.System'> <<WLS Kernel>> <> <BEA-002506> <The current version 2 for DataIdentifier DataIdentifierID: 1 does not match with incoming version 6 for a one-phase update.>
####<2012-02-23 13:41:00 GMT> <Warning> <Deployer> <PA-STK-074> <myserver> <ExecuteThread: '3' for queue: 'weblogic.kernel.System'> <<WLS Kernel>> <> <BEA-149004> <Failures were detected while initiating Deploy task for application finder-ear-1.>
####<2012-02-23 13:41:00 GMT> <Error> <Deployer> <PA-STK-074> <myserver> <ExecuteThread: '3' for queue: 'weblogic.kernel.System'> <<WLS Kernel>> <> <BEA-149201> <Failed to complete the deployment task with ID 4 for the application finder-ear-1.
java.lang.Throwable:
at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare()V(SlaveDeployer.java:2413)
at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(Lweblogic/management/deploy/OamVersion;Lweblogic/management/runtime/DeploymentTaskRuntimeMBean;Z)V(SlaveDeployer.java:883)
at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(Lweblogic/management/deploy/OamDelta;Lweblogic/management/deploy/OamVersion;ZLjava/lang/StringBuffer;)Z(SlaveDeployer.java:591)
at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(Ljava/util/ArrayList;Z)V(SlaveDeployer.java:500)
at weblogic.drs.internal.SlaveCallbackHandler$1.execute(Lweblogic/kernel/ExecuteThread;)V(SlaveCallbackHandler.java:25)
at weblogic.kernel.ExecuteThread.execute(Lweblogic/kernel/ExecuteRequest;)V(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run()V(ExecuteThread.java:183)
at java.lang.Thread.startThreadFromVM(Ljava/lang/Thread;)V(Unknown Source)
>
你能给我一个提示我做错了什么以及从哪里开始吗?我试图为类似于我的案例找到一些教程(没有 Web 应用程序,没有远程 EJB 服务,只有简单的定期任务,使用 maven 构建),但我找不到任何匹配的东西......任何提示将不胜感激。