Tuesday, November 26, 2013

Ojdeploy : Tuning exercise

First of all all the tuning I am doing is for out continuous integration server because I build time have hit 25 minutes on the solaris 11 machine (on my desktop the same build it takes 11 minutes).

So where I am working is in the "ojdeploy.conf" file located in [jdev location]/jdev/bin


Finding most java settings make a difference and mostly

Using jrockit I have got it down to 21 minutes

AddVMOption -Xmx1g
AddVMOption -Xms1g
AddVMOption -Xverify:none
AddVMOption -Djava.net.preferIPv4Stack=true

Fastest solaris build so far is on the standard 32-bit jdk - weighing in at 18 minutes

AddVMOption -Dapplication.handle.help=true
AddVMOption -Xmx1g
AddVMOption -Xms1g
AddVMOption -Dsun.awt.disablegrab=false
AddVMOption -XX:MaxPermSize=512M
SetJavaHome /usr/java
AddVMOption -Xverify:none
AddVMOption -Djava.net.preferIPv4Stack=true
AddVMOption -XX:PermSize=128m


will update with my findings but parameters like largePages, parallel gc, -server etc just seem to make things worse.


And the greatest build gain so far - using parallel ant tasks, cut my build time in half.

Tuesday, November 19, 2013

ADF: postChanges delete parent and children in the same transaction programmatically


I was doing a simple mater details delete with some code and no matter what I did the parent delete got called before the child, then I remembered post changes (this.getDBTransaction().postChanges();) and called it after deleting the children. And that is how postChanges saved my life.

Code for fun...


        Key key = new Key(new Object[] { objectId });
        Row[] rows = getParentVO().findByKey(key, 1);
        if (rows != null && rows.length > 0) {
            ParentVORowImpl parent = (ParentVORowImpl) rows[0];
            RowIterator rowIterator = parent.getChildVO();
            removeRows(rowIterator);
            this.getDBTransaction().postChanges();
            parent.remove();
            this.getDBTransaction().commit();
        }


    public void removeRows(RowIterator rowIterator) {
        while (rowIterator.hasNext()) {
            Row row = rowIterator.next();
            row.remove();
        }
    }


Thursday, November 14, 2013

UCM: error in ucm filenotfound after ps7 upgrade

Turns out dispersion rule was turned on and was adding some extra stuff to my urls (mdaw etc)

Thank goodness for this blog post:
http://stellentpmp.blogspot.com/2011/05/mdaw-directory-explained.html

Monday, October 7, 2013

ADF css agent

This is different for different versions of browsers but here is what works for me:

@agent
ie - Internet Explorer - all
gecko - firefox
webkit - chrome

@platform
window, linux, macossolaris - self explanatory
@version
I use this mostly for ie 6, 7, 8, 9 etc work for the separate versions


Have not tried this but should work:
@agent (touchScreen:none)
@agent (touchScreen:single)
@agent (touchScreen)

Saturday, September 28, 2013

Oracle open world day 4 - final


Keynote device embedded intellegence - internet of things, funny stuff about sensors on cows, intellegent sensors, analytics.

Adf architecture - most stuff found on architecture site (http://www.oracle.com/technetwork/developer-tools/adf/learnmore/adfarchitect-1639592.html)

Adf scalability - opss cache, mds configuration, jrockit mission control, oracle-ateam.com, cdn, coherence. A team has some interesting ideas but one hour is not enough to go into detail.

Feet are now officially sore and if I hear internet of things, big data or cloud again it will be too soon. All in all a good conference learned some stuff met some people.

Thursday, September 26, 2013

Oracle open world 2013 - day 3

Keynote - modern customer experience to start off my day.

ADF fusion architecture manage the modular approach - a bit of information overload on this one but good ideas never the less. Take home fact use artifactory again.

Real world adf implementations - wow talk of the day TIA the Danish company did a forms migration in a year very impressive (had help from AMIS) still good though. The german guy from BA just wow one of the most impressive systems I have seen. Approached in exactly the way I think adf should be used  he spoke of the industrilization of software and a framework on top of ADF great. Then the Aussies doing mobile Colab really impressive set of technologies and challenges security using saml. Really great stuff  all around


BI publisher - nice overview I really need to do more with our implementation.
Hacking your way to a better application - good ideas but mostly a basic overview


Wednesday, September 25, 2013

Oracle open world day 2

Went to the hcm keynote On mobile and social for two reasons - one I find that the fusion apps stuff gives us a good view on what new features we will get in adf and webcenter also it gives you a good idea in what end users want in an application. What I saw was really impressive the mobile interface is slick and feature rich. Also I have a history with hcm applications so it was good.

Then it was on to a user panel on webcenter content the panel of guests where kind of new to content(one only went into production this month) so it was kind of basic but good. The customer feedback dos and donts could not have more rich.

The I attended a talk by Sten Vesterli of scott tiger - a very good basics talk on 10 "secrets" of a sucessful adf project. If you are not following these rules you should be. But again very basic.
1. Catalog what components you use and how
2. Under promise over deliver
3. Use poc
4. Package
5. Extend
6. Get and use a wiki
7. Nutcracker this is a dev role some who cracks the hard problems
8. Version control make sure you have vc
9.build ci ant maven
10.  Logging use the inbuilt adf logger


I then skipped the cloud keynote to talk to some of the vendors and see a couple of demos. Very cool stuff coming soon on the fmw platform.
Fast scalable fusion middleware applications - good informative presentation taught me something and reminded me other tuning opportunities. 

There is a jsp timeout parameter
Set initial cacity to 0 db pool
Llr reduce load for 2 phase commit
Databsae statistics always check and tune
Gridlink data source
If using Oracle db driver switch weblogic cache off
Parallel muxer -Dweblogic.SocketReaders
Fusion application
Chunk pool
Jbo.recyclethreshold





Monday, September 23, 2013

Oracle open world 2013 : Day 1

So far so good made it to San Francisco alive will post some feedback on sessions here

Keynote on big data : good ideas hadoop nosql integration. Data is our future. Very Cloudy.

Not a good start to the Web Center overview few technical presentation problems, turn out not too bad in the end. Adaptive design and enhanced search. Sites looks good on the new version. Form factor really...

Oracle ADF Applications in Multiple Layers - best presentation of the day in my opinion focussed on MDS very informative made me realize a post of the mysteries of mds is long overdue.

Simplifying Architecture the Restful way - Going to be good when we are on 12c release and this is available.

Solaris App performance on Solaris - good tips here on mainly focussed on C++ dev.




Wednesday, August 28, 2013

ADF: PS5 to PS6 upgrade which turned into a PS7 11.1.1.8 webcenter and 11.1.1.7 adf upgrade

First thing I noticed is that clicking a link on a tab or menu disabled the link, had to style my tabs for this as the tab would vanish while loading -

af|panelTabbed::header af|panelTabbed::tab:disabled af|panelTabbed::tab-start { background-image: url("/skins/images/my_tab_start_d.png"); }
af|panelTabbed::header af|panelTabbed::tab:disabled af|panelTabbed::tab-content { background-image: url("/skins/images/my_tab_mid_d.png"); }
af|panelTabbed::header af|panelTabbed::tab:disabled af|panelTabbed::tab-end { background-image: url("/skins/images/my_tab_end_d.png"); }


The other problem was with some really old code that had only transient attributes in a vo - after 5 minutes on a screen and reclicking we would get a null pointer exception. Fixed this by marking passivate transient objects on the vo and cleaning up some old code.

Also had a few navigation with web center menu errors.



Skyros upgrade will take a lot of work to integrate with our styles sooooo this will have to wait we are on a tight deadline.


UPDATE : Not a smooth upgrade, problems include transients in view objects getting passivated more frequently, refresh issues, etc. (Mostly troubles with old code not functioning as it did).

Wednesday, August 21, 2013

Shibboleth Weblogic SAML2 identity provider making it work [Work in progress...]

I am busy configuring a Weblogic Service Provider that talks to a Shibboleth implementation using SAML2 and this is a log of the problems (mostly with me) I have encountered:

Problem number 1) Unsupported binding type received: urn:mace:shibboleth:1.0:profiles:AuthnRequest

For this I had to remove the entry <SingleSignOnService Binding="urn:mace:shibboleth:1.0:profiles:AuthnRequest" Location="https://server/idp/profile/Shibboleth/SSO"/> in the metadata file I received from my idp and re upload to the  Identity Provider Partners  section in weblogic.

This was the stack trace:
SecuritySAML2Service  exception info
com.bea.security.saml2.binding.BindingHandlerException: Unsupported binding type received: urn:mace:shibboleth:1.0:profiles:AuthnRequest
at com.bea.security.saml2.binding.BindingHandlerFactory.newBindingSender(BindingHandlerFactory.java:53)
at com.bea.security.saml2.service.AbstractService.getSender(AbstractService.java:75)
at com.bea.security.saml2.service.spinitiator.SPInitiatorImpl.process(SPInitiatorImpl.java:170)
at com.bea.security.saml2.cssservice.SAML2ServiceImpl.process(SAML2ServiceImpl.java:161)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.bea.common.security.utils.ThreadClassLoaderContextInvocationHandler.invoke(ThreadClassLoaderContextInvocationHandler.java:26)
at $Proxy51.process(Unknown Source)
at com.bea.security.saml2.servlet.SAML2Filter.doFilter(SAML2Filter.java:49)
at weblogic.servlet.security.internal.AuthFilterChain.doFilter(AuthFilterChain.java:37)
at weblogic.servlet.security.internal.SecurityModule$ServletAuthenticationFilterAction.run(SecurityModule.java:645)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.security.internal.SecurityModule.invokeAuthFilterChain(SecurityModule.java:534)
at weblogic.servlet.security.internal.FormSecurityModule.checkUserPerm(FormSecurityModule.java:224)
at weblogic.servlet.security.internal.FormSecurityModule.checkAccess(FormSecurityModule.java:96)
at weblogic.servlet.security.internal.ServletSecurityManager.checkAccess(ServletSecurityManager.java:82)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2213)
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:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)

Solaris 11 : Web Center installation problem

We ran into a problem running the web center installation on Solaris 11 yesterday and I need to document this for my own sake.

The installation would fail all prerequisite checks randomly on different environments. We could just click continue and the install would be fine or run with ./runInstaller -ignoreSysPreReqs.

Our sys admin ran a trace and we tracked the problem down to a file being generated a run time using the sysdef -i command. This showed us that IPC Semaphores module is not loaded.

Just running the ipcs -a command before we install fixed the error for us and generated the correct size of file and made everything work - amazing.

Wednesday, August 14, 2013

Adventures in F5, OHS and weblogic

http://fusionsecurity.blogspot.com/2011/04/ssl-offloading-and-weblogic-server.html
https://blogs.oracle.com/ateamsoab2b/entry/configuration_notes_for_offloading_of

So I wanted to enable ssl between my F5 and ohs and between ohs and my weblogic.
I needed to do this because we redirect 80 to https on the F5 and I had a couple of external web services deployed. When you deploy the web service and are using https only on the F5 and http pass through to the rest your wsdl url will be secure but you may not be able to easily generate services from the wsdl (because the content of the wsdl will all point to http which we blocked).

IMPORT your certificates into a new wallet - using orapki - http://docs.oracle.com/cd/E11882_01/network.112/e10746/asoappf.htm

So on your F5
  Make sure you point to the ohs on the secure socket port (4443 by default).
  Easiest way to block http is with a https redirect iRule (http://fixmyitsystem.com/2012/11/handy-simple-f5-redirect-irules.html)

OHS

mod_wl_ohs I added on my web service location
  WLProxySSLPassThrough ON
I also pointer to the SSL ports

ssl.conf I added   

  RequestHeader set IS_SSL ssl 
  RequestHeader set WL-Proxy-SSL true
  SSLEngine on 





Weblogic

Set WebLogic Plugin Enabled (see initial link)
Enable SSL (enviroment>servers>yourserver> tick ssl listen port enabled)



*Shortcut for slackers*

Fool ohs into thinking you have a secure connection instead of setting up ssl everwhere (8892 is webcenter http port):


    WebLogicCluster serverName:8892,serverName:8892
    SetHandler weblogic-handler
    WLProxySSLPassThrough ON
    RequestHeader set IS_SSL ssl
    RequestHeader set WL-Proxy-SSL true



Friday, August 9, 2013

Webcenter BI integration

I followed this document:
http://www.oracle.com/technetwork/middleware/webcenter/portal/learnmore/wc-biappsconfig-396418.pdf

The only to comment (FRUSTRATED the hell out of me)

1) Add the bi libraries to your portal before you embark on the above guide : http://rsriv.blogspot.com/2011/10/obiee-11g-integration-with-webcenter.html

2) I kept getting an error:

Caused by: javax.naming.NamingException [Root exception is oracle.bi.presentation.soap.connection.BISoapException: javax.xml.ws.soap.SOAPFaultException: Authentication error. An invalid User Name or Password was entered.]

For some reason (I still need to investigate) the security does NOT work without impersonation for me. So I had to create my users on the bi server before everything could work.

Friday, June 28, 2013

Handy active directory command line script to set all the user to not expire

dsquery user -startnode "ou=users,dc=train,dc=company,dc=com" -limit 30000 | dsmod user -pwdneverexpires yes

Thursday, June 27, 2013

Web Center: using a custom security provider other than LDAP [custom identity store]

So far everything looks like it will work I am just using the default auth provider and UCM is picking up my groups on login so now to integrate with Web center and use my custom auth provider.

Custom authentication provider is done and I can log in to my content server and application and everything is working. The snag is not of the webcenter custom profile pictures and webcenter goodies are working (it uses the JpsContextFactory etc and that ignores my provider and looks up the default weblogic provider and tries to use that).

I have replaced the identity store with a custom database implementation and everything seems to work [after a LOT of debugging].

Ok so step 1) The custom authentication provider - tons od documentation on how to do this eg: http://docs.oracle.com/cd/E12890_01/ales/docs32/dvspisec/progrmng.htmlhttp://docs.oracle.com/cd/E13222_01/wls/docs81/dvspisec/atn.html so I am not going to rehash this if you want I can post some code but it should not be necessary.

Quick Summary:

1) Create a class that implements javax.security.auth.spi.LoginModule and a ProviderImpl that implements weblogic.security.spi.AuthenticationProviderV2.

2) Create a Authentication provider xml see links for examples

3) Authenticator - I wanted my roles and users to be displayed on the weblogic console and the best way to get this done is via the AuthenticatorImpl. So extend weblogic.management.security.authentication.AuthenticatorImpl and implement the methods also name your CustomAutenticatorImpl the same name as your provider xml with an Impl.java at the end. (so CustomAutenticator.xml becomes CustomAutenticatorImpl).

Step 3) Ant - Ant build also dead simple and well documented but here is the crux:

<java classpath="../../deploy/otheclasses.jar;../../lib/com.bea.core.mbean.maker_1.5.0.0.jar;${oracle.weblogic.security.providers.library};${oracle.jdeveloper.weblogic.library};${oracle.jdeveloper.weblogic.commons.logging.library};${java.home}/../lib/tools.jar"
          classname="weblogic.management.commo.WebLogicMBeanMaker" fork="true"
          failonerror="true" >
      <jvmarg line="-Dfiles=${build_dir} -DMDFDIR=${build_dir} -DMJF=${build_dir}/${providersjar} -DpreserveStubs=true -DcreateStubs=true -DincludeSource=true"/>
</java>

Step 3) Custom Identity Store - this was the hard bit but thanks to this blog http://chintanblog.blogspot.com/2013/01/weblogic-custom-authentication-provider.html everything got a lot easier big thanks you saved me a LOT of time.

I just created my implementation of CustomSecurityProviderPlugin and configured the jps as detailed in the blog and it WORKED! (One note I had to change the following methods in CustomIdentityStore to get everything 100% for my enviroment)

    public oracle.security.idm.SearchResponse searchUsers(oracle.security.idm.SearchParameters p1, java.util.Set p2) {
        List userMap = this.customIdentityRepositoryHelper.searchUsers(p1.getFilter());
        SearchResponse response = createResponse(userMap);
        return response;
    }

    public SearchResponse createResponse(List users) {
        CustomSearchResponse respone = new CustomSearchResponse(this, users, Boolean.TRUE);
        return respone;
    }

    public StoreConfiguration getStoreConfiguration()
        throws IMException {
        return new CustomStoreConfiguration(properties);
    }

Step 4) Installation:
  Copy the authenticator jar to the [wl install]\wlserver_10.3\server\lib\mbeantypes
  Configure your provider as the first in the list and SUFFICIENT
  Configure your default provider as SUFFICIENT
  Copy the Identity Store jar into the classpath for weblogic
  Edit your jps-config.xml  [in YourDomainLocation\config\fmwconfig]

Everything should work now.

INSTALL PROBLEMS

Started with this today first problem installing webcenter on my local machine (with cluster) when starting node manager:

weblogic.nodemanager.common.ConfigException: Native version is enabled but nodem
anager native library could not be loaded

So I had to add a nodemanager.properties file in [wl_install_dir\wlserver_10.3\common\nodemanager] that has the following content

NativeVersionEnabled=false



Server is Running  in Development Mode and Native Library(terminalio) to read the password securely from commandline is not found.

Put the following in JAVA_OPTIONS in setDomain (just running locally so this should be ok and dont want to waste time looking for  terminalio)

-Dweblogic.management.allowPasswordEcho=true


Created the custom authentication provider: NOTE stop ALL managed servers and admin server before deploying the custom provider to server/lib/mbeantypes then restart. (else you get a weblogic.management.provider.UpdateExceptionThe prepare phase of the configuration update failed with an exception:)



Tuesday, June 11, 2013

Adding a custom attribute WebCenter menu...

Find the schema section in your menu xml --> ie default-navigation-model.xml

Add a descriptor:
    <descriptor shortLabelKey="TITLE.SHORT_PROMPT_KEY" multivalue="false"
                attributeId="NewAtrr" labelKey="TITLE.PROMPT_KEY"
                endUserVisible="true" searchable="true"
                xmlns="http://xmlns.oracle.com/adf/rcs/catalog"/>

Note: you can change the shortLabelKey and labelKey by adding a resourceBundle="..." but that is another post....

Looks a bit like this:
<schema resourceBundle="oracle.adf.rc.attribute.nls.AttributeBundle"
          xmlns="http://xmlns.oracle.com/adf/rcs/catalog">
    <descriptor shortLabelKey="TITLE.SHORT_PROMPT_KEY" multivalue="false"
                attributeId="Title" labelKey="TITLE.PROMPT_KEY"
                endUserVisible="true" searchable="true"
                xmlns="http://xmlns.oracle.com/adf/rcs/catalog"/>


Your new custom attribute is ready to use.

These attributes are accessible (el and programmaticly)

el : #{node.attributes['NewAtrr']}
programmaticly : node.getAttributes.get("NewAtrr");

Tuesday, June 4, 2013

Automated remote deployment of Webcenter ear to our development enviroment



All the usual undeploy / stop start code worked remotely but unfortunately the deploy was not going as planned - I wanted to set the MDS info on deployment so it was time for a new plan.

So this time on our build server would call WLST to deploy our web center app on the development weblogic enviroment.

Wlst commands I used:

Connect
  connect('weblogic','bobsentme', ''t3://remote.wl:7001')

Stop
  shutdown('ManagedServer1', force='true')

Start
  start(start('WC_Cluster', 'Cluster', 't3://remote.wl:7001'));

Deploy
archive = getMDSArchiveConfig(fromLocation='/tmp/pathto.ear')

archive.setAppMetadataRepository(repository='mds-CustomDS', partition='dev_partition', type='DB', jndi='jdbc/mds/CustomDS')");


archive.save()

deploy(appName='OurAppName', path='/tmp/pathto.ear', targets='WC_Cluster', stageMode='stage',   upload='true')

Undeploy
  undeploy('OurAppName')

Disconnect
  disconnect('true')


Scripts: to get the classpath and environment  variables correct I run the wlst.sh command and echo'ed the classpath and JAVA_OPTS and pulled them into my file not elegant but it did work.


Things still to do:

  • Use a secure connection t3s
  • Move from script to use wlst directly
  • Call setWLenv or something to setup the classpath and java opts for me
Something like:
/opt/Oracle/Middleware/wlserver_10.3/server/bin/setWLSEnv.sh
/opt/Oracle/Middleware/oracle_common/common/bin/setHomeDirs.sh
/opt/Oracle/Middleware/oracle_common/common/bin/setWlstEnv.sh

Thursday, May 2, 2013

Java: Active directory paging code


Forgive some of the bad code this was a quick script and a reminder to self on how to do this: (note this code changes all the AD users passwords so be careful)

package common.jndi;

import javax.naming.NamingEnumeration;
import javax.naming.NamingException;

import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.BasicAttribute;
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
import javax.naming.directory.ModificationItem;
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;

import javax.naming.ldap.Control;
import javax.naming.ldap.InitialLdapContext;
import javax.naming.ldap.PagedResultsControl;
import javax.naming.ldap.PagedResultsResponseControl;

public class ModifyLdapUserScript
    extends LdapBase {
    public static final int PAGE_SIZE = 999;
    private static final String DEFAULT_PASSWORD = "Password1";
    private static final String AD_BASE = "dc=dev,dc=system,dc=uni,dc=edu";

    public ModifyLdapUserScript() {
        super();
    }

    public static void main(String[] args)
        throws Exception {
        String adServer = "adserver";
        String adUser = "cn=Admin,cn=Users," + AD_BASE;
        String adPwd = "secretpassword";

        System.out.println("Starting user modification");
        InitialLdapContext ldapContext = null;
        byte[] cookie = null;
        int runningTotal = 0;
        try {
            long startTime = System.currentTimeMillis();
            ldapContext = connectAD(adServer, adUser, adPwd);

            // Create the search controls
            SearchControls searchCtls = new SearchControls();
            //Specify the attributes to return
            String returnedAtts[] = { "cn" };
            searchCtls.setReturningAttributes(returnedAtts);
            ldapContext.setRequestControls(new Control[] { new PagedResultsControl(PAGE_SIZE, Control.CRITICAL) });
            searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);

            //specify the LDAP search filter
            String searchFilter = "(&(cn=*)(objectclass=user))";

            //initialize counter to total the results
            PagedResult totalResults = new PagedResult();

            long innerStartTime = System.currentTimeMillis();
            NamingEnumeration answer = ldapContext.search(AD_BASE, searchFilter, searchCtls);
            totalResults = processPage(ldapContext, answer);
            System.out.println("Processed page 1 [" + totalResults.getResultSize() + "] in time:" +
                               (System.currentTimeMillis() - innerStartTime));
            runningTotal += totalResults.getResultSize();
            int i = 2;
            while (totalResults != null && totalResults.getCookie() != null) {
                innerStartTime = System.currentTimeMillis();
                ldapContext.setRequestControls(new Control[] { new PagedResultsControl(PAGE_SIZE, totalResults.getCookie(), Control.CRITICAL) });
                answer = ldapContext.search(AD_BASE, searchFilter, searchCtls);
                totalResults = processPage(ldapContext, answer);
                System.out.println("Processed page " + i + " [" + totalResults.getResultSize() + "] in time:" +
                                   (System.currentTimeMillis() - innerStartTime));
                runningTotal += totalResults.getResultSize();
                i++;
            }

            System.out.println("Time taken changing users[" + runningTotal + "]:" + (System.currentTimeMillis() - startTime));
        } finally {
            disconnectAD(ldapContext);
        }
        System.out.println("Finished modification");
    }

    private static PagedResult processPage(InitialLdapContext ldapContext, NamingEnumeration answer)
        throws NamingException {
        //Loop through the search results
        String adContent = null;
        PagedResult result = new PagedResult();
        int results = 0;
        while (answer != null && answer.hasMoreElements()) {
            SearchResult sr = answer.next();
            Attributes attrs = sr.getAttributes();
            if (attrs != null) {
                String cn = (String) getAttributeValue(attrs, "cn");
                StringBuffer buffer = new StringBuffer("cn=").append(cn).append(",cn=Users,").append(AD_BASE);
                changePassword(ldapContext, DEFAULT_PASSWORD, buffer.toString());
            }
        }

        Control[] controls = ldapContext.getResponseControls();
        if (controls != null) {
            for (int i = 0; i < controls.length; i++) {
                if (controls[i] instanceof PagedResultsResponseControl) {
                    PagedResultsResponseControl prrc = (PagedResultsResponseControl)controls[i];
                    result.setCookie(prrc.getCookie());
                    result.setResultSize(prrc.getResultSize());
                } else {
                    // Handle other response controls (if any)
                }
            }
        }

        return result;
    }

    public static void changePassword(InitialDirContext context, String password, String username)
        throws NamingException {

        System.out.println("Context Sucessfully Initialized");
        ModificationItem[] mods = new ModificationItem[1];
        Attribute mod0 = new BasicAttribute("userpassword", password);
        mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, mod0);
        context.modifyAttributes(username, mods);
    }
}

Thursday, April 11, 2013

Orace SQL: Search through all PLSQL package bodies for a string


SELECT * FROM user_source WHERE upper(text) like '%Your Search here%'  AND type = 'PACKAGE BODY';

OR


SELECT * FROM all_source WHERE upper(text) like '%Your Search here%';


Friday, April 5, 2013

ADF: Design view not rendering tags

Ok so I had two problems today with design view.

1) None of my tags where rendering in design view - This was a dependent library problem.
  I had added the web center libraries manually to my project and had somehow removed the personalization
  library this lead to a ClassNotFound error in my message log simple to fix once you know where to look.

2) Second problem vexed me for a while my c:set jstl tag libraries where just NOT rendering correctley in design view. This turned out to be a checkbox Execute Tags in JSP Visual Editor was unchecked.

[Project Properties > JSP Tag Libraries]




Friday, March 29, 2013

ADF: Scroll down to item on your page


I wanted to scroll down to a component in my page and first tried anchor which just did not work on mu input driven screen.

So I tried the af:scrollComponentIntoViewBehavior on my command link and it just worked.

<af:commandLink id="c_cert" text="certify" >
  <af:scrollComponentIntoViewBehavior componentId="sbc4" focus="true" subTargetId="content"/>
</af:commandLink>


... long content


<af:selectBooleanCheckbox value="false" clientComponent="true" id="sbc4"/>



Note: don't do this with anchors on a non read only content page it just get messy

Tuesday, March 26, 2013

ADF: Logger timestamp included

I am doing some performance testing and needed to look at the times produced by the ADF Diagnostic logging items.

Analyze log was not good enough because it is too slow to find the grouped info I needed.

So step one) I loaded my Configure Oracle Diagnostic logging (action menu in the log window) and went straight to the source tab

At the top of the logging .xml file there is an entry

<log_handler name='console-handler' class='oracle.core.ojdl.logging.ConsoleHandler' level='ALL'  formatter='oracle.core.ojdl.weblogic.ConsoleFormatter'/>

it need to be to see the logs in all there glory with timestamps etc <log_handler name='console-handler' class='oracle.core.ojdl.logging.ConsoleHandler' level='ALL'/>

Thursday, March 21, 2013

Oracle Diagnotics logging turning it off : Logging.xml

I mistakenly put oracle Root logger to finest which of course crashed everything. So I restarted JDev then restarted Weblogic horror the setting was still set.

Great so now I could not work.

Solution (thanks google and this oracle doc ): located the logging.xml file in your integrated weblogic server:

C:\Users\[your user]\AppData\Roaming\JDeveloper\system11.1.1.6.38.62.29\DefaultDomain\config\fmwconfig\servers\DefaultServer


Edit it and remove the offending log leve setting. (mine was <logger name='oracle'/ level='FINEST'> ==> <logger name='oracle'/>)

All fixed and working again...

Wednesday, March 20, 2013

Webcenter PS5 migration - Iterative Development setting



Noticed that this setting was different when comparing a newly created ps5 portal project and our current project, might save some time for someone:

In Portal.jws file near the end.

Old
      <hash n="oracle.webcenter.dt.config.WebCenterSettings">
      <value n="iterativeDevelopment" v="false"/>
     </hash>

New
     <hash n="oracle.webcenter.dt.config.WebCenterSettings">
      <value n="iterativeDevelopment" v="true"/>
   </hash>


Or for those with less of an affinity for source :

Friday, March 8, 2013

Start Integrated weblogic 11.1.1.6 hanging 64bit Jrockit

My jdeveloper was hanging on this portion of a new integrated weblogic start.

Module /portalTools/builder of application portalTools [Version=11.1.1.4.0] is transitioning from STATE_NEW to STATE_PREPARED on server DefaultServer.


So I left it overnight and if finally deploy successfully and now everything is working ok.

Webcenter Menu: invalidate cache

We where getting an exception when executing some code that worked on PS3 on PS5. (We are reconstructing our menu based on user roles and we can masquerade as another user on click of a button)

The stack trace of the error included:



<SiteStructureResource><getChildren>
javax.naming.NamingException [Root exception is java.lang.NullPointerException]
at oracle.adfinternal.rc.jndi.CatalogContextWrapper.listBindings(CatalogContextWrapper.java:654)
at oracle.adfinternal.rc.jndi.CatalogContextWrapper.listBindings(CatalogContextWrapper.java:616)


Caused by: java.lang.NullPointerException
at oracle.adfinternal.rc.jndi.FolderContext.loadCache(FolderContext.java:338)
at oracle.adf.rc.spi.jndi.InMemoryContext.checkCacheLoaded(InMemoryContext.java:1401)
at oracle.adfinternal.rc.jndi.FolderContext.loadCache(FolderContext.java:383)

java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor916.invoke(Unknown Source)





  public void refreshMenu() {

        SiteStructure model = SiteStructureContext.getInstance().getCurrentModel();
        model.invalidateCache();
        if (this.getLeftMenu() != null)
            AdfFacesContext.getCurrentInstance().addPartialTarget(this.getLeftMenu());
  }


This may not be the best solution but it is a good workaround for what I think is a bug in PS5.





public void refreshMenu() {
        SiteStructure model = SiteStructureContext.getInstance().getCurrentModel();
        model.invalidateCache();
    redirectCurrentPage();
}




public static void redirectCurrentPage() {

  FacesContext fctx = FacesContext.getCurrentInstance();
  ExternalContext ectx = fctx.getExternalContext();

  ControllerContext controllerCtx = null;
  controllerCtx = ControllerContext.getInstance();
  String activityURL =   controllerCtx.getGlobalViewActivityURL(fctx.getViewRoot().getViewId());

  try{
    ectx.redirect(activityURL);
  } catch (IOException e) {
    //Can't redirect
    e.printStackTrace();

  }
}



References:
https://blogs.oracle.com/jdevotnharvest/entry/how_to_efficiently_redirect_an

Wednesday, March 6, 2013

Webcenter Content Default Schemas

DEV_ORAIRM
DEV_OCS
DEV_OCSSEARCH
DEV_URMSERVER
DEV_IPM

@TODO finish this doc with explanations

Oracle XE problems

Had a few issues when trying to connect to oracle xe installed by another user

Getting sqlplus to work
set ORACLE_HOME=C:\oraclexe\app\oracle\product\11.2.0\server
set ORACLE_SID=XE
set PATH=C:\oraclexe\app\oracle\product\11.2.0\server\bin;%PATH%

Connecting as sysdba to change password (ORA-01031: insufficient privileges)
 Type Edit local users in your start menu search bar (Select the first one in the Control panel group)
 Click Groups
 Select ORA_DBA
 Add your user here
 sqlplus / as sysdba from the command prompt with all above variables set
 alter user SYS identified by "newpassword";

Monday, March 4, 2013

OJdeploy: Faster ant build tuning

If you want a quicker ojdeploy experience and you are not on 11.1.2.... and using OJServer the following may help you (along with ojdeply Memory Settings should give you the best you are going to get without splitting the build up and running in parallel):

The more you consolidate your deploys under a single ojdeploy the faster the build:


eg: the first one should be slower

    <ora:ojdeploy xmlns:ora="oraclelib:OJDeployAntTask"
                  executable="${ojdeploy.path}" failonerror="true"
                  ora:statuslog="${basedir}/${oracle.jdeveloper.deploy.dir}/${project.model.deploy.name}-ojdeploy-statuslog.xml"
                  ora:buildscript="${basedir}/${oracle.jdeveloper.deploy.dir}/ojdeploy-build.xml">      <ora:deploy>
        <ora:parameter name="workspace" value="${workspace.fixed.location}"/>
        <ora:parameter name="project" value="${project.model.name}"/>
        <ora:parameter name="profile" value="${project.model.deploy.name}"/>
        <ora:parameter name="nodatasources" value="true"/>
        <ora:parameter name="basedir" value="${basedir}"/>
        <ora:parameter name="nocompile" value="${nocompile}"/>
        <ora:parameter name="clean" value="true"/>
      </ora:deploy>
    </ora:ojdeploy>
    <ora:ojdeploy xmlns:ora="oraclelib:OJDeployAntTask"
                  executable="${ojdeploy.path}" failonerror="true"
                  ora:statuslog="${basedir}/${oracle.jdeveloper.deploy.dir}/${project.deploy.name}-ojdeploy-statuslog.xml"
                  ora:buildscript="${basedir}/${oracle.jdeveloper.deploy.dir}/ojdeploy-build.xml">      <ora:deploy>
        <ora:parameter name="workspace" value="${workspace.fixed.location}"/>
        <ora:parameter name="project" value="${project.name}"/>
        <ora:parameter name="profile" value="${project.deploy.name}"/>
        <ora:parameter name="nodatasources" value="true"/>
        <ora:parameter name="basedir" value="${basedir}"/>
        <ora:parameter name="nocompile" value="${nocompile}"/>
        <ora:parameter name="clean" value="true"/>
      </ora:deploy>
    </ora:ojdeploy>



    <ora:ojdeploy xmlns:ora="oraclelib:OJDeployAntTask"
                  executable="${ojdeploy.path}" failonerror="true"
                  ora:statuslog="${basedir}/${oracle.jdeveloper.deploy.dir}/${project.deploy.name}-ojdeploy-statuslog.xml"
                  ora:buildscript="${basedir}/${oracle.jdeveloper.deploy.dir}/ojdeploy-build.xml">     

      <ora:deploy>
        <ora:parameter name="workspace" value="${workspace.fixed.location}"/>
        <ora:parameter name="project" value="${project.model.name}"/>
        <ora:parameter name="profile" value="${project.model.deploy.name}"/>

        <ora:parameter name="nodatasources" value="true"/>
        <ora:parameter name="basedir" value="${basedir}"/>
        <ora:parameter name="nocompile" value="${nocompile}"/>

        <ora:parameter name="clean" value="true"/>
      </ora:deploy><ora:deploy>
        <ora:parameter name="workspace" value="${workspace.fixed.location}"/>
        <ora:parameter name="project" value="${project.name}"/>
        <ora:parameter name="profile" value="${project.deploy.name}"/>

        <ora:parameter name="nodatasources" value="true"/>
        <ora:parameter name="basedir" value="${basedir}"/>
        <ora:parameter name="nocompile" value="${nocompile}"/>

        <ora:parameter name="clean" value="true"/>
      </ora:deploy>
    </ora:ojdeploy>

Thursday, February 28, 2013

Tuning ojdepoy memory settings etc

Ojdeploy uses /jdev/bin/jdev.conf which in turn uses /ide/bin/ide.conf do any changes made here will make an impact on ojdeploy.

If you want to add something to improve performance extra memory or different gc try changing these files and see if it makes any difference for you:

Example:

AddVMOption -Xmx3G
AddVMOption -Xms1G
AddVMOption -Xgc:throughput

Also I have found when using an ant task to call ojdeploy the less you invoke it the better the performance - so I guess an exec with a buildfile would work the fastest. - yet to take metrics so don't quote me on this just yet...

Monday, February 18, 2013

Warning: weblogic.servlet.internal.dd.compliance.ComplianceException: The filter-mapping with url-pattern="/oracle/webcenter/portalapp/pages/*" must specify a non-empty filter-name.

Somehow I managed to delete the webCenterLoginCountFilter from my web.xml and was getting a warning when I tried to compile adding the filter back solved problem.


Warning: weblogic.servlet.internal.dd.compliance.ComplianceException: The filter-mapping with url-pattern="/oracle/webcenter/portalapp/pages/*" must specify a non-empty filter-name.

11.1.1.6 into production


We implemented PS5 (from PS3) into production this weekend and all seems to be going smoothly.
I have got to say this has been one of the better ADF/ Webcenter upgrades I have done.

Lets hope 12c is around the corner for another challenge.


ADF: Minor PS3 - PS5 bug

I could not access the security tab on my Webcenter admin console and was getting a  error which was cause by:

Caused by: java.lang.NullPointerException
    at oracle.webcenter.security.common.WCGroup.(WCGroup.java:74)
    at oracle.webcenter.security.common.IdentityWrapper.getGroup(IdentityWrapper.java:183)
 

We have a mapping from JNDI role to Administrator and it had this under members of the app role:
<member>
  <class>weblogic.security.principal.WLSGroupImpl</class>  <name>Administrators</name>
</member>

Removed this and all is good again.

Reference :
https://forums.oracle.com/forums/thread.jspa?messageID=10423076

Thursday, February 14, 2013

MANIFEST.MF merge JDeveloper for an executable jar

Goto your project > properties. Then click on deployment in the menu.
Edit or add a jar deployment profile.
Fill in the details under jar options
(select Include manifest and give it a main class name)





Also remember that the merge functionality only works with a BLANK line at the end of the merge file. REALLY this caught me.

My merge file contents:


Class-Path: commons-codec-1.3.jar

[...empty line here CRLF...]

Friday, February 8, 2013

Webcenter folder not working 11.1.1.6 NullPointerException

Our WebCenter portal has a custom menu and when clicking on a folder link I got an empty popup then next click a NullPointerException.

Fix just added a check and disable the links we where using if they are not navigable.

<af:commandLink id="mnuCbx"
      actionListener="#{navigationBean.processAction}"
      blocking="true" action="pprnav"
      disabled="#{!node.navigable}">
    <af:outputText value="#{node.title}" id="pt_ot2"/>
    <f:attribute name="node" value="#{node}"/>
    <f:attribute name="treeLink" value="#{true}"/>
</af:commandLink>

Very cool document - set of expressions for web center and an explanation
http://docs.oracle.com/cd/E23943_01/webcenter.1111/e10148/jpsdg_app_els.htm

Wednesday, January 30, 2013

Webcenter install : java.lang.ClassNotFoundException: oracle.jrf.wls.JRFStartup

I did a fresh install of Web Center and was starting up my managed server through the console: [Windows]
I got a bunch of errors in my log file and the deployment failed.

java.lang.ClassNotFoundException: oracle.jrf.wls.JRFStartup


Fix:
 Find your nodemanager.properties -should be [Weblogic Dir]\wlserver_10.3\common\nodemanager
 Change the line StartScriptEnabled=false to StartScriptEnabled=true.
  Everything should work

If not check that you have the JFR stuff installed.

Monday, January 28, 2013

Redhat: Heirloom mail config

I wanted to add an account in mailx for my Nagios setup.
Could not find any docs on it (maybe I didnt search enough) but here we go:

The config file: /etc/mail.rc
Just added an new account to the end of the file like such

account newsmtp {
set record=+Sent
set from="Administrator "
set smtp=smtp://smtp-relay.blah.com:25
}

Viola I can now in my commands.cfg config of nagios:
(/usr/local/nagios/etc/objects) just add the -A projsmtp to use this account in the mail setup

# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -A newsmtp -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}

# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -A newsmtp -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}

Friday, January 25, 2013

Oracle WebCenter licenses

After a long time trawling the internet for details on how web center licenses work (what products you can use with each license) I spotted my mistake.
DONT search for WebCenter licenses search for Fusion Middleware licenses. Makes all the difference.

And for the lazy (11.1.1.6)
http://docs.oracle.com/cd/E23943_01/doc.1111/e14860/toc.htm

Hudson vs Jenkins: Phase 2

Ok so in a earlier post I made a choice to go with Hudson over Jenkins for various reasons:

http://javaosdev.blogspot.com/2011/10/hudson-or-jenkins-for-me.html

But now the decision is back and I have decided to install Jenkins this time and so far so good.

JIRA: Exception caught in 500 page null : java.lang.NullPointerException


I imported my buzilla database into JIRA and could not search on external id field after the import.
I was getting the following error in the logs:

java.lang.NullPointerException
        at com.atlassian.jira.issue.customfields.searchers.transformer.FreeTextCustomFieldSearchInputTransformer.validateParams(FreeTextCustomFieldSearchInputTransformer.java:60)

Step 1 was to remove the Freetext search from the External ID custom field.
I then added the freetext search back to the custom field.
I then reindexed and like magic my error went away.



Thursday, January 24, 2013

Change of jira context : Confluence sharing database

Ok so I changed my context on my jira server to /jira (I had to authenticate a number of time and it was annoying me).

NOTE: My jira and confluence are installed on the same machine and use the JIRA authentication database.


When restarting confluence I could not log in.. bummer

I updated the JIRA reference in the admin console and still no joy so I looked in the logs: /var/atlassian/application-data/confluence/logs for me.

I was getting this error:

com.atlassian.crowd.exception.InvalidCrowdServiceException: The following URL does not specify a valid Crowd User Management REST service: http://server:8080/rest/usermanagement/1/event
     

So I logged into the db and changed in the ATTRIBUTE_VALUE column to the correct new server context  http://server:8080/jira in CWD_DIRECTORY_ATTRIBUTE table where the ATTRIBUTE_NAME was crowd.server.url.


Fixed my problem right up.



Tuesday, January 15, 2013

Weblogic: Authentication denied: Boot identity not valid

When I changed my admin password and tried to start up my managed servers I got the following (admin server was working fine): Weblogic 10.3.6

Authentication denied: Boot identity not valid; The user name and/or password from the boot identity file (boot.properties) is not valid. The boot identity may have been changed since the boot identity file was created. Please edit and update the boot identity file with the proper values of username and password. The first time the updated boot identity file is used to start the server, these new values are encrypted.


Solution:


Stop you managed server

rename \data\ldap to \data\ldap

Restart managed servers.

Worked for me

Thursday, January 10, 2013

ADF: Upgrade issues from 11.1.1.4 to 11.1.1.6

Firs thing I encountered was that our menu was not refreshing as it had been : as soon as we clicked on the custom menu the normal menu would no longer refresh.

This is the code that was causing the problem:
 

So once we had done a code RichTreeTable.setValue on the tree the EL item would no longer be executed after this point.

Makes sense so I just removed the setValue and perform everything through EL.

Monday, January 7, 2013

WARNING: oracle.webcenter.lifecycle.exception.LifecycleLockedException: A lock exists that prevents the export set import.

Ok, so this is and expected error in the logs, although not nice it can be ignored (IN A CLUSTER).

Taken from the oracle documentation: (http://docs.oracle.com/cd/E28271_01/webcenter.1111/e25595/jpsdg_deploy_portlets.htm)

This is expected behavior. When you deploy your application, the producer metadata exported into the EAR file (as a MAR file) needs to be imported into an MDS schema for use in the production environment. Importing the metadata occurs automatically during deployment. This import only needs to happen with one node in the cluster, so a lock is created to prevent other nodes in the cluster trying to perform the same operation.

Wednesday, January 2, 2013

ADF - MDS-00521 error while reading document metadata repository



MDS-00569 unable to read document

I got this error when deploying my Web Center app. All it was was a small spelling error in the partition name.

There are other reasons that this happens but copying and pasting the name from another environment helped.