Tuesday, May 14, 2013

JDeveloper Configuration Essentials

Before starting your development work in JDeveloper I highly recommend taking some time to familiarize yourself with the various preferences that are available to configure in JDeveloper (Tools --> Preferences). Below are some of the essential preferences that I configure after first installing JDeveloper.

1. Tools --> Preferences --> Business Components --> Packages
    Tools --> Preferences --> Business Components --> Object Naming
When creating ADF Business Components I highly recommend setting your default object suffixes and package names in the JDeveloper preferences as is detailed below. This will ensure that when the wizard auto generates these business components they are named correctly and are created in the correct package locations. Depending on the approach you decide to take you can also setup your default base classes and view object tuning parameters. 



2. Tools --> Preferences --> Code Editor --> Line Gutter --> Show Line Numbers
Not much to say other than I like seeing the line numbers in my Java code.


3. Tools --> Preferences --> Code Editor --> Code Style
Your team should decide on which Java coding style you want to follow. This could be a predefined code style or one that you create yourself, just pick one and stick with it. I prefer the Java Code Conventions code style with a few minor modifications. Once you have your code style set you can easily reformat your code by pressing Ctrl + Alt + L in the source. In addition you may want to set the option to reformat your code when pasting which is on the main Code Editor setting.



4. Tools --> Preferences --> Compiler
 When doing a rebuild of your project it's always best to clean out what is currently there to help reduce the risk of any caching issues that you might run into.



5. Tools --> Preferences --> File Types
After coming to the realization that you have wasted a better part of your day waiting for files to open in design mode you will want to change the default editor for the majority of the file types that you use on a consistent basis. I prefer to change the default editor from 'Design' to 'Source' as the files will open up much quicker.


6. Tools --> Preferences --> Shortcut Keys
While I have yet to make any modifications to this section I really recommend taking some time to familiarize yourself with the shortcut keys available in the IDE as this will only make you a much more efficient developer.


7. Tools --> Preferences --> Environment
In order to help alleviate any issues you might run into when switching between a Windows and UNIX type environment I recommend setting your 'Line Terminator' to 'Line Feed (Unix/Mac)' and the default Encoding to UTF-8.






8. Tools --> Preferences --> Code Editor --> Save Actions
JDeveloper allows you to set some predefined actions that will occur when you save a file. I like to use Organize Imports, Trim Trailing Whitespace, and Reformat.


9. Tools --> Preferences --> CSS Editor
I like to change the default CSS level to CSS Level 3






Friday, May 10, 2013

oracle.jbo.JboException: JBO-29000: Unexpected exception caught: oracle.adf.share.security.ADFSecurityAuthenticationException, msg=EXC_NO_AUTHENTICATION_SERVICE

After enabling ADF Security in my ADF 11.1.1.6 application I ran across a strange occurrence where I was no longer able to run the application module tester. The JAAS prompt would successfully display but no matter what credentials I used I always received an ADFSecurityAuthenticationException.




One workaround for this issue is to temporarily disable ADFSecurity by going into the adf-config.xml file for your application and setting the 'authorizationEnforce' and 'authenticationRequire' fields to false in the 'sec:JaasSecurityContext' parameter as seen below.
 
<sec:adf-security-child xmlns="http://xmlns.oracle.com/adf/security/config">
    <CredentialStoreContext credentialStoreClass="oracle.adf.share.security.providers.jps.CSFCredentialStore"
                            credentialStoreLocation="../../src/META-INF/jps-config.xml"/>
    <sec:JaasSecurityContext initialContextFactoryClass="oracle.adf.share.security.JAASInitialContextFactory"
                             jaasProviderClass="oracle.adf.share.security.providers.jps.JpsSecurityContext"
                             authorizationEnforce="false"
                             authenticationRequire="false"/>
  </sec:adf-security-child>

The main drawback to this is that often times you will want to test the application module with security enabled so this is not an ideal workaround. After some investigation I determined that the dreaded 'ADF Model Generic Runtime' was the root of this issue. If the model project that you are running the application module has any indirect or direct references to the 'ADF Model Generic Runtime' you will not be able to run the application module tester with ADF Security enabled. Removing the reference to this library from the project's properties will once again allow you to run the application module tester with ADF Security enabled.


Error During Web Service Proxy Creation - oracle.jdeveloper.webservices.model.WebServiceException: Error creating model from wsdl

When attempting to create a web service proxy in a JDeveloper 11.1.1.6 ADF application you may come across the following error which prevents the creation of the proxy service.

oracle.jdeveloper.webservices.model.WebServiceException: Error creating model from wsdl "http://host.domain.com:port/webservices/SOAProvider/?wsdl" :org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammer(Lorg/apache/xerces/xni/parser/XMLInputSource;)V


 I have found that this is a result of the project that you are creating the web service proxy in having a reference to the 'ADF Model Generic Runtime' library. This reference can either be in the 'Libraries and Classpath' for the project or it can be in the 'Libraries and Classpath' of another project that your project is referencing through the project's dependencies.






You can just remove the reference to the 'ADF Model Generic Runtime' library, save the project's properties, and then try to create the web service proxy again. If you still get the same error make sure you don't have any indirect references to the 'ADF Model Generic Runtime' and restart JDeveloper before trying again. Once the web service proxy is created you can safely add the 'ADF Model Generic Runtime' library back to the project or if you don't feel it is needed leave it out. 

Thursday, May 9, 2013

JDeveloper Studio 11g Installation Tip - Append The Middleware Version To The Directory Name

The installation of JDeveloper Studio 11g is very straight forward. However, appending the middleware version to the default middleware home directory location will allow you to easily install multiple middleware versions on the same machine. This can be helpful when evaluating the most recent middleware version while still continuing development in the old middleware version.