WebLogic remote redeploy with WLST

June 28th, 2010 No comments

A small WLST script to enable remote deployment of applications on WebLogic. The script will check for old versions, and undeploy the oldest if more than one is found (WLS supports two deployed versions at the same time).

All variables shown between < and > signs must be replaced by real values:

import re

warPath = '<location of war/ear>'

connect('<user - weblogic>', '<password>', '<server-url>')

appList = re.findall('<app name>#(\d*)', ls('/AppDeployments'))
if len(appList) > 1:
	oldestArchiveVersion = min(map(int, appList))
	undeploy('<app name>', archiveVersion = oldestArchiveVersion)

deploy('<app name>', path = warPath, retireTimeout = 0, upload = 'True')

exit()

To run first set up the paths to enable WLST (typically calling the setWLSEnv.cmd/sh script) and then run 'java weblogic.WLST deploy.py'.

Introduction to Scala – Presentation draft

July 4th, 2009 No comments

This is a draft of my “Introduction to Scala” presentation, to be used at the BEKK “fagdag” in September. The presentation is written using LaTeX and Beamer. Feel free to comment on errors or improvements :)

The presentation is available on scribd.com:

Cannot view the presentation? The whole file can be downloaded as PDF here:

Note! I will update the presentation when I find errors or make other changes.

LaTeX Listings for Scala

June 30th, 2009 3 comments

To get LaTeX Listings to work for Scala I ended up with the following definition in my .tex file:

\usepackage{listings}

% "define" Scala
\lstdefinelanguage{scala}{
  morekeywords={abstract,case,catch,class,def,%
    do,else,extends,false,final,finally,%
    for,if,implicit,import,match,mixin,%
    new,null,object,override,package,%
    private,protected,requires,return,sealed,%
    super,this,throw,trait,true,try,%
    type,val,var,while,with,yield},
  otherkeywords={=>,<-,<\%,<:,>:,\#,@},
  sensitive=true,
  morecomment=[l]{//},
  morecomment=[n]{/*}{*/},
  morestring=[b]",
  morestring=[b]',
  morestring=[b]"""
}

NOTE! After writing this I came across this page (with a downloadable style file), which is probably preferred to adding the definition to every single .tex document.

To add a nice IntelliJ-like color/look & feel and a border I added the following configuration:

\usepackage{color}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}

% Default settings for code listings
\lstset{frame=tb,
  language=scala,
  aboveskip=3mm,
  belowskip=3mm,
  showstringspaces=false,
  columns=flexible,
  basicstyle={\small\ttfamily},
  numbers=none,
  numberstyle=\tiny\color{gray},
  keywordstyle=\color{blue},
  commentstyle=\color{dkgreen},
  stringstyle=\color{mauve},
  frame=single,
  breaklines=true,
  breakatwhitespace=true
  tabsize=3
}

Using the listings is then straightforward:

\begin{lstlisting}
val t = "hello" // a string
val x = 42 // an int
\end{lstlisting}

Resulting in the following pretty formatted code example in a Beamer presentation:
LaTeX Beamer Scala Listing

WebLogic Production Redeploy version with Maven

May 26th, 2009 2 comments

Later versions of WebLogic support the notion of Production Redeployment which is pretty sweet as it lets you deploy new versions of your application rather transparent without stopping anything. This means users can access the application while deployment is running and will automatically be transferred to the new version when it’s ready.

The only thing you really need to ensure is that the deployment unit (war, ear..) contains a property Weblogic-Application-Version in the MANIFEST.MF file.

We wanted to have Maven automatically extract the latest build-number from Subversion and append this as the Weblogic-Application-Version property. Combining the buildnumber-maven-plugin and maven-war-plugin does the trick:

<build>
 <plugins>
  ...
  <plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>buildnumber-maven-plugin</artifactId>
   <executions>
    <execution>
     <phase>validate</phase>
     <goals>
      <goal>create</goal>
     </goals>
    </execution>
   </executions>
  </plugin>
  <plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-war-plugin</artifactId>
   <configuration>
    <archive>
     <manifestEntries>
      <Weblogic-Application-Version>${buildNumber}</Weblogic-Application-Version>
     </manifestEntries>
    </archive>
   </configuration>
  </plugin>
  ...
 </plugins>
</build>

The buildnumber-maven-plugin extracts the SVN build-number and sets it in the buildNumber variable. This it used in maven-war-plugin to update the manifest.

Aktivere Java 6 på Mac

May 9th, 2009 No comments

Java 6 er installert på OS X, men ikke default aktivert. Denne posten hjalp meg å finne ut av hvordan jeg gjør det:
http://gephi.org/support/install-java-6-mac-os-x-leopard/

For å se Java 6 applets er det greit å bruke appletviewer, som forklart her:
http://yaib.eu/2009/03/30/running-java-6-applet-on-mac-os-x-leopard/

Tags: ,