Thursday, June 28, 2012

Visual Design Editor Fails To Render Page In JDeveloper 11g

Oracle JDeveloper 11.1.1.3
ADF-BC, ADF RC


While doing some test work, suddenly an error dialog pops-up classnotfound in IDE.
Intially the error was claiming NoClassFound AdfcConfigNode in below screenshot.



And my page look like below -












& Fusion Application Template was missing in New Application dialog.



The first thing to check 'JSP Tag Libraries' in ViewController properties.
Make sure the 'Execute Tags in JSP Visual Editor' is checked for adf components, in 'JSP Tag Libraries'
section. This did not help in restoring the visual design, I deleted IntegratedWLS Installation folder.

Unfortunately, in my case it did not work.

After deleting the IntgratedWLS folder, the error dialog pops-up again like below -



















I started comparing the exact duplicate project in other Project Source.
I compared each tab in 'Technology Scope', that was ok.
Then I checked in 'Libraries & Classpath' section. 4 entries were referencing to
missing libraries-
  1. ADF Page Flow Runtime
  2. ADF Controller Schema
  3. ADF Faces Runtime 11
  4. ADF Controlller Runtime
Removing the entries & again adding from 'Add Library' button finally restored the page in design
visual editor.




-The other way is to check broken design time references in LOG Window.
From Tool > Preferences select "JSP and HTML Visual Editor".
Tick the checkbox "Show Design Time Messages In Log". Press OK to close Preferences Dialog.






Now, when accessing the particular page, Log Window shows, what causing the page to render improperly in design mode. Based on that, further action can be taken.

-Best way is to re-initialize Java Server Faces Servlet by registering below listener in web.xml file in ViewController Project. Issue is resolved instantly in majority cases.
 <listener>  
     <listener-class>com.sun.faces.config.ConfigureListener</listener-class>  
 </listener>  

Save web.xml after modification and shuttle the listener to Selected Listeners list in Project Properties like below. Press OK to close dialog & Save All. Re-open broken page or simply click on page. Editor should try to render the page in original format.

















-Also refer to ADF Code Corner Blog - https://blogs.oracle.com/jdevotnharvest/entry/when_jdeveloper_ide_doesn_t











Wednesday, June 27, 2012

Solving Cannot Load Driver Class: com.microsoft.sqlserver.jdbc.SQLServerDriver In JDeveloper 11g

As last post discussed about how to configure JDeveloper to connect MSSQL Server, it is not enough to run your jsf pages.
To run jsf pages, Integrated WebLogic Server needs to look your sqljdbc4.jar location.
Unless you specify the jar location, you would get "Cannot Load Driver Class: com.microsoft.sqlserver.jdbc.SQLServerDriver".

Platform - Windows 7 x86 Enterprise
JDeveloper - 11.1.1.3
Weblogic - 10.3.3.0
MSSQL Server 2008 Database

You can do in 3 ways either -
1. By defining Classpath in machine.
 a. In your machine set CLASSPATH variable to pointing the saved jar location.

systemvar






























 b. Click New button in System Variables area & follow screenshot.


classpath






























 c. Click OK to close the dialogs.
 d. Now, upon starting, integratedwls will able to look jar file.


2. By defining jar location in startWeblogic.cmd in IntegratedWLS.
 a.Navigate to C:\Users\ralam\AppData\Roaming\JDeveloper\system11.1.1.3.37.56.60\DefaultDomain\bin .

 b.Open startWebLogic.cmd file & look for "set SAVE_CLASSPATH"(without quotes) or "set
    CLASSPATH" (without quotes) entry.

 c.Put in any entry your jar file location & close to save the file, like this -

startweblogic

3. The last way is to save your jar file at this location in Integrated WLS installation folder -
    C:\Users\ralam\AppData\Roaming\JDeveloper\system11.1.1.3.37.56.60\DefaultDomain\lib\


Tuesday, June 26, 2012

Connecting MS SQL Server Database From Oracle JDeveloper 11g

This post addresses connectivity issue to Microsoft SQL Server Database 2008 from JDeveloper 11g.

Platform - Win 7 x86 Enterprise
MS SQL Server 2008 Database Engine
JDeveloper 11.1.1.3

Oracle JDeveloper 11g uses JDBC 4.0 to connect with RDBMS since JDK1.6 supports JDBC4.0 & JDeveloper uses JDK 1.6 to compile all its classes.
ojdbc6.jar classes to support basic functionality for the Thin and OCI drivers when using JDK 1.6 (JSE6) with Oracle database. Additional jar files are required when you use some features. See Oracle JDBC FAQ .

Well, that was of Oracle Database. MS SQL Server provides SQLJDBC4.jar class library, which provides support for JDBC 4.0. If you dont have this jar files, you won't be able to connect to MSSql server database. You can download from Microsoft.

1. Download sqljdbc4.jar from microsoft & save in filesystem.

2. Open JDeveloper & register the library file from Tool > Manage Libraries.

3. Click 'New' button by keep selecting 'User' Node.

4. In the 'Create Library' dialog click 'Add Entry' & locate your sqljdbc4.jar file & click 'Select' .

5. Optionally, you can check 'Deployed by default'.


managelibrary

6. Click OK.

7. Now, you are ready to establish connection to MSSQL Server.

8. Make sure your sqlserver engine is running & the account you are going to use for connect, is not
    locked.

9. From Database Navigator, create a new connection.

10.Next Screenshots are self explanatory except for 'Library' field where click 'Browse' & locate the jar file
     from 'Select Library' dialog.


selectLibrary

ConnectionDialog

































11. Click Test Connection to test the connection.

Saturday, June 23, 2012

Get Current Actual Value Of AF:SelectOneChoice In ValueChangeListener

Oracle JDeveloper 11.1.1.3
ADF Faces Rich Components

Sometime your program logic needs to get Actual value of selected item in af:selectOneChoice in java code.
And SelectChoice is attached by a VO for fetching all values.
Well, when you use some basic operations in ValueChangeListener method, you notice that its returning only the index of item or old actual value.

Refer some codes -
 String selectedItem = (String)selectListBinding.getAttributeValue() ;  //old actual value  

 valueChangeEvent.getNewValue() ; //will give new index no irrespective of valuePassThru = true/false  

 valueChangeEvent.getOldValue();  //will give old index no irrespective of valuePassThru = true/false  

 Row row = (Row)selectListBinding.getSelectedValue();  
 oracle.jbo.domain.Number no= (Number)row.getAttribute("Deptid");//Old actual value  

Here is successful approach for getting Actual Selected Current Value & not the old value.

Set Autosubmit=true for SelectChoice.Goto PageDef of your jsf page.
Right click on bindings node then insert inside bindings , Generic Binding &
Attribute Values.In the dialog, choose your parent ViewObject Iterator & then attribute
on which LOV was created.

Write this code in Listener Method -
 public void SelectionListener(ValueChangeEvent valueChangeEvent)  
 {  
   BindingContainer container = BindingContext.getCurrent().getCurrentBindingsEntry();  
   valueChangeEvent.getComponent().processUpdates(FacesContext.getCurrentInstance());  
   AttributeBinding attrIdBinding = (AttributeBinding)container.getControlBinding("Deptno");  
   //Deptno is ID of an Attribute Binding in pageDef 
  
   oracle.jbo.domain.Number Id = (Number)attrIdBinding.getInputValue();  
   System.out.println("Id- " + Id);  
 }  

Error Starting Integrated WebLogic Server By ALOCKOUT.DLL

Platform - Windows 7 x32 Enterprise
JDeveloper - 11.1.1.3
Weblogic Server - 10.3.3.0

One day I had hard time when deploying my application. During intial deployment, it was successful with some warning in log windows.These were showing first time to me. After 2-3 attempt to run the application
I got the severe error continuously. I removed the IntegratedWLS installation from local directory to cleanup the environment.

Now it get worst when tried to create fresh IntegratedWLS domain instance.
The weblogic create command denied to build new domain after setting the environment successfully.

I got this error -
wlst > Failed to get environment, getEnv command (set) did not print environment as key=value lines.
wlst > Output=CreateFileandSetSecurity failed with FALSE (Expected on FAT Partitions) GLE: 3
wlst > CreateFileandSetSecurity failed with TRUE (not expected) GLE: 3

--
--
wlst > Error:  ADRS_DOMAIN_PASSWORD environment variable not set.

The Log Window warning some days back was -

CreateFileandSetSecurity failed with FALSE (Expected on FAT Partitions) GLE: 3
 
CreateFileandSetSecurity failed with TRUE (not expected) GLE: 3

The problem was Microsoft Windows Distribution Kit file, ALOCKOUT.DLL .
Basically, Alockout.dll tracks every exe file for sending bad passwords to Active Directory in domain
controller.

Removing the file & de-registring the entries from Regedit solved the problem.
Please refer how to remove Alockout.dll completely from your machine.

Fixing IE 8 Crashes For JInitiator 1.3.1.21 In Win7.

The IE 8 was crashing when launching oracle applications forms . The solution is to replace jvm.dll in JInitiator 1.3.1.21 directory with that present in Sun's JRE 1.6.

1. First download the correct version of JInitiator while launching to forms which in my case 1.3.1.21.
2. Install JRE 1.6 in your machine.
3. Rename the jvm.dll to jvm.dll.orgi in 'C:\Program Files\Oracle\JInitiator
    1.3.1.21\bin\hotspot'.
4. Move the jvm.dll from 'C:\Program Files\Java\jre6\bin\client' to 'C:\Program Files\Oracle\JInitiator
    1.3.1.21\bin\hotspot'.

OR

You can also download jvm.dll for oracle forms/report compatible with its JInitiator to IE8 from here & replace the same in JInitiator directory.

IE 8.0
Make sure the following settings are corrected in IE8.0-
Tools > Internet Options > Advanced > Uncheck "Enable third-party browser extensions"




Start Production Weblogic Server Automatically When Server Machine Starts.

In this post I am going to explain, how you can configure Production Weblogic Server Machine to start weblogic services, automatically when Administrator logs-in. The same you can achieve when only machine
starts, but you would not able to see command window when you get logged-in.

Weblogic Production Server - 10.3.3.0 (11g)
Server Machine OS - Windows Server 2008 SP1 64 Bit , Intel Xeon Processors (2)

1.  Logged into your server machine.

2.  Check the location of startWebLogic.cmd command script at 'C:\Oracle\Middleware3
     \user_projects\domains\sbgom\bin\' according to your filesystem.

3.  Anywhere in your filesystem create a .bat file & name as 'weblogicAutoStart'. Explicitly check the
     .bat extension by looking properties of file.

4.  In the batch file write start /min %SystemRoot%\system32\cmd.exe /k"C:\Oracle\Middleware3
     \user_projects\domains\sbgom\bin\startWebLogic.cmd" & Save.

5.  Note the /min parameter is only to start command window in minimized mode. You can remove if dont
     want.

6.  Now you can invoke this bat file when Admin logs-in by Windows Task Scheduler.

7.  Open the Task Scheduler from Administrative Tools in Control Panel.

8.  In the Task Scheduler right click to Create Task. In the Wizard dialog, in Name field of General Tab give
     an appropriate task name like 'WebLogicAutoStart'.

9.  In the Trigger Tab click New button. Select At Logon from dropdown & choose Specific User or 
     Group radio button.

10.In the Actions Tab, click New button & select Start A Program from dropdown in Edit Action dialog.

11.Click Browse button to locate your bat file & Press OK & OK. Its done.



How to reload whole jsf/jspx page from bean in JDeveloper 11g ?

Oracle JDeveloper 11.1.1.3
ADF Faces Rich Components


Sometimes requirement is to refresh whole jspx page from root . By simple java bean code this can achieve.
 public String refreshPage_action() {  
    FacesContext fctx = FacesContext.getCurrentInstance();  
    String pageToRefresh = fctx.getViewRoot().getViewId();   //getting View Id of current page  
    ViewHandler viewHandler = fctx.getApplication().getViewHandler();      
    UIViewRoot viewRoot = viewHandler.createView(fctx, pageToRefresh);   //ViewRoot for current page  
    viewRoot.setViewId(pageToRefresh);  
    fctx.setViewRoot(viewRoot);     //set the viewroot in facesContext to reload  
    return null;  
 }   

How to remove installed extensions in JDeveloper 11g ?

Windows 7 Enterprise
Oracle JDeveloper 11.1.1.3

From Help > Check For Updates menu, you can install new extensions either from 'Search Update Centers' or 'Install From Local File'.

When you want to remove those extensions from IDE manually, you can goto filesystem & should remove
the related .jar files. This would completely remove the extension.

The location in my machine is - C:\Oracle\Middleware11g\jdeveloper\jdev\extensions.

Alternatively, the extension can be disabled or enabled from JDeveloper.
From Tools > Preferences > Extensions the list of installed extensions can be found.
Deselect desired extension to stop loading in IDE.

In future, if same extension want to use again, this can be enabled from here.

Thursday, June 21, 2012

Edit Dynamic Tab Shell Layout (DynamicTabShell.jspx) page in JDeveloper 11g


Windows 7 Enterprise
Oracle JDeveloper 11.1.1.3
WebLogic Server 10.3.3.0

This post is about to show the steps involved to edit the Dynamic Tab Shell Layout (DynamicTabShell.jspx) page in Jdev11g-ADF.

1.  Goto this location C:\Oracle\Middleware11g\jdeveloper\adfv\jlib, according to your installation folder.
2.  Create a folder CUSTOMIZATION.
3.  Open CMD command promt.
4.  Navigate to 'C:\Oracle\Middleware11g\jdeveloper\adfv\jlib\CUSTOMIZATION' by CD command.
5.  Execute in CMD 'C:\>jar xf oracle-page-templates-ext.jar'. Your JDK should be
     registered in PATH variable under Environment Variables in your machine.
     Command Prompt should return with no errors. IF necessary you can put exact path of
     'oracle-page-templates-ext.jar' .
6.  Now, navigate by windows explorer
     'C:\Oracle\Middleware11g\jdeveloper\adfv\jlib\CUSTOMIZATION\ORACLE\UI\PATTERN\
     DYNAMICSHELL\
7.  While opening Jdev already, double click to open 'dynamicTabShell.jspx' in IDE.
8.  Now, you are ready to Edit the template page as per your need. Main requirement is to decrease the
     bottom space in page. You can also edit other things.
9.  After editing Save the file & Close from IDE.
10.Now, its time to re-package all the extracted files. Navigate to 'CUSTOMIZATION' folder in CMD.
11.Type 'jar cfM0 oracle-page-template.jar *'. [0~Zero]
12.This will create a 'oracle-page-template.jar' packaged file containing edited jspx file & others, in same
     location.
13.Copy 'oracle-page-template.jar' file & paste in 'C:\Oracle\Middleware11g\jdeveloper\adfv\jlib' or under
     middleware installation directory.

14.Now, you can use this jar file in your project to use edited dynamicTabShell.jspx.
15.By default your project will be using 'Oracle Extended Page Templates' reference with
     'oracle-page-templates-ext.jar' file from path 'C:\Oracle\Middleware11g\jdeveloper\adfv\jlib'.

16.Open your Application.jws, right click 'ViewController > Properties > Libraries & Classpath'.
17.Remove the 'Oracle Extended Page Templates' in the Classpath Entries.
18.Add 'oracle-page-template.jar' from 'C:\Oracle\Middleware11g\jdeveloper\adfv\jlib', by
     clicking 'Add/Jar directory'.
19.Click OK & run application to see new changes in template page & you done !

Be careful, when you take these source project files in other machine. You should also ship
'oracle-page-template.jar' & save in that machine & re-register in Classpath Entries with exact path.