Java CAPS Tip : Application Reconfiguration

Following on from my previous blog entry on Reconfiguring Java CAPS EARs I will expand on the functionality available within the Java CAPS 5.1.x iConfigure Tool and how it can be used to reconfigure a deployed EAR file. Then I will compare this with, its evolutionary successor, within Java CAPS 6 configuration utility. Although at present there is no migration tool to move the iConfigure xml files information to the new property structure this would be an interesting sideline project for when I have some free time.

The examples within this blog will be based on a simple Java CAPS 5.1.x project that reads a files and then simply write the contents to a new file. The simple project will be built, deployed and reconfigured. This project will then be imported into the Java CAPS 6 environment and the process repeated. Essentially it will be the File-to-File project described in Erics Application Configuration Wiki entry.

File 2 File Connectivity Map

Reconfiguring a Java CAPS 5.1.X Deployed Application with iConfigure

With the latest release of the iConfigure tool a new top-level, main, class has been added to the jar file. This new class iConfigureDeployed will all the user to modify the configuration of deployed applications based on one of the standard iConfigure Delta XML files previously generated from the EAR and subsequently edited.  The generated File2File application will read from C:\\Temp\\input\*.txt and write to C:\\Temp\\output%d.dat we will reconfigure this to read from C:\\Temp\\input\*.xml  and write to C:\\Temp\\output%d.xml.
  1. Deploy the generated dpFile2File.ear and test that the files transfer occurs for input.txt.
  2. From the command-line execute the following iConfigure Command to generate the configuration. (It is assumed that I have moved the generated ear file to the C:\\Temp directory)
    1. iConfigureGenerate.bat C:\\Temp\\dpFile2File.ear C:\\Temp\\dpFile2File.ear.xml C:\\Temp\\WorkDir
      or
    2. java com.sun.aph.ic.IConfigure -g -f C:\\Temp\\dpFile2File.ear -x C:\\Temp\\dpFile2File.ear.xml -w C:\\Temp\\WorkDir
  3. The result of this will be to generate an XML file containing all the current configuration information for the components within the ear. The two key sections, File In and File Out, information are shown below:

    Input File

    <ConfigProperty>
        <Name>Configuration</Name>
        <Base64Configuration>
            <Header version="" user="" revision="5.1.0.20040923">
                <UserComment/>
            </Header>
            <Section Name="parameter-settings">
                <Parameter Name="InputFileMask" IsLDAPDisabled="false" IsEncrypted="false">
                    <UserComment/>
                    <Value>input\*.txt</Value>
                </Parameter>
                <Parameter Name="PollMilliseconds" IsLDAPDisabled="false" IsEncrypted="false">
                    <UserComment/>
                    <Value>5000</Value>
                </Parameter>
                <Parameter Name="InputType" IsLDAPDisabled="false" IsEncrypted="false">
                    <UserComment/>
                    <Value>Bytes</Value>
                </Parameter>
                <Parameter Name="RemoveEOL" IsLDAPDisabled="false" IsEncrypted="false">
                    <UserComment/>
                    <Value>false</Value>
                </Parameter>
                <Parameter Name="MultipleRecordsPerFile" IsLDAPDisabled="false" IsEncrypted="false">
                    <UserComment/>
                    <Value>false</Value>
                </Parameter>
                <Parameter Name="MaxBytesPerRecord" IsLDAPDisabled="false" IsEncrypted="false">
                    <UserComment/>
                    <Value>4096</Value>
                </Parameter>
                <Parameter Name="Encoding" IsLDAPDisabled="false" IsEncrypted="false">
                    <UserComment/>
                </Parameter>
                <Parameter Name="SerialMode" IsLDAPDisabled="false" IsEncrypted="false">
                    <UserComment/>
                    <Value>true</Value>
                </Parameter>
                <Parameter Name="ResendOnError" IsLDAPDisabled="false" IsEncrypted="false">
                    <UserComment/>
                    <Value>true</Value>
                </Parameter>
                <Parameter Name="Directory" IsLDAPDisabled="false" IsEncrypted="false">
                    <UserComment/>
                    <Value>C:/temp</Value>
                </Parameter>
            </Section>
            <Section Name="MDB-settings">
                <Parameter Name="MaxPoolSize" IsLDAPDisabled="false" IsEncrypted="false">
                    <UserComment/>
                    <Value>1000</Value>
                </Parameter>
            </Section>
        </Base64Configuration>
    </ConfigProperty>

    Output File

    <ConfigProperty>
        <Name>Configuration</Name>
        <Base64Configuration>
            <Header version="" user="" revision="5.1.0.20040923">
                <UserComment/>
            </Header>
            <Section Name="parameter-settings">
                <Parameter Name="OutputFileName" IsLDAPDisabled="false" IsEncrypted="false">
                    <UserComment/>
                    <Value>output%d.dat</Value>
                </Parameter>
                <Parameter Name="AddEOL" IsLDAPDisabled="false" IsEncrypted="false">
                    <UserComment/>
                    <Value>true</Value>
                </Parameter>
                <Parameter Name="MultipleRecordsPerFile" IsLDAPDisabled="false" IsEncrypted="false">
                    <UserComment/>
                    <Value>false</Value>
                </Parameter>
                <Parameter Name="Encoding" IsLDAPDisabled="false" IsEncrypted="false">
                    <UserComment/>
                </Parameter>
                <Parameter Name="Directory" IsLDAPDisabled="false" IsEncrypted="false">
                    <UserComment/>
                    <Value>C:/temp</Value>
                </Parameter>
            </Section>
        </Base64Configuration>
        <Type>java.lang.String</Type>
    </ConfigProperty>



  4. Edit the dpFile2File.ear.xml file and change input\*.txt to input\*.xml and output%d.dat to output%d.xml.
  5. Shutdown your Java CAPS Integration Server
  6. Execute the following:

    java com.sun.aph.ic.IConfigureDeployed -f C:\\Temp\\dpFile2File.ear -x C:\\Temp\\dpFile2File.ear.xml -w J:\\logicalhost\\is\\domains\\domain19000\\applications\\j2ee-apps

    The ear file name is required so that the IConfigureDeployed class can successfully identify the name of the deployment directory. The above command assumes that you have the Integration Server installed in J:\\logicalhost\\is\\domains\\domain19000.

  7. Restart your Java CAPS Integration Server.
  8. Re-run the test. You will notice that input.txt does not get picked up. If you now change it to input.xml it will get picked up and processed.

Reconfiguring a Java CAPS 6 Deployed Application

First we must export the simple File-to-File application from the Java CAPS 5.1.x environment and import it into the Java CAPS 6 repository. The build and deploy the application to the Application Server. Once this has been done we can process modify the configuration as follows:
  1. Deploy the generated dpFile2File.ear and test that the files transfer occurs for input.txt.
  2. From the command-line run:

    asadmin extract-caps-application-configuration dpFile2File.ear.

    asadmin command

  3. This will generate a directory structure that contains configuration files for each of the connections.

    Directory Structure

  4. You can now edit the contents of the properties files and replace the input\*.txt with input\*.xml and output%d.dat with output%d.xml or we can do this after we have imported the contents into the server.
  5. To import the files into the server and thus allow editing from the admin console execute the following:

    asadmin import-caps-configuration caps-config

    asadmin

  6. Open the Admin Console for you Application server and navigate to:

    CAPS->Environment and CM Overrides->CM Overrides
  7. You will see to sub tree for the output and input File eWays. Selecting these will allow you to edit the corresponding information.

    Input Overrides
    Output Overrides

  8. Change the input\*.txt to input\*.xml and output%d.dat to output%d.xml
  9. Disable / Enable ear
  10. Re-run the test



Resources


Comments:

Good information here. It would be nice to address following,

How to back up the configuration changes made from Admin Console? What will happen if following sequence of events take place?

1. An file1.ear file is used to extract the configuration.
2. Environment Configuration is uploaded to the app server.
3. Configuration is modified using the admin console.
4. Another file2.ear file with same external configuration is used to extract the configuration.
5. The configuration extracted from the second file is uploaded to the app server.

Will this overwrite the configuration changes made at step #3 above?

Posted by Rajesh Nayak on October 07, 2008 at 10:53 AM GMT #

je ne comprends pas l'anglais

Posted by leone marie therese on April 01, 2009 at 12:16 PM GMT #

Good information.I tried to use this tool.I am able to generate intermidiate EAR file,but I am unable to genarate XML file.I am getting below exception.Please help me to solve this issue.I am using JCAPS 5.1.3 and JDK 1.6.02

Jun 18, 2009 7:46:32 PM com.sun.aph.ic.IConfigure doWork
INFO: Extracting Ear File D:\\Karunakar\\Total\\TotalEDesigner\\test\\pricinggroup\\dp
PricingGroup.ear
Jun 18, 2009 7:46:58 PM com.sun.aph.ic.IConfigure doWork
INFO: Generating Delta Configuration File D:\\Karunakar\\Total\\TotalEDesigner\\test
\\pricinggroup\\dpPricingGroup.xml
Exception in thread "main" java.lang.NoSuchMethodError: javax.xml.bind.annotatio
n.XmlAccessorType.value()Ljavax/xml/bind/annotation/AccessType;
at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.getAccessType(ClassInfoI
mpl.java:339)
at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.getProperties(ClassInfoI
mpl.java:228)
at com.sun.xml.bind.v2.model.impl.RuntimeClassInfoImpl.getProperties(Run
timeClassInfoImpl.java:87)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder
.java:127)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(Runti
meModelBuilder.java:49)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(Runti
meModelBuilder.java:41)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.
java:189)
at com.sun.xml.bind.v2.model.impl.RegistryInfoImpl.<init>(RegistryInfoIm
pl.java:51)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.addRegistry(ModelBuilder.
java:232)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.
java:201)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContex
tImpl.java:327)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.ja
va:198)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:
76)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:
55)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:
124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:132)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:286)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:337)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:244)
at com.sun.aph.utils.xml.JAXBXMLFactory.unmarshalXMLFromFile(JAXBXMLFact
ory.java:143)
at com.sun.aph.ic.xml.XMLObjectFactory.unmarshalEarApplicationXML(XMLObj
ectFactory.java:115)
at com.sun.aph.ic.ear.v51x.EarTemplateBuilder.generateTemplateApplicatio
ns(EarTemplateBuilder.java:128)
at com.sun.aph.ic.ear.v51x.EarTemplateBuilder.buildDeltaTemplate(EarTemp
lateBuilder.java:118)
at com.sun.aph.ic.IConfigure.doWork(IConfigure.java:146)
at com.sun.aph.ic.IConfigure.run(IConfigure.java:110)
at com.sun.aph.ic.IConfigure.main(IConfigure.java:69)

Posted by Karunakar Reddy on June 22, 2009 at 05:03 AM GMT #

Post a Comment:
Comments are closed for this entry.
About

As a member of the Oracle A-Team we specialise in enabling and supporting the Oracle Fusion Middleware communities.

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today