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.

Tricks:

  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
pause

R8603284386
Advertisements

Use Dos command to pull/deploy version from cc.net

When using Cruisecontrol.net + 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
cls
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

pause

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

pause



exit /b

:help
echo You need to specify the version to deploy
pause

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.

Hybrid_app

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?

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

    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.

PB_INTERNAL_EXCEPTION in EAServer

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 CC.net 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:

build project PBL_NAME PROJECT_NAME SERVER_HOST PORT_NUMBER

Don’t know how to pass userid/password to this orca command. Had to add easerver profile to CC.net 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" />
 </exec>
 </target>

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);
out.println(sum);
%>

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.