2012-02-23 21 views
0

當只有weblogic 8.1服務器運行時,我不得不在服務器上運行簡單的定期任務,因此需要在weblogic上運行該任務。Weblogic 8.1 - 最簡單的耳朵 - 不可理解的錯誤信息

我從創建最簡單的耳朵開始,即運行一個類。我在其他項目中發現的啓動類的調用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的耳插件:

 <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構建)的一些教程,但我找不到任何匹配...任何提示將不勝感激。

回答

1

我認爲,因爲啓動類的目的是在部署某個EAR之前執行的,所以您需要將類放在EAR文件的外部。因此,您可以嘗試的是將所有這些內容保留在weblogic-application.xml文件中,但是將啓動類打包到您部署的標準jar文件中Weblogic的類路徑dir(%WL_HOME%\ server \ lib)

+0

在另一個項目中,來自EAR的類被調用,並且正在進行初始配置。但是,我有可能濫用這個功能,我應該做其他的事情......但是什麼? – 2012-02-23 14:19:19

+0

嗯,但是你確定那個類(從另一個項目工作的類)是否也沒有部署在WebLo類路徑的JAR中? – 2012-02-23 14:20:58

+0

無論如何,我不是WebLo的專家,但是如果你想在你的項目中有一個類,當項目被部署時調用它,爲什麼不做一個普通的香草javax.servlet.ServletContextListener? – 2012-02-23 14:22:26