Thank you for visiting! If you liked the site, please add a bookmark, else add a critical comment! Would you like to visit Greece? Traditional Greek flag This real estate site is only available in Greek! The holy mountain

Friday 24 February 2012

EJB 3 Deployment guide for WebLogic Server Version: 10.3.4.0

Apart from setting up a domain with the jrf libraries and data sources, presently the books and developer guides for  ADF 11g development do not delve into deployment troubleshooting details, as the prior ADF 10g documentation did. Moreover, the older docs included deployment directions for Tomcat, JBoss, etc, which is currently missing from the 11g versions. This rough guide is a supplement to the docs presenting solutions, workarounds, tips and hints to avoid exceptions during deployment. The following hints and tips about deployment apply to the versions below: Build JDEVADF_11.1.1.4.0_GENERIC_101227.1736.5923
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)

The full version of the guide is available as a personalized pdf file for sale upon request. My contact details can be found at the "About me " page.

 EJB 3 Model security setup

 A primer to ADF security which focuses mainly on Oracle Business Components is given here:
Security for Everyone, By Frank Nimphius at:
http://www.oracle.com/technetwork/issue-archive/2012/12-jan/o12adf-1364748.html
Besides the usual web.xml entries etc, the EJB 3 model project may require more security entries in weblogic-application.xml, as java standard edition clients, ie junit testing ones, require that extra step. Since some people allege isCallerInRole(“”) always returns false, it seems that @RolesAllowed annotation only does not do the job.



private static Context getInitialContext(String user, String password) throws NamingException {
Hashtable env = new Hashtable();
// WebLogic Server 10.x connection details
env.put( Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory" );
env.put(Context.PROVIDER_URL, "t3://127.0.0.1:7001");
env.put(Context.SECURITY_PRINCIPAL, user);
env.put(Context.SECURITY_CREDENTIALS,password);
return new InitialContext( env );
}

 Stand alone server deployment errors

When I tried the application on my integrated WLS, it worked fine. However, the standalone misbehaved:



Weblogic Server Exception: weblogic.application.ModuleException: Failed to load webapp: '...'
Caused by: java.lang.ClassNotFoundException: javax.faces.webapp.ConverterELTag
Solution: add jsf 1.2 library

java.faces.webapp.facesservletNotfound  Exception, 






SOLUTION:
It is raised when migrating an application to newer or older, versions of JDeveloper,
check the viewController project for the proper jsf version library. Is it jsf 1.2, or is it not?


Caused by: java.lang.ClassNotFoundException: oracle.adfinternal.controller.util.LogUtils
Solution: add adf controller runtime library



When I added some more ADF faces run time related jars in JDev I got a new one:
Caused by: java.lang.ClassNotFoundException: org.apache.myfaces.trinidad.webapp.UIXComponentELTag



SOLUTION: In my particular case, ADF & EJB 3, I managed to get away with only:

glassfish.jsf_1.0.0.0_1-2-15
glassfish.jstl_1.2.0.1
javax.jsf_1.1.0.0_1-2
log4j-1.2.15 in META-INF/lib
wls.jsf.di



On the other hand the CAT Conflicts Summary:
There are potential conflicts detected and they do not seem to have been resolved. Please review the potential solutions below.
  • 121 classes are in conflict
  • Those classes are found in the following main packages:
    • oracle.adf.model.*
    • oracle.jbo.client.*
    • oracle.xml.xsql.*
Suggested Solution:
<prefer-application-packages>
   <package-name>oracle.adf.model.*</package-name>
   <package-name>oracle.jbo.client.*</package-name>
   <package-name>oracle.xml.xsql.*</package-name>
</prefer-application-packages>











"DataBindings.cpx" descriptor appears in the application classpath more than once:
SOLUTION: You might do a clean build if you face this error, or delete the remains of the application from
JDeveloper\system11.1.1.\o.j2ee\drs folder for the integrated server.



oracle.jbo.NoDefException: JBO-25002: Definition actionbazaar.DataControls of type null is not found.
Caused by: oracle.mds.core.MetadataNotFoundException: MDS-00013: no metadata found for metadata object "/.../DataControls.dcx"
SOLUTION: restore DataControls.dcx if deleted.



Next the worst of all, might force one to redevelop the application from scratch:
java.lang.NullPointerException
at oracle.adf.model.binding.DCIteratorBinding.getSortCriteria(DCIteratorBinding.java:3758)
at oracle.adf.model.binding.DCInvokeMethod.setAssociatedIteratorBinding(DCInvokeMethod.java:936)
at oracle.adf.model.binding.DCIteratorBinding.cacheRefOnOperation(DCIteratorBinding.java:5274)
at oracle.jbo.uicli.binding.JUMethodIteratorDef$JUMethodIteratorBinding.getActionBinding(JUMethodIteratorDef.java:283)
at oracle.jbo.uicli.binding.JUMethodIteratorDef.isRefreshable(JUMethodIteratorDef.java:59)
at oracle.adf.model.binding.DCExecutableBindingDef.isRefreshable(DCExecutableBindingDef.java:274)
at oracle.adf.model.binding.DCBindingContainer.refreshExecutables(DCBindingContainer.java:3491)
at oracle.adf.model.binding.DCBindingContainer.internalRefreshControl(DCBindingContainer.java:3332)
at oracle.adf.model.binding.DCBindingContainer.refresh(DCBindingContainer.java:2871)
at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.prepareModel(PageLifecycleImpl.java:112)
at oracle.adf.controller.v2.lifecycle.Lifecycle$2.execute(Lifecycle.java:137)
at oracle.adfinternal.controller.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:192)
at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.access$400(ADFPhaseListener.java:21)
at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$PhaseInvokerImpl.startPageLifecycle(ADFPhaseListener.java:231)
at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$1.after(ADFPhaseListener.java:267)
at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.afterPhase(ADFPhaseListener.java:71)
at oracle.adfinternal.controller.faces.lifecycle.ADFLifecyclePhaseListener.afterPhase(ADFLifecyclePhaseListener.java:53)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:398)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:185)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)



An experienced eye would notice the missing “Caused by...” clause due to log truncation. One must dig the full domain log to investigate further. This one is related to missing or corrupted pageDef files. Especially for EJB 3 model projects it might relate to failure of loading beans via jndi or perhaps a malfunctioning Datasource, not created correctly or strangely losing the password. Using local EJB 3 interfaces rather than remote, is recommended for web applications. Some reported that building the application from scratch had been their only workaround. So much for Rapid Application Development (RAD); some others only edited the problematic pages:

1) In the Overview Tab of the page definition file for the problematic page, remove all items (method actions, iterators, trees, etc) in Bindings and Executables, except for the variables entry.

2) In the Application Navigator, rebuild the EJB Session Beans used for this page definition file. Then select these EJB Session Beans (right click) and choose Create Data Control.

3) In the Data Controls window, make sure to click the refresh button.

4) Delete the forms/ tables on the problematic page.

5) Recreate (Click and drag) the forms and/ or tables from the Data Controls for the page in question. And also redefine the method action and other items on your page definition file.

Conclusion

One only hopes when the time comes for deployment to the production application server, it won't be necessary to start development from the beginning. This rarely has been the case for good, old OC4J stand alone server deployments. Perhaps avoiding use of the integrated server and deploying from the early stages of development to the stand alone one is preferable. So much for increasing developer productivity! Finally, one could consult for more tips the resources below.


 References

http://middlewaremagic.com/weblogic by René van Wijk
https://forums.oracle.com/forums/thread.jspa?threadID=931462
http://www.oracle.com/webfolder/technetwork/jdeveloper/howto/11114/managedserver/wlsadfms.html
http://stackoverflow.com/questions/5274693/weblogic-cant-get-roles-for-user-in-ejb3

http://code.google.com/p/nickaiva-blogspot/downloads/detail?name=WebLogic1034DeploymentGuide.pdf&can=2&q=

Friday 23 December 2011

Preview of Oracle JDeveloper 11gR2 Cookbook, by Nick Haralabidis

This new post is an exception to the rule of commenting on  books I have read, or better studied even their code. Since the author is an old colleague and a friend of mine who has helped me in the past, I feel obliged to present his new book, which is currently in preparation. I am afraid I have not studied the whole text, the complete source code is though available; just read some parts of it. Furthermore, enduring for 2 days the second release of JDeveloper  11g was more than just enough for me. IDE XML editing  exceptions popping up all the time! Thus, one can certainly say that I am biased and my preview comments are not complete. I can surely live with that and if you can do so too, let us go on with the presentation!
The master chef who authored the recipes offers valuable advice and plenty of examples of source code, unlike other recently published ADF books who seem to target more to project managers; rather avoid exposing the reader to code. The step by step instructions are easy to follow and implement in your own project, saving you time and effort. Furthermore,  the text contains quite advanced techniques about refactoring, debugging, profiling, testing and optimizing, fine-tuning and monitoring  an ADF application. Such topics are not included even in ADF books written by Oracle stuff. Moreover ignorance of  them has been  in the past  the cause of hiring external consultants and spending all project contingency funds. Nevertheless, the text only mentions using business components as the model technology and not EJBs, neither facelets. Further details about the book one can find here.

Friday 18 November 2011

Comments on Getting Started With Oracle BPM 11gR1 Suite, by Heidi Buelow, Manoj Das, Manas Deb, Prasen Palvankar, Meera Srinivasan

On the bright side the text is well written in American English. It is well organized, full of  helpful images of the older JDeveloper 11.1.1.2 version, tutorials and hands on practice. The setup instructions are accurate, detailed and the full source code is available online too. 
On the dark side, the text is full of marketing lecture, whole chapters of promoting the suite, using rather banal and boring expressions of the type: "best of breed software" and so on.  What is worse is that instead of warning the reader of potential hazards, which might risk a project's outcome, the authors seem to prefer to conceal the product defects.
Consider for example chapter 10. On page 254 it reads: "The next chapter provides instructions on running and testing the process." But what follows is Using Process Composer, neither running nor testing the application. What is more, a defect is hidden here: if one follows the relevant OTN online tutorials to proceed on his own, one hits on a bug, mentioned here. For  the JDeveloper 11.1.1.4 user the process becomes eventually visible in BPM Workspace in Application panel, only if one restarts the application server; which is rather unacceptable for production deployments.
All in all, the book offers a spherical hands on introduction to the BPMN suite, including ADF (sadly only business components, no EJB's) and other relevant technologies by insiders, that is oracle employees. However, a more pragmatic approach to acknowledging defects and providing workarounds, if possible, would be ideal! Furthermore,  a word about the myth of developing via the oracle SOA platform, without writing any Java code, which oracle marketing endorsed.  After all, Mr Piotr Bazan summarizes so right, what the man in the street thinks about it: "Have to say I've never worked with such buggy tools where every step brings a new problem." Isn't that the reasons that JDeveloper related jobs are so hard to find worldwide on the one hand, and the salaries offered  are way more than the average on the other?