Tuesday, November 20, 2012

How to Create Virtual Directory in Weblogic Server

Hi,

You can host your static files like images, javaScript, CSS content to Weblogic server as well. In ideal world these files usually are part of web server but in the absense of HTTP web server like Apache, IIS we can use Weblogic server to host these files.

The benefit of keeping file like that is that all your project's static files like logos, bullets etc etc will reside on OS and in case of any changes all you need to change at OS level instead of application server level.

In summary we will  create a simple app which will use the '/images' context of WLS and all we need to do in our apps to use /images context to retrieve the image.

1. Create a folder on your OS and put all your static images files there
e.g. c:\Jdeveloper\sharedLibs\images\





2. Create Application called 'VirtualDirectoryApp' using Fusion Template

3. Delete Model Project by right clicking it and Click New on ViewController Project and Create weblogic deployment description this will create weblogic.xml file





4. Set the properties of Directories weblogic.xml as shown in the slide



5. Set the context of the application to /virtual



6. Now deploy the WAR file by right clicking the ViewController Project and call the content of directory via following URL

http://myserver:myport/virtual/imagename.jpg





Happy Jdeveloping,
Zeeshan Baig
Follow me on Twitter @baigsorcl
 

Friday, October 5, 2012

Oracle ADF - Using Region Navigation Listener in af:region

Greetings,

Its been long that i have posted something related to ADF. Thanks to my visitors who ask questions to keep me alive.

One reader shared a use case with me as follows

"We have a requirement to collapse a panel in Panel splitter for specific activity in a region"

The answer for that is use Region Listener in af:region component.

The Region Listener have a RegionNavigationEvent argument which can provide the current view in a af:region based on that you can conditionally collapse or expand panel

Example: Download complete example

In my bounded task flow i got 3 views, view 1-3 respectively as shown in the slide.





I have home page with Panel splitter and af:region in facet 2



My use case is to collapse left panel when user navigates to view 2 in a region.





I have a Region Listener as follows



I have panel splitter binding in the bean 



The Region Navigation Listener code is as follows


public class RegionNavigationListener {
    private RichPanelSplitter myPanel;

    public RegionNavigationListener() {
    }

    public void onRegionNavigated(RegionNavigationEvent region) {
        String viewId = region.getNewViewId();        
        
        if (viewId.equalsIgnoreCase("/region-flow-definition/view2")) {
            doCollapsePanel(myPanel);
        }
        else {
            doExpandPanel(myPanel);
        }
    }
    
    private void doCollapsePanel(RichPanelSplitter panel){    
        panel.setCollapsed(true);
        AdfFacesContext.getCurrentInstance().addPartialTarget(panel);  
    }
    
    private void doExpandPanel(RichPanelSplitter panel){    
        panel.setCollapsed(false);
        AdfFacesContext.getCurrentInstance().addPartialTarget(panel);  
    }
    

    public void setMyPanel(RichPanelSplitter myPanel) {
        this.myPanel = myPanel;
    }

    public RichPanelSplitter getMyPanel() {
        return myPanel;
    }
}


Hope you like it 

Follow me on twitter and happy Jdeveloping,
Zeeshan Baig 








Tuesday, August 28, 2012

I am Featured in Oracle Magazine September 2012 issue

Hi,

Its a great honor for me that my profile featured in Peer to Peer section of Oracle Magazine in September 2012 issue. I believe that issue will be main issue for Oracle Open World 2012 as well.

Check the following link Oracle Magazine Peer to Peer September 2012



I am thankful to all who supported through out my career so i can dream of this day and also to people who visited this blog and found it helpful.

P.S. Lot of people asking about the photo...Its Grand canyon Arizona i visited there after collaborate 2012 conference in Las Vegas.

Cheers,
Zeeshan Baig
Follow me Twitter @baigsorcl

Wednesday, July 18, 2012

Sharing Common Connections Between JDeveloper Machines

Hi,

In order to work in a team environment JDeveloper offers many small nuggets that can make our life easier and implement development standards.

In this post we will take a look how to export and import application servers, database connections from one  Jdeveloper machine to another. You can even store these connections in your source control system to share.

Resource Palette:

You will find common place for all connections in JDeveloper under Resource Palette. Click View menu and select Resource Palette




Exporting Connection:

Right click on your desired connection and choose Export, select which connections you want to export and provide the destination, click OK the resulting window will give you the status






Save the destination file to source control or network drive (optional):


For better teamwork i would recommend to store these connections in source control system as shown in the slide i have a folder in Visual SVN repository called Connections and under that the exported file from JDeveloper.






Importing a Connection into JDeveloper


Now developers can export the connections from source control system to their file system and import connections into JDeveloper.






There you go hope you find the post useful feel free to comment. More gold nuggets to follow.

Happy JDeveloping,
Zeeshan Baig






Friday, July 6, 2012

Solution to fix Exception java.lang.NoClassDefFoundError While running weblogic commands from console

Hi,

A quick one here. Most of us might experienced this when try to run weblogic.Deployer or any weblogic related command from console or shell prompt you see something like this

C:\>java weblogic.Deployer
Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/Deployer
Caused by: java.lang.ClassNotFoundException: weblogic.Deployer
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: weblogic.Deployer.  Program will exit.

The problem is NOT with your installation or configuration but actually java is not able to find classes related to weblogic

Solution:

The solution is to add the JAR file into the CLASSPATH variable.

C:\> set CLASSPATH=%CLASSPATH%;D:\Oracle\Middleware1035\wlserver_10.3\server\lib\weblogic.jar

Note:  Change above command as per your environment Linux or Windows also i saw some people add the location of the folder to Classpath which will not fix the issue you should provide the name of the JAR file as mentioned above.

You can see in the slide how the error gone by adding CLASSPATH to the environment.


Monday, July 2, 2012

My Presentation from Kscope 2012 Conference

Hi,

Kscope 2012 conference was a great event for me i am thankful to ODTUG management by providing me this opportunity also OTN who gave me opportunity to be on Fusion middleware panel during Lunch n Learn session.

You can view my presentation from Kscope from my slideshare account. I will post separate blog on the demo details.