ClassLoader.getResource return null

By W.ZH Mar 2010

See also ;
classloader and classpath

Issue:

In Weblogic server, When I try to call ClassLoader.getSystemResource(“AAA.jar”) from a EJB project, not an web application, always return null. i paste my jar to the domain’s lib, JRE’s lib, bin folder,  jdk’s bin/lib folder, but still this jar can not be found.

Reason:

It is very hard to understand that lib in the domain not be picked up to look up for jar. So the way is to find which fold WLS try  to lookup when u want to add a new jar to your system.

Solution:

You can input an empty “” to the getter to see what the default folder that WLS try to search for jars.

System.out.println (ClassLoader.getSystemResource (“”));

this.getClass().getClassLoader().getResource(“” ));

this.getClass().getClassLoader().getSystemResource(“” ));

Haha.. then i get that WLS try to load from wls ‘s common/lib folder… paste my AAA.jar to that folder , then system find the jar file as a resource.

Refer to :
 http://www.codeweblog.com/java-rcp-absolute-path-and-relative-path-of-access-to/

 

 

Advertisements

classloader and classpath

Some sample code to get class path , from which jar it is loaded:

private void printclasspath(Class cls) {

Class klass = cls;

URL location =

klass.getResource(‘/’ + klass.getName().replace(‘.’, ‘/’) +

“.class”);

System.out.println(” location is  ” + location.getFile());

}

private String getPath(Class cls) {

String cn = cls.getName();

String rn = cn.replace(‘.’, ‘/’) + “.class”;

String path = getClass().getClassLoader().getResource(rn).getPath();

int ix = path.indexOf(“!”);

if (ix >= 0) {

return path.substring(0, ix);

} else {

return path;

}

}

Common Cmd in Linux

 To list the folder size  du- hs /your/folder
  To list free memory  free -t –m
 to list all the process:  ps -ef      or    ps -Af
 To do a remote copy from A to B server  scp -r userA@10.1.1.1:/home/userA/sourcefolder/ userB@10.1.1.3:/home/userB/
 check linux version  uname -a
 List disk space  df -h
 To  find file and delete them  : find all CVS hidden fodler and remove them  find ./ -name CVS -exec rm -rf {} \;

 

 

 

QuickTest Professional

By W.ZH

i am just doc this tool here as it might be used any project for UI testing. Beside the Selenium, this is a web UI automation testing tools developed by HP but widely used in the Oracle ADF project testing.

Because it can support the add-in extension, it supplies a lot ability to test the advance web UI by JAVA and .NET. And test script can make you do the function and regression test.

http://en.wikipedia.org/wiki/HP_QuickTest_Professional#Extensibility

 

 

 

How to change configurable values in Oracle Service Bus projects

By W.ZH July 2011

Issue:

You know, in the SOA composite application, when u do the deployment, you can compose a config plan file to dynamically change some data and values in the BPEL projects to meet your server IP/Port and other environment. Does OSB project has similar feature? Such as you have a PS point to a BS, Business Service created from a WSDL which is from a developing server IP and port, so when you go the deploy this OSB project to the production server, how to change this IP and port info?

Solution:

OSB has similar feature called Customization File:  From OSB manage console:

System Administration –>Customization –>

Find & Replace

Create Customization File

Execute Customization File

You can Create a Customization File for your project. It is a XML file, open it and you see many resources can be changed.

You change this file’s data , and then you can Execute your Customization File, then new values will be applied to your project.

This Customization File also can be used in the WLST, when you try to import the OSB project into the OSB server by WLST py file, you can also use a Customization File

to replace your project data and make it imported to OSB server with new settings. I will have another article to introduce the WSLT import OSB project.

 

How to change IP/host and other varibles for SOA application deployment

By W.Zh Jan 2011

Issue:

When I create a soa compisite application, which mostly includes some WS call, needs the wsdl end point host, port for URL… then your BPEL process run against the WS. But when u deploy from jdevelpoer you found you can not change your WSDL host and port info, as all these ip and port are used in the composite.xml in the app… It can not change after u deploy.  So u can not deploy to a new server to run the WS end point.

Solution: 

In fact, this is a very basic issue in SOA, but initially we think this is very hard thing. SOA developer guide introduces something called configuration plan file. In fact it is a XML can let u replace these variables in the composite.xml for different deployment. You can read the SOA dev guide 41.6 chapter to use the jdev to create and edit the configplan file.  When u deploy from Jdev, u can refer to use what config plan file for a deployment.

When u deploy from WLS EM console UI, in the SOA admin guide chapter 5, you can point to use a config plan file to define this deployment uses what plan file to replace these variables.

Based on this plan file, you can also use OUI to collect the user input for these replaces, in the OUI install steps, and then u change the plan file content in OUI and make your application installtion can fit user’s server enviroment. And also if you deploy from ant, you can use the plan file too.

This is very useful!.

ADF Business Components Service relation to normal WS

By W.Zh Oct 2011

ADF Business Components Service in the fusion dev guide is the web service interface that exposed from a BC Application Module. But BC Service is not a normal web service. It has more features than a normal webservice.

  1. For a normal web service, if you want access from your java code, in Jdev, you can create a static client proxy code call this WS. If you have the BC service, you still can do this way. This means you can invoke BC service like others normal WS in your java application code.
  2. If you have one ADF web application to invoke another BC service remotely, then best way to access the BC Service, is not through the java WS static proxy code to call it. You should use the oracle.jbo.client.svc.ServiceFactory to invoke the BC service. You get more benefit by this way. See the chapter 41 of the “Oracle Fusion Applications Developer’s Guide”.
  3. If you have one SOA composite application, you want to invoke a BC service remotely, you have two choices here for  SOA access the external WS service,  one is called “ADF-BC service”. This one is dedicated for BC service, another one called “Web Service”. Of course, the best way to use the “ADF-BC service”.
  4. By “ADF-BC service” and oracle.jbo.client.svc.ServiceFactory you can invoke the BC service, and you also can access the SDO objects which exposed via this service. So you can change these SDO data, and save to DB. Do not need to call some method in service interface method to do that. You have to refer to fusion dev guide to see how to use this.  In SOA, there are something called “entity variables” in BPEL can use SDO object from partner links (Such as ADB-BC links).

 

Some examples to create BC service and consumed by a SOA application, and entity variables.

 

http://go2kavinkumar.wordpress.com/tag/adf-bc-service/

http://go2kavinkumar.wordpress.com/2011/08/16/invoking-an-adf-bc-service-asynchronously-from-soa-composite-bpel-11g/

http://jianmingli.com/wp/?p=2838