Category: EAServer

Deploy jars to easerver

Our CI server right now can deploy component to local/dev easerver, and export it as the jar file to be deploy to acceptance or production later. We don’t want use Nant to do production depoy, basic dos command should be used instead.

Result we try to achieve : One click deploy command to target server.


  1. Use “start /wait /min ” syntax to call jagtool to enable waiting for the deploy process.
  2. Add an exit command in jagtool.bat, to allow this separated window to close after it finished.
  3. Merge the log result into a single log file, jagtool by default always overwrite the existing file, not append.
  4. Loop through the jar folder.

Here is the dos command I end up with.

@echo off
@echo #########################################################
@echo   You must logon to target server to run this command
@echo #########################################################

if NOT Exist deploy.log (
  echo > deploy.log

for /f %%a IN ('dir /b *.jar') do (
  echo "Deploying %%a"   >deploy.log
  start /WAIT /MIN jagtool2  -local -logfile tmp.log deploy -type jagjar -jagjartype Package %%a
  copy deploy.log+tmp.log

del tmp.log

@echo on


Use Dos command to pull/deploy version from

When using + EAserver, we want to use pull instead of push style to deploy packages upto EAServer. Because the Cruisecontrol stores all the build result into the artifacts folder, what we need is a dos command can pull the specific version then deploy to EAServer. Here is the command I created:

@echo off
set artifacts_dir=\\ccnet\Work_Dir\Artifacts\my_project
echo *****************************************
echo Please type in the version to deploy:
echo *****************************************
set /p version_number=
echo *****************************************
echo Starting to deploy %version_number%
echo *****************************************
if  "%version_number%"=="" goto help


call jagtool -local delete Package:MyPackage
call jagtool -local deploy -type jagjar -jagjartype Package  %artifacts_dir%\%version_number%\jar\MyPackage.jar


exit /b

echo You need to specify the version to deploy

A possible way to upgrade PB to DotNet

EAserver acts as a client to consume WCF SOAP WebService, wrap it in WebDatawindow accessed by JSP web user.

Powerbuilder richclient can also directly consume WCF SOAP webservice, or access the EAF component which calls WebService.


The PB we are using 11.2 still have some limitation on webservice datawindow:

  1. Doesn’t support long type parameter, we had to change it to string.
  2. wsdl is wrapped in datawindow is not configurable, might be better if can change it through ini or dw property.

When deploying webservice datawindwo upto EAServer, should copy those auto-gened dlls to EAServer/bin folder, not /dll.

How to switch wsdl in dw?

  1. dw.Describe/Modify or dw.Create(syntax) won’t work for EAF/component, it keeps killing EAServer.
  2. Re-compile the auto-gened temp proxy cs file, like this post did. The interesting part is, the proxy’s ctor is already trying to read default configuration from some ini/config file:
    public RequestManagementService() {
                string urlSetting = System.Configuration.ConfigurationManager.AppSettings["EndpointURL"];
                if ((urlSetting != null)) {
                    this.Url = urlSetting;
                else {
                    this.Url = "http://appdev01/RequestManagement/RequestService.svc/soap";

    My question is, can’t we create a config file to intercept this ctor reading?

              <add key="EndpointURL" value="http://appdev02/RequestManagement/RequestService.svc/soap" />

    Yes, that’s the place you can control to switch wsdl, not the one shown in dw syntax. In fact, if you change the wsdl in dw to an invalid one, it still works!

    How to control it? Create a config file named as your_app.exe.config, paste the configuration content in it. That’s it.
    Thanks to this post helping me out by showing how to get the current configuration file path: AppDomain.CurrentDomain.SetupInformation.ConfigurationFile

I’m using PBUnit, so the config file for testing is called pbunit.exe.config, when I deployed it upto EAserver, the config file should rename to jagsrv.exe.config.

If the whole EAServer is only using one webservice, this solution works; if you have multiple webservice wsdl to consume, you have to add more config settings by re-compiling this temp proxy file in /TmpWebService folder.

How to catch WCF error in PB?

We spent quite a lot of time on this, PB developer should catch RunTimeError instead of Exception type in their proxy calls.


Tried to install EAServer 5.3 on VMWare, kept getting PB_INTERNAL_EXCEPTION when making component call. Our situation is very similar to this post on user group. Our problem also happens when DB operation occurred.

Same version running on physical box doesn’t get this issue.

Looks like a PBVM bug, switch from PBVM 102 EBF 16422 back to 16195, problem solved.

Embed Autodeploy PB component task to CruiseControl

Problem: Any team member can deploy PB component to EAserver from PB IDE, even if they have local code not checked in, and it’s not traceable also (not in EAServer log!). We don’t know who and when touched those component on server.

We tried to put version info in the comments field of component, but it’s not guaranteed. Developer still might forget. If EAServer administrator didn’t version that point, we couldn’t rollback to certain standpoint.

Solution: Auto-deploy from build task, which is triggered by check in. Ideally should run a test project before deploy.

Similar idea from some websphere developer. We should archieve the ear file, but the orcascript alone can generate it, so call an easerver export instead.

Orcascript command:


Don’t know how to pass userid/password to this orca command. Had to add easerver profile to machine.

Ant task:

<property name="JAGUAR" value="C:\Program Files\Sybase\EAServer6\bin" />
 <target name="export_package" depends="">
 <echo message="exporting package ..." />
 <!-- <jag_export entity="Package:My_Package" /> -->
 <delete file="jar\My_Package.jar" />
 <!-- nant change executable to program -->
 <exec executable="${JAGUAR}\jagtool.bat" >
 <arg line="-server easdevSecure -host easdev -port 9100  -user jagadmin -password pass export -dir jar/ Package:My_Package" />

JSP consume PB component

Spent some time on this, here is the solution. 


java.util.Properties props = new java.util.Properties();
props.put( "org.omg.CORBA.ORBClass", "com.sybase.CORBA.ORB" );
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(( String[] ) null, props ); 

FranksPlayGround.n_tt n_tt = FranksPlayGround.n_ttHelper.narrow( orb.string_to_object("FranksPlayGround/n_tt"));
short a = 1;
short b = 4;
short c = 3;
short sum = n_tt.add(a, b, c);

This is so called API coding style. Creating PB component is easy, the important part is to ‘generate stub’ at server side. (Those Helper, Holder and Operations classes in folder “EAServer\java\classes” which n_tt inherited from ) 

The reason I back to this is we have a project needs to get a string type of return value from EAServer. Here is what we did: 

  1. Create a dst contains a dummy datawindow. (dst is from EAF)
  2. In createcontent event we call a method from component.
  3. Save this return value into dst’s message, then pass it back to JSP.
  4. JSP has to do some fancy parsing to get this value out.

Seems a lot of work, but we don’t need to do ‘generate stub’ because EAF install wizard already did this for dst. We kind of like using an empty dst passing value down to JSP. 

I can refactor this a little bit by creating a seperate service object (not component) to wrap the component call.

Remove region tags in your csharp code

I am so use to eclipse’s outline view when I was coding in java/ruby, so when I started using VisualStudio I was a little bit mad at its unfriendly ‘structure view’, until I learned this resharper trick from Tom Opgennorth’s blog .

Once I had resharper’s ‘File Structure View’ on hand (Ctrl+Alt+F if you don’t know yet), yes, the region tag is ugly, just as David Laribee pointed out.

Both Tom and Kyle Baley’s blog have detail instructions how to remove region tags.

Understand J_Security_Check by coding in Ruby

Found a good article about ruby access J_security_check, which gave me a clear view about j_security_check. My revised ruby code looks like this:

     def form_auth_demo
res =, port).start do |http|
#make the initial get to get the JSESSION cookie
get =
response = http.request(get)
# get original cookie contains jsessionid=blahblahblah
cookie = response.response[‘set-cookie’]

post =‘/MyApp/j_security_check’)
post.set_form_data({‘j_username’=>’XX’, ‘j_password’=>’XX’})
post[‘Cookie’] = cookie
response = http.request(post)

# one way to check result
# puts ‘Code = ‘ + response.code
# puts ‘Message = ‘ + response.message

# another way to check result
# case response
# when Net::HTTPSuccess
# puts ‘Login OK’
# when Net::HTTPRedirection
# puts    ‘redirect to ‘ + response[‘location’]
# else
# res.error!
# end

# grab the new cookie generated from server contains jadid=XXX
# This is extra line I added, I think the reason is because we are using EAServer.
cookie2 = response.response[‘set-cookie’]

# replace the old one with this authenticated new cookie.
get[‘Cookie’] = cookie2

response = http.request(get)

puts ‘Code = ‘ + response.code
puts ‘Message = ‘ + response.message
# puts response.body


Now I know a little bit more about what happens in  j_security_check.

  1. Client send request, sever check if client has been authenticated. If not, send a JSessionID back to client, then redirect to login page.
  2. Client input credentials, submit form. After validate, server generate a JadID (I think this might be a EAServer unique feature.
  3. Client has to use this updated cookie to continue work.

Free WebTrends , AWStats

Just found it on sourceforge, very nice UI, developed by Perl, installation is not that hard, half an hour at most.

Spent some time on formatting the log file of my special toy, EAServer.

To import all the old log files, the merge tool they shipped with is so graceful. I was on the half way of changing very single logfile manually, because AWStats can only read log chronologically.

LogFile=”C:\App\awstats-6.7\tools\ C:\Sybase\EAServer\bin\eas1phttprequest.log*2007 |”