Wednesday 2 October 2013

Webservice deployment in weblogic managed server using ant

I have created the ant script for Webservice deployment into SOA server. This script will work for deployment and undeployment of Webservice.




<project name="Helloworld-WS" default="deploy">
<property name="deploy.username" value="weblogic" />
<property name="deploy.password" value="welcome1" />
<property name="deploy.hostname" value="localhost" />
<property name="deploy.port" value="7001" />
<property name="Target.server" value="soa_server1"/>
<property name="project.name" value="Helloworld-WS" />
<property name="proj.dir" value="${outputdir}/${project.name}"/>
<property name="deploy.source" value="${proj.dir}/Helloworld-WS.ear" />

<!-- Setting TaskDefinition -->
<taskdef name="wldeploy" classname="weblogic.ant.taskdefs.management.WLDeploy">
<classpath>
<pathelement location="C:/oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar"/>
</classpath>
</taskdef>

<!-- Deploying Applications  -->
<target name="all">
<wldeploy action="deploy"
          name="${project.name}"
        source="${deploy.source}"
        user="${deploy.username}"
        nostage="true"
        password="${deploy.password}"
        verbose="true"
          targets="${Target.server}"
        adminurl="t3://${deploy.hostname}:${deploy.port}"/>
</target>

<!-- Uneploying Applications  -->
<target name="undeploy">
<wldeploy action="undeploy"
         name="${project.name}"
         failonerror="false"
         user="${deploy.username}"
       password="${deploy.password}"
     verbose="true"
     targets="${Target.server}"
                     adminurl="t3://${deploy.hostname}:${deploy.port}"/>
</target>
</project>

Wednesday 18 September 2013

Undeploy multiple SOA composites using ANT

We have a requirement in the current project for a solution to undeploy multiple composites at one time using script. So that we can have nightly build and deployment.
As per my knowledge we don't have direct solution to undeploy  all composites in one shot like soa 10g without deleting domain.
we can delete the partition and recreate the partition.

The below code snippet is suitable for separate targets for each composite.

We have to refer the ant-sca-mgmt.xml with our custom ant target.

<import file="/utilities/ant-sca-mgmt.xml"/>

Below is the code snippet, you can use to remove  all composites of the given partition as well as the partition itself.

<antcall target="deletePartition" inheritall="false">

<param name="platform" value="weblogic"/>
<param name="host" value="vinodfusion"/>      
<param name="port" value="8001"/>      
<param name="user" value="weblogic"/>      
<param name="password" value="welcome1"/>      
<param name="partition" value="default"/>  

</antcall>
<antcall target="createPartition" inheritall="false">

<param name="platform" value="weblogic"/>  
<param name="host" value="vinodfusion"/>      
<param name="port" value="8001"/>      
<param name="user" value="weblogic"/>      
<param name="password" value="welcome1"/>      
<param name="partition" value="default"/>    

</antcall>

Saturday 17 August 2013

java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException in SOA 11G deployment



java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException in SOA 11G 


java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException
         at oracle.integration.platform.blocks.deploy.servlet.client.ant.DeployCompositeTask.execute(DeployCompositeTask.java:95)
         at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
         at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
         at org.apache.tools.ant.Task.perform(Task.java:348)
         at org.apache.tools.ant.Target.execute(Target.java:392)
         at org.apache.tools.ant.Target.performTasks(Target.java:413)
         at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
         at

org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
         at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
         at org.apache.tools.ant.Main.runBuild(Main.java:811)
         at org.apache.tools.ant.Main.startAnt(Main.java:217)
         at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
         at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.cli.ParseException
         at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1365)
         at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1315)
         at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1068)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
  

Solution:


"commons-cli-1.1.jar" is missing from SOA Suite installation.


The library can be copied from another machine following this steps:
1.Copy from another machine the "commons-cli-1.1.jar" file. This can be found in another SOA install or with JDeveloper 11g.
2. Place it under your <MW_HOME>/oracle_common/soa/modules.

You can download from the below link: Download


For more details, please see Ramsblog

Thursday 11 July 2013

ant-sca-compile.xml:158: C:\Program\lib does not exist.



Issue: ant-sca-compile.xml:158: C:\Program\lib does not exist.



Building in workspace C:\Dump\Vinodfusion
[Vinodfusion] $ cmd.exe /C '"c:\ant\bin\ant.bat -file DeploymentScripts -Dproperties="" -DOutput="" -DMDS="" -Dwn.bea.home=C:/Oracle/Middleware -DTemp="" -Dserver.user=weblogic -DoutputRootDir="" -Ddeployment.plan.environment=dev -Ddev.port=8001 -Dmds.enabled=true -Dtmp.output.dir=logs -DApplications/Projects="" -DFiles/Java/jdk1.6.0_34="" -DChoose="" -Ddev="" -Dwl_home=${wn.bea.home}/wlserver_10.3 -Doracle.home=C:/oracle/JdevMWHome/jdeveloper -Dmds.undeploy=false -DDeployment="" -DC=/builds/Vinodfusion -DbuildVersion="" -DProperties="" -Ddev.overwrite=true -Dmds.applications=true -Dapplications.home=../VinodfusionServices -Ddev.serverURL=http://vinodfusion:8001 -Dneed="" -D${outputRootDir}/${buildVersion}="" -DRevision="" -DGlobal="" -Dserver.password=welcome1-D1.0.0.1="" -Dservers="" -Djava.passed.home=C:/Program -Ddev.forceDefault=true -Dwhich="" -Dthe="" -D-------------------------="" -Drev=1.0 -DGeneral="" -Dlogs="" -Dapplication=Vinodfusion -Dserver="" -DDevelopment="" -DApplication="" -Ddev.password=octagon8 -DDetails="" -DServices="" -Dfor="" -DDirectory="" -DSpecific="" -DoutputDir="" -Denvironment="" -DEnvironment="" -Ddeployed="" -Dinformation="" -Ddev.server.host=vinodfusion -Dweblogic="" -Ddeployment="" -DSOA="" -D-----------------------------------------------------------------------="" -Ddev.user=weblogic -DProject="" -Dbe="" -Dcredential="" -Dto="" -Dmds.local.seed=../VinodfusionMDS/Seed -D= -Dbuild.properties="" buildAll && exit %%ERRORLEVEL%%"'
Buildfile: C:\Dump\Vinodfusion\DeploymentScripts\build.xml
     [echo] basedir C:\Dump\Vinodfusion\DeploymentScripts
     [echo] Ant: Apache Ant(TM) version 1.8.3 compiled on February 26 2012 Java: 1.6
    [input] skipping input as property server.password has already been set.
     [echo] oracle.home = C:/oracle/JdevMWHome/jdeveloper

BUILD FAILED
C:\Dump\Vinodfusion\DeploymentScripts\build.xml:14: The following error occurred while executing this line:
C:\Dump\Vinodfusion\DeploymentScripts\buildofmservices.xml:14: The following error occurred while executing this line:
C:\Dump\Vinodfusion\DeploymentScripts\ant-sca-compile.xml:158: C:\Program\lib does not exist.

Total time: 3 seconds
Build step 'Invoke Ant' marked build as failure
[WeblogicDeploymentPlugin] - build didn't finished successfully. The plugin execution is disabled.
[INFO] ------------------------------------------------------------------------
[INFO] DEPLOYMENT FAILURE
[INFO] ------------------------------------------------------------------------
Sending e-mails to: vinodreddy14@gmail.com
Notifying upstream projects of job completion
Finished: FAILURE


Resolution:

We noticed that values in  build.properties in jenkins are word wrapped( Means values are not completed in one line). Removed the word wrapp and Re-initiated in deployment and we are able to overcome the issue.

Issue: Java compilation failed.Failed to compile file(s) Method getVersions(java.lang.String, java.lang.String, java.lang.String) not found in class



Java compilation failed.Failed to compile file(s) Method getVersions(java.lang.String, java.lang.String, java.lang.String) not found in class

 



BUILD FAILED

Java compilation failed.
Failed to compile file(s) "Helloworld.bpel".
Exception reported is: Helloworld.bpel:710: Method getVersions(java.lang.String, java.lang.String, java.
lang.String) not found in class com.vinodfusionresearch. bpel.Helloword.HelloworldBPEL.
        String outputFileVersion = HelloworldBPEL.getVersions(taskID,userID);



Resolution:

Developer forget to promote Helloworld.java file.