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=

No comments:

Post a Comment

Note: only a member of this blog may post a comment.