0
votes

I am using WLST script to create a domain in Weblogic 10.3.4. Then starting the Admin Server and deploying a war file.All in the script.

In this WLST I am also updating the setDomainEnv.cmd file to add certian jars at the beginning of the classpath. This setDomainEnv.cmd will be called when we start the domain with startWebLogic.cmd.

But in the script when i start the server using the startServer command, it does not call the startWebLogic.cmd and therefore my updated setDomainEnv.cmd is not called. As a result, although everything else works just fine (Like Domain creation, war deployment) my application fails as the necessary jars are not loaded. To be specific i want to append javax.el-api-2.2.4.jar and com.sun.el_2.2.0.v201105051105.jar in the classpath.

Any suggestions as to how can i call startWebLogic.cmd from WLST. Also if we can call startWebLogic.cmd from an ant task or Maven will also do.

Edit

My weblogic.xml looks like the below

      <container-descriptor>
<prefer-application-packages>
  <package-name>javax.el.*</package-name>
  <package-name>com.sun.el.*</package-name>
   <package-name>javax.persistence.*</package-name>
   <package-name>javax.persistence.criteria.*</package-name>
   <package-name>javax.persistence.metamodel.*</package-name>
   <package-name>javax.persistence.spi.*</package-name>  
   <package-name>org.eclipse.persistence.*</package-name>      
   <package-name>org.springframework.*</package-name>      
  </prefer-application-packages>          
 </container-descriptor> 
2

2 Answers

2
votes

You can choose one of the below approach

1 - Put all your jars in %DOMAIN_HOME%/lib folder and they will be added to the classpath during server start , this way you need not have to modify setDomainEnv.cmd. The catch here is if you read readme.txt under %DOMAIN_HOME%/lib you would see that these jars are added at the end of the classpath, so if you want all of these jars to be at the start of the classpath then this is not a good solution.

2 - One way of starting the servers which go through startWebLogic.cmd is using nodemanager - Of course for this approach you would need nodemanger to be configured, registered with the domain and started before starting your domain - use nmConnect and issue nmStart - Refer http://docs.oracle.com/cd/E24329_01/web.1211/e21050/starting_nodemgr.htm#NODEM209 for more details on this

In Future : Note that having classpath set in the setDomainEnv may work fine if server is always started using started using startWebLogic.cmd but if there will be any usecase that the server can be started from AdminConsole as well, then you need to set the classpath at : Login to AdminConsole–>Environments—.Servers—>YourManagedServer—>Configuration (TAB)—>ServerStart (SubTab) -> Classpath (text area)

0
votes

I wont question why you need these jars deployed, but the way to do this in Weblogic is to deploy them as a Shared Library. You can probably do this with WLST or the Deployer in a script. Modifying the cmd files seems like a hack to me.