Friday, July 22, 2016

JDeveloper 12c error javax.naming.NameNotFoundException: While trying to lookup 'jdbc.LocalSvcTblDataSource'

Today I noticed mysterious error when I run any web application in my JDeveloper 12.2.1. This is the stack trace:
[ecid: badadddc-e435-47c7-9b26-b7a8c0331704-00000048,0] [partition-name: DOMAIN] [tenant-name: GLOBAL] CCW auto-republish services error [[
com.oracle.cie.servicetable.external.ServiceTableException: javax.naming.NameNotFoundException: While trying to lookup 'jdbc.LocalSvcTblDataSource' didn't find subcontext 'jdbc'. Resolved ''; remaining name 'jdbc/LocalSvcTblDataSource'
 at com.oracle.cie.servicetable.impl.ServiceTableImpl.getOnlineLocalServiceTableConnection(ServiceTableImpl.java:99)
 at com.oracle.cie.servicetable.impl.ServiceTableImpl.getLocalConnection(ServiceTableImpl.java:223)
 at com.oracle.cie.servicetable.impl.ServiceTableImpl.query(ServiceTableImpl.java:405)
 at com.oracle.cie.servicetable.impl.ServiceTableImpl.query(ServiceTableImpl.java:379)
 at oracle.as.ccw.jmx.CCWCache.autoRePublish(CCWCache.java:320)
 at oracle.as.jmx.framework.wls.spi.WLSInternalEventsListener.processEditSessionChanges(WLSInternalEventsListener.java:376)
 at oracle.as.jmx.framework.wls.spi.WLSInternalEventsListener.handleEvent(WLSInternalEventsListener.java:198)
 at weblogic.management.eventbus.spi.InternalEventBusImpl.send(InternalEventBusImpl.java:75)
 at weblogic.management.provider.internal.RuntimeAccessDeploymentReceiverService.doCommit(RuntimeAccessDeploymentReceiverService.java:574)
 at weblogic.management.provider.internal.RuntimeAccessDeploymentReceiverService.commit(RuntimeAccessDeploymentReceiverService.java:435)
 at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
 at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.commit(DeploymentReceiverCallbackDeliverer.java:64)
 at weblogic.deploy.service.internal.statemachines.targetserver.AwaitingCommit.callDeploymentReceivers(AwaitingCommit.java:266)
 at weblogic.deploy.service.internal.statemachines.targetserver.AwaitingCommit.handleCommit(AwaitingCommit.java:121)
 at weblogic.deploy.service.internal.statemachines.targetserver.AwaitingCommit.receivedCommit(AwaitingCommit.java:44)
 at weblogic.deploy.service.internal.transport.CommonMessageReceiver.receiveRequestCommitMsg(CommonMessageReceiver.java:597)
 at weblogic.deploy.service.internal.transport.CommonMessageReceiver$3.run(CommonMessageReceiver.java:883)
 at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:643)
 at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)
 at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)
 at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)
 at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
 at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:617)
 at weblogic.work.ExecuteThread.execute(ExecuteThread.java:397)
 at weblogic.work.ExecuteThread.run(ExecuteThread.java:346)
Caused by: javax.naming.NameNotFoundException: While trying to lookup 'jdbc.LocalSvcTblDataSource' didn't find subcontext 'jdbc'. Resolved ''; remaining name 'jdbc/LocalSvcTblDataSource'
 at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1224)
 at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:268)
 at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:217)
 at weblogic.jndi.internal.BasicNamingNode.lookupIgnorePartition(BasicNamingNode.java:1503)
 at weblogic.jndi.internal.PartitionHandler.lookupSharable(PartitionHandler.java:88)
 at weblogic.jndi.internal.ServerNamingNode.lookup(ServerNamingNode.java:584)
 at weblogic.jndi.internal.RootNamingNode.lookup(RootNamingNode.java:81)
 at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:307)
 at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:430)
 at javax.naming.InitialContext.lookup(InitialContext.java:417)
 at com.oracle.cie.servicetable.util.JdbcUtil.getOnlineLocalSvcTblConnection(JdbcUtil.java:383)
 at com.oracle.cie.servicetable.impl.ServiceTableImpl.getOnlineLocalServiceTableConnection(ServiceTableImpl.java:92)
 ... 24 more

]]

After long investigation ... Eureka ... The missing datasource isn't associated with concrete web application. This is built-in "feature":) caused by the fact that the default Derby Server supplied with JDeveloper 12c is not running.

But what is the reason the Derby is not starting?

It turned out that the cause of error is upgrade of JDK. In JDK 7U51 (and above) the default socket permissions assigned to all code including untrusted code have been changed. This was described here: http://www.oracle.com/technetwork/java/javase/7u51-relnotes-2085002.html.

But how to resolve this issue?

The simplest way is modyfying Derby start scripts. In my case I need find startNetworkServer.bat which is located in:
%WL_HOME%\common\derby\bin\startNetworkServer.bat

In this script you should modify line:
"%_JAVACMD%" %DERBY_OPTS% -classpath "%CLASSPATH%;%LOCALCLASSPATH%" org.apache.derby.drda.NetworkServerControl start %DERBY_CMD_LINE_ARGS%

replacing it by:
"%_JAVACMD%" %DERBY_OPTS% -classpath "%CLASSPATH%;%LOCALCLASSPATH%" org.apache.derby.drda.NetworkServerControl start -noSecurityManager %DERBY_CMD_LINE_ARGS%

In Linux/Unix systems you need find script startNetworkServer, and modified line should looks like:
derby_exec_command="exec \"$JAVACMD\" $DERBY_OPTS -classpath \"$LOCALCLASSPATH\" org.apache.derby.drda.NetworkServerControl start -noSecurityManager $@"

  • There is also the better solution. You can edit the "java.policy" file: 
  • Locate the directory of your JDK. 
  • Navigate to the directory: /jre/lib/security 
  • Open the file "java.policy" in an editor 
  • Add following line to the already present grants: 
    • permission java.net.SocketPermission "localhost:1527", "listen"; 
  • Save the file. 
  • Restart the integrated WebLogic server.
Ok. And here's the puzzle: Why I prefer worse (first) solution ... ?

Wednesday, March 16, 2016

class.getResources()



getClass().getResource()
searches relative to the .class file while
getClass().getClassLoader().getResource()
searches relative to the classpath root.

To obtain current path you can run
public game(){
    String currentPath = this.getClass().getResource("").getPath();
    System.out.println(currentPath);
}
or respectively
public game(){
    String currentPath = this.getClass().getClassLoader().getResource("").getPath();
    System.out.println(currentPath);
}

WebcenterSites Failed gateway redirect java.io.UnsupportedEncodingException: Redirect failed due to illegal URL http://192.168.0.100:7007/sites/wem/fatwire/wem/Welcome

Sometimes after installation and configuration of Webcenter Sites, when we try to log in, we get the 500 error with message:


javax.servlet.ServletException: Failed gateway redirect java.io.UnsupportedEncodingException: Redirect failed due to illegal URL http://172.31.129.214:7007/sites/wem/fatwire/wem/Welcome
 at com.fatwire.wem.sso.cas.filter.CASFilter.sendResponse(CASFilter.java:681)
 at com.fatwire.wem.sso.cas.filter.CASFilter.doFilter(CASFilter.java:598)
 at com.fatwire.wem.sso.SSOFilter.doFilter(SSOFilter.java:51)
 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
 at COM.FutureTense.Security.Common.ContentSecurityFilter.doFilter(ContentSecurityFilter.java:88)
 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
 at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:141)
 at java.security.AccessController.doPrivileged(Native Method)
 at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
 at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:649)
 at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:124)
 at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:232)
 at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:94)
 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
 at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:224)
 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
 at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3654)
 at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3620)
 at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326)
 at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:196)
 at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
 at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
 at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2423)
 at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2280)
 at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2258)
 at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1626)
 at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1586)
 at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:270)
 at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)
 at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)
 at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)
 at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
 at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:617)
 at weblogic.work.ExecuteThread.execute(ExecuteThread.java:397)
 at weblogic.work.ExecuteThread.run(ExecuteThread.java:346)

To resolve this issue you should check, if ESAPI.properties file (in the {install directory}/bin directory) contains a line for Validator.Redirect. By default this line is set to: Validator.Redirect=^.*$

If it's all ok with ESAPI.properties file, in the next step you should verify Sites server stdout log to see from which location the ESAPI.properties file was read. The log can looks like:
Attempting to load ESAPI.properties via file I/O.
Attempting to load ESAPI.properties as resource file via file I/O.
Found in 'org.owasp.esapi.resources' directory: /oracle/fmw/wcportal/common/lib/ESAPI.properties
Loaded 'ESAPI.properties' properties file
SecurityConfiguration for Validator.ConfigurationFile not found in ESAPI.properties. Using default: validation.properties
Attempting to load validation.properties via file I/O.
Attempting to load validation.properties as resource file via file I/O.
If the file is found before finding it in the classpath, remove that file, to make sure it is only found in the classpath (in the {install dir}/bin directory). When the valid log should looks like:
Attempting to load ESAPI.properties via file I/O.
Attempting to load ESAPI.properties as resource file via file I/O.
Not found in 'org.owasp.esapi.resources' directory or file not readable: /path/to/appserver/bin/ESAPI.properties
Not found in SystemResource Directory/resourceDirectory: .esapi/ESAPI.properties
Not found in 'user.home' (C:\Users\sdasilv) directory: /home/myUser/esapi/ESAPI.properties
Loading ESAPI.properties via file I/O failed. Exception was: java.io.FileNotFoundException
Attempting to load ESAPI.properties via the classpath.
SUCCESSFULLY LOADED ESAPI.properties via the CLASSPATH from '/ (root)' using current thread context class loader! 
Check the directories in the CS application's and appserver's classpath and make sure there is no other instance of ESAPI.properties elsewhere in the classpath.

Thursday, October 29, 2015

Checking Weblogic version

To check Weblogic version go to WL_HOME/server/bin and run setWLSEnv.sh
Next run java weblogic.version

#java weblogic.version

WebLogic Server 10.3.6.0  Tue Nov 15 08:52:36 PST 2011 1441050

Use 'weblogic.version -verbose' to get subsystem information

Use 'weblogic.utils.Versions' to get version information for all modules

In Windows open cmd, go to WL_HOME\server\bin and run setWLSEnv.cmd

How to resolve: java.lang.ClassCastException: weblogic.net.http.SOAPHttpsURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection

Hi. Today I will share easy recipe to resolve following error:

<org.jsfportal.shiro.FacebookRealm> <FacebookRealm> <doGetAuthenticationInfo> <Throwable: weblogic.net.http.SOAPHttpsURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection> 
java.lang.ClassCastException: weblogic.net.http.SOAPHttpsURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection
    at pl.windroos.shiro.FacebookRealm.readURL(FacebookRealm.java:118)
    at pl.windroos.shiro.FacebookRealm.doGetAuthenticationInfo(FacebookRealm.java:84)
    at org.apache.shiro.realm.AuthenticatingRealm.getAuthenticationInfo(AuthenticatingRealm.java:568)
    at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doMultiRealmAuthentication(ModularRealmAuthenticator.java:219)
    at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doAuthenticate(ModularRealmAuthenticator.java:269)
    at org.apache.shiro.authc.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:198)
    at org.apache.shiro.mgt.AuthenticatingSecurityManager.authenticate(AuthenticatingSecurityManager.java:106)
    at org.apache.shiro.mgt.DefaultSecurityManager.login(DefaultSecurityManager.java:270)
    at org.apache.shiro.subject.support.DelegatingSubject.login(DelegatingSubject.java:256)
    at pl.windroos.shiro.FacebookLoginServlet.doGet(FacebookLoginServlet.java:53)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:286)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:260)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:137)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:350)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
    at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
    at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
    at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
    at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
    at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
    at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
    at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
    at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
    at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:141)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:649)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:124)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:232)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:94)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
    at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:224)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:32)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3654)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3620)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326)
    at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:196)
    at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
    at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
    at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2423)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2280)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2258)
    at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1626)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1586)
    at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:270)
    at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)
    at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)
    at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)
    at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
    at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:617)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:397)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:346)

The error can occur only when you deployed your appplication to the Weblogic Server and you try to run following (or simillar) code:

URL url;
url = new URL("https://yoururl.com");
HttpsURLConnection con = (HttpsURLConnection)url.openConnection();

There are two (or maybe more) ways to bypass this problem.
  1. Fix your code. You can create URL object in a following way:
    url = new URL(null,"https://yoururl.com",new sun.net.www.protocol.https.Handler());
  2. Using a more "general" solution you can force the usage of the Sun Http Handlers instead of the Weblogic specific. To do this you should add java option: -DUseSunHttpHandler in startWeblogic.sh or startWeblogic.cmd:
    set JAVA_OPTIONS=%JAVA_OPTIONS% -DUseSunHttpHandler=true

Saturday, June 6, 2015

Certificate chain received from graph.facebook.com - failed hostname verification check. Certificate contained *.facebook.com but check expected graph.facebook.com

How to avoid following Weblogic error when implementing "authentication and authorization via facebook":

<2015-05-17 20:59:29 CEST> <Warning> <Security> <BEA-090504> <Certificate chain received from graph.facebook.com - 31.13.93.3 failed hostname verification check. Certificate contained *.facebook.com but check expected graph.facebook.com> 

javax.net.ssl.SSLKeyException: Hostname verification failed: HostnameVerifier=weblogic.security.utils.SSLWLSHostnameVerifier, hostname=graph.facebook.com.

    at weblogic.security.SSL.jsseadapter.JaSSLEngine.doPostHandshake(JaSSLEngine.java:677)

    at weblogic.security.SSL.jsseadapter.JaSSLEngine.doAction(JaSSLEngine.java:748)

    at weblogic.security.SSL.jsseadapter.JaSSLEngine.unwrap(JaSSLEngine.java:132)

    at weblogic.socket.JSSEFilterImpl.unwrap(JSSEFilterImpl.java:603)

    at weblogic.socket.JSSEFilterImpl.unwrapAndHandleResults(JSSEFilterImpl.java:507)

    at weblogic.socket.JSSEFilterImpl.doHandshake(JSSEFilterImpl.java:96)

    at weblogic.socket.JSSEFilterImpl.doHandshake(JSSEFilterImpl.java:75)

    at weblogic.socket.JSSESocket.startHandshake(JSSESocket.java:219)

    at weblogic.net.http.HttpsClient.New(HttpsClient.java:563)

    at weblogic.net.http.HttpsClient.New(HttpsClient.java:534)

    at weblogic.net.http.HttpsURLConnection.connect(HttpsURLConnection.java:248)

    at weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:636)

    at weblogic.net.http.SOAPHttpsURLConnection.getInputStream(SOAPHttpsURLConnection.java:37)

    at java.net.URL.openStream(URL.java:1037)

    at pl.windroos.shiro.FacebookRealm.readURL(FacebookRealm.java:84)

    at pl.windroos.shiro.FacebookRealm.doGetAuthenticationInfo(FacebookRealm.java:58)

    at org.apache.shiro.realm.AuthenticatingRealm.getAuthenticationInfo(AuthenticatingRealm.java:568)

    at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doMultiRealmAuthentication(ModularRealmAuthenticator.java:219)

    at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doAuthenticate(ModularRealmAuthenticator.java:269)

    at org.apache.shiro.authc.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:198)

    at org.apache.shiro.mgt.AuthenticatingSecurityManager.authenticate(AuthenticatingSecurityManager.java:106)

    at org.apache.shiro.mgt.DefaultSecurityManager.login(DefaultSecurityManager.java:270)

    at org.apache.shiro.subject.support.DelegatingSubject.login(DelegatingSubject.java:256)

    at pl.windroos.shiro.FacebookLoginServlet.doGet(FacebookLoginServlet.java:53)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:844)

    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280)

    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254)

    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136)

    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:346)

    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)

    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:112)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)

    at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:588)

    at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:273)

    at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:546)

    at javax.faces.context.ExternalContextWrapper.dispatch(ExternalContextWrapper.java:93)

    at javax.faces.context.ExternalContextWrapper.dispatch(ExternalContextWrapper.java:93)

    at javax.faces.context.ExternalContextWrapper.dispatch(ExternalContextWrapper.java:93)

    at oracle.adfinternal.view.faces.config.rich.RecordRequestAttributesDuringDispatch.dispatch(RecordRequestAttributesDuringDispatch.java:44)

    at javax.faces.context.ExternalContextWrapper.dispatch(ExternalContextWrapper.java:93)

    at javax.faces.context.ExternalContextWrapper.dispatch(ExternalContextWrapper.java:93)

    at org.apache.myfaces.trinidadinternal.context.FacesContextFactoryImpl$OverrideDispatch.dispatch(FacesContextFactoryImpl.java:167)

    at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:364)

    at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:154)

    at org.apache.myfaces.trinidad.view.ViewDeclarationLanguageWrapper.buildView(ViewDeclarationLanguageWrapper.java:94)

    at org.apache.myfaces.trinidad.view.ViewDeclarationLanguageWrapper.buildView(ViewDeclarationLanguageWrapper.java:94)

    at org.apache.myfaces.trinidadinternal.application.ViewDeclarationLanguageFactoryImpl$ChangeApplyingVDLWrapper.buildView(ViewDeclarationLanguageFactoryImpl.java:322)

    at oracle.adfinternal.view.faces.lifecycle.ResponseRenderManager._processViewDefinitionLanguage(ResponseRenderManager.java:105)

    at oracle.adfinternal.view.faces.lifecycle.ResponseRenderManager.runRenderView(ResponseRenderManager.java:41)

    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:1095)

    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:389)

    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:255)

    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)

    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280)

    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254)

    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136)

    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:346)

    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)

    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:192)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)

    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:105)

    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:502)

    at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)

    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:502)

    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:327)

    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:229)

    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)

    at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)

    at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)

    at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)

    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)

    at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)

    at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)

    at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)

    at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)

    at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)

    at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)

    at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)

    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)

    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:137)

    at java.security.AccessController.doPrivileged(Native Method)

    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)

    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)

    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:120)

    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:217)

    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:81)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)

    at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:220)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)

    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)

    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)

    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3436)

    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3402)

    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)

    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)

    at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)

    at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2285)

    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2201)

    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)

    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1572)

    at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:255)

    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)

    at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)

Best solution is using the Wildcarded Host Name Verifier.
  1. In the left pane of the Console, expand Environment and select Servers.
  2. Click the name of the server for which you want to disable host name verification.
  3. Select Configuration > SSL , and click Advanced at the bottom of the page.
  4. Set the Hostname Verification field to Custom Hostname Verifier.
  5. Set the Custom Hostname Verifier to 
Not recommended but more general solution is disabling host name verification at all. To do this go to Weblogic console and :
  1. In the left pane of the Console, expand Environment and select Servers.
  2. Click the name of the server for which you want to disable host name verification.
  3. Select Configuration > SSL , and click Advanced at the bottom of the page.
  4. Set the Hostname Verification field to None.
You can disable hostname verification also via commandline of an SSL client by entering the following argument: -Dweblogic.security.SSL.ignoreHostnameVerification=true

Saturday, May 23, 2015

Replacement for $( document ).ready() in ADF

A page can't be manipulated safely until the document is "ready." To detect this state of readiness you must use some javascriprt code.
As I think the most “famous” approach is to use jQuery $( document ).ready(). The code will only run once the page Document Object Model (DOM) is ready for JavaScript code to execute.
Another function, $( window ).load(function() { ... }) will run once the entire page (images or iframes), not just the DOM, is ready.
Typical “plain” javascript replacement for $(document).ready() looks like:
document.addEventListener("DOMContentLoaded", function() {

  // code...

});
But for IE8 and older you should use:
document.attachEvent("onreadystatechange", function(){

  if (document.readyState === "complete"){

    document.detachEvent( "onreadystatechange", arguments.call );

    // code ...

  }
});
If we need call our function after full page load (with images and so on) we can use window.load which is “replacement” for $( window ).load().

Ok. But what with ADF? Of course we can use any of above approaches. But we have also dedicated ADF mechanism.
We could use an ADF clientListener operation with load type, to identify when ADF UI is loaded. This listener should be added to the ADF UI document tag and it will be invoked at the end of page rendering. Through clientListener, we could invoke our custom JavaScript method:
    …

<f:facet name=”metaContainer”>

    <af:resource type=”javascript”>

        Function myCustomMethod(){

            alert(“Page loaded !!!”);

        }

    </af:resource>

    </f:facet>

    <af:clientListener type=”load” method=”myCustomMethod”/>

</af:document>

</f:view>