I had to run simple periodical task on the server, when there's only weblogic 8.1 server running, so the requirement is to run that task on weblogic.
I'm beginning from creating the simplest possible ear, that would run one class. I've found in other projects the invocation of startup class in 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>
As I've understood, the java code must be in separate EJB project, so I've created the project that contains only myStartupClass, and added it as maven dependency of type ejb. I'm building ear using maven-ear-plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<defaultLibBundleDir>lib</defaultLibBundleDir>
</configuration>
</plugin>
Finally, the ear is built and I'm deploying it, with nothing speaking message:
[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..
I've checked the logs to find some details, but unfortunatelly they give me no hints what weblogic wants from me:
####<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)
>
Could you give me a hint what I'm doing wrong and where to start? I've tried to find some tutorial for the case similar to mine (no web application, no remote EJB services, only simple periodical task, build with maven) but I couldn't find anything matching... Any hints would be appreciated.
I think that since the purpose of a start-up class is to be executed BEFORE a certain EAR is deployed, you need to have the class OUTSIDE the EAR file. So, what you can try is leave all that stuff in the weblogic-application.xml file, but package your startup class in a standard jar file that you deploy ins Weblogic's class path dir (%WL_HOME%\server\lib)