Skip to main content

Posts

Showing posts from 2012

Jdeveloper 11.1.1.6 upgrade integrated server to 10.3.6

NOTE: This may break some stuff so backup before you proceed so you have been warned Prerequisites: Install JDev 11.1.1.6 Run integrated weblogic. Now install just weblogic 10.3.6 I used the generic installer. java  -jar -D64 -Xmx1024M wls1036_generic.jar Next > Select Create new MiddlewareHome and enter a value > Next > Typical > Next Now select your JDK and click Next * 3 Run QuickStart Click Next Select 9.0 or Higher Click Next Find your integrated domain  [usually under C:\Users\[username]\AppData\Roaming\JDeveloper\system11.1.1.6.38.62.29\DefaultDomain] NOTE: On windows I had to make this folder ! read only but this is not recommended. If you don't want to do this Install your integrated server in a different location Click Next. Once the Installer has finished backup setDomainEnv.cmd then copy setDomainEnv.cmd.back to setDomainEnv.cmd and edit the line: set WL_HOME=... and make it set WL_HOME=C:\Dev\Oracle\Weblogic_10.3....

ADF : Some solution to various UI related problems

11.1.1.5 So here is my handy list to myself of things to check if you are getting weird problems with things that should work (buttons not work, or drop downs misbehaving): Mark you table as contentDelivery="immediate" Remove partialSubmit="true" from some buttons Remove immediate="true" from buttons Use af:forEach instead of af:iterator.

Java: Generics dont keep it simple stupid

So I was playing around with generics (dont love them because of type erasure - class level is ok method level gets scary) the other day and here are some examples and lessons learned: 1) Method level generics with return types are harder than they look. 2) Wildcards and when to use them confuse me. 3) My code is ugly and I must be missing something but what - who knows. What I wanted was a Singleton class with generic get and put methods (what you put in is what you get out) without the cast. Something that works a little like Collections.emptyList(); The map I was storing my generic stuff in  ignore the naming for now: What I wanted to do is something like this: CacheItem<AnItem>  someCacheItem  = new DateCacheItemImpl<AnItem>(); Cache.getInstance().register(NameCacheItem.class); Cache.getInstance().put(someCacheItem); CacheItem<AnotherItem>  anotherCacheItem  = Cache.getInstance().get(); p...

ADF: SelectOneChoice ForEach, Filter - Drop down list keeping the first size selected

Ok so I had a bunch of filters all rendered from a backing bean using the forEach tag to render the select items. On updating the table the filters would always have the size of the initially selected item - not good. So if you fist selection had one item in the filter the filter would always be one item big. SOLUTION: Changed from a forEach to a f:SelectItems creating the Select items in my backing bean - everything worked. Nice and simple.     public List<SelectItem> listUniqueSelectItemList(List<String> items) {         List<SelectItem> itemList = new ArrayList<SelectItem>();         if (items != null) {             for (String item : items) {                 itemList.add(createSelectItem(item));             }         }         return itemL...

ADF : task flow replace whole page not current region

Ok so this is one way to break out of the region you are in and replace a parent or root region. So in your child task flow instead of calling a task flow directly using a control flow case just point your control flow case to a Parent Action (get it from the component panel). There you can specify an outcome in a parent task flow. Job done.

Web Center ADF : What a dirty little problem MDS override customizations

I have a customizable table where you can save sort orders to the database (custom not mds driven - don't ask why - you don't want to know). So everything works for me locally but upon deployment to Web Center once you have moved one column everything has that column order in the table no matter what until you close the browser and re login. Not I have no MDS configured on my local box. Turns out someone turned mds config on in my project properties thus rendering my custom ordering view useless because MDS would override my changes - so I turned MDS off in this project because I dont need it. I am not sure what you would do if you needed it on would need to customize it a bit I guess - not easy. PAIN in the arse to figure this one out. O yhea and dont think just clicking the MDS to off will remove your problem check the adf-config.xml to check if any elements have been hard set to persist.

Java: On login trigger code run after login

Ok so from the title you can see I am hanging around the database for way to long. I needed to have some code executed when I logged on so this is what I did: I threw together a quick HttpSessionListener like such: package za.co.test.web.faces.listener; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; public class LoginSessionListener implements HttpSessionListener {  @Override  public void sessionCreated(HttpSessionEvent event) {  doSomeStuff();  } @Override public void sessionDestroyed(HttpSessionEvent event) { // do nothing } } Then added the listener to my web.xml. <listener> <listener-class>za.co.test.web.faces.listener.LoginSessionListener</listener-class> </listener> All working and sorted.

XSLT : Fun with xslt and xpath with fop

So I wanted a generic, all things to all men style sheet transformation on my service call to generate a PDF report for any xml message. I had to do this using XSLT 1.0 booo hiss. This really make things harder. So here is what I learned: So the first thing I needed was a JAXB transform from incoming object to xml.         JAXBContext context = JAXBContext.newInstance(xmlObject.getClass());         Marshaller marshaller = context.createMarshaller();         StringWriter sw = new StringWriter();         marshaller.marshal(xmlObject, sw);         IOUtils.closeQuietly(sw);         return sw.toString(); The next thing was passing parameters (a report title)             Transformer transformer = tFactory.newTransformer(xsltSrc);             transformer.setParameter("ReportTitle", "Report Title"...

My Pentaho experience

I was playing with pentaho over the weekend and must say I am impressed with what I have seen. The report designer is now very functional. I am going to have to play with it a bit more to be understand what can be done fully but producing a report with parameters is really easy once you get a hang of the tool. (I click on the query you want to modify and modify the sql instead of using the edit button) I replaced the pentaho security implementation with my own implementation and was surprised to find out how easy the spring security implementation was (one thing I wrote my own  GrantedAuthority implementation  which was a bad idea the default one org.springframework.security.GrantedAuthorityImpl works well and includes an equals, hashcode and compareto which mine did not and didnt work and implementation) 

ADF: Testing iterator settings Pojo Data Controls

Jdev 11.1.1.5 I was doing some investigation into the inner workings and some of the more useful properties on the iterator bindings in the page definition xml files to to satisfy my curiosity. So here are some findings I have to go into much more details than this but this should help someone. I had a basic page with one iterator (driving a select one choice) two buttons one with an action one with an action listener and a child iterator driving a table. I use any number of Refresh parameters on my page (always, deferred, ifNeeded) etc and the method bound was only called once on pressing any button or autoSubmit - all good. I the set the CacheResults parameter to false this lead to my method being called a number of times and some weird but expected behaviour still good. Now I changed to a methodIterator from a accessorIterator with one parameter and returned null  from the data control. The method was now called a number of times with a null parameter not g...

Eclipse maven problems m2e

Project configuration  is not up-to-date with pom.xml Right click project, select Maven, click Update Project configuration Plugin execution not covered by lifecycle configuration Click on the error nice red error (in the pom.xml Overview tab) Select the permanently mark goal as ignore, click ok Sorted

Derby, glassfish startup scripts

Startup script for my glassfish: call asadmin start-database --dbhost 0.0.0.0 --dbport 1527 call asadmin start-domain domain1 Stop script for my glassfish call asadmin stop-database call asadmin stop-domain domain1 Derby current time in sql CURRENT_TIMESTAMP

ADF Table dependant list select one choice : Thing I learned being stupid final

It ended up the source of all my problems was an invalid long to string conversion while rendering my select items. So if you are having endless hassles with a dependent select box in a table try this when you are rendering the lists to make sure you are not rendering a string and matching on long or int:     public List convertItem(List dataItems) {         ArrayList covertedList = new ArrayList ();         if (dataItems != null) {             for (Site dataItem : dataItems) {                 SelectItem item = new SelectItem(new String(dataItem.getId()), dataItem.getDescription());                 covertedList.add(item);             }  ...

ADF Dependant select items in a table: Things I learned being stupid

Hard hard thing to do - table of dependant select items that you can add new rows to. (backing bean driven) (When you add a new row it keeps values from the previous row) In my search for the answer I made an forEach act like a table - by using the f:attribute to pass through the current row - crazy but I hopw this helps someone sometime. Stuff I learned             <af:selectOneChoice label="#{labelBundle['choice_lbl']}"                                 id="soc1" value="#{row.choiceId}"                                 valueChangeListener="#{pageFlowScope.testBean.choiceValueChange}"                                 required="true"                     ...

ADF Defaulting a backing bean driven select: Thing I learned being stupid 1

Jdeveloper 11.1.1.5 Ok, I had a selectonechoice that was driven by a pojo data control and I just couldn't get its value defaulted. The following is what I learned along the way and my unique solution: Drag and drop the item onto the page as a single choice selectonechoice: Add a variable to your page binding (open your page and click on the bindings tab - right click on variables under Executables - insert inside variables - select variable - Name:selectedItemValue Type: java.lang.Object Then click on Page definition file and update the variable you just added and add these attributes DefaultValue=" #{pageFlowScope.TestBean.id} " IsUpdateable="2". NOTE: the bold bit  pageFlowScope.TestBean.id must be the value you want to default to. Or you can just paste the xml like such: <variable Type="java.lang.Integer" Name="selectedItemValue" DefaultValue="#{pageFlowScope.TestBean.id}" IsUpdateable="2" /> ...

SoapUI start mocks on project load

I wanted to find where you can set all your mocks to load on start up of your project: 1) Double click on your project 2) Click on the Load Script tab 3) Place the below script in the Script section. Press the play button to test  The Script for( ms in project.mockServiceList ) {     // open window     def dp = com.eviware.soapui.support.UISupport.showDesktopPanel( ms )     // start mockservice     ms.start()     // minimize window     com.eviware.soapui.SoapUI.desktop.minimize( dp ) } Information found at soap ui forum: http://www.soapui.org/forum/viewtopic.php?f=5&t=1138

ANT Jdeveloper what it really calls

I was wondering what Jdeveloper did in the background while running ant because I wanted to replicate exactly what was happening in JDev. So I set the ant run task to debug and passed in an invalid argument ant the following was the output: java -Djavax.xml.transform.TransformerFactory=com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl -Djavax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl -Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl -classpath %ORACLE_HOME%\jdeveloper\jdev\lib\ojc.jar;%ORACLE_HOME%\jdeveloper\jdev\lib\ant-rt.jar;%ORACLE_HOME%\jdeveloper\ant\lib\ant-antlr.jar;%ORACLE_HOME%\jdeveloper\ant\lib\ant-apache-bcel.jar;%ORACLE_HOME%\jdeveloper\ant\lib\ant-apache-bsf.jar;%ORACLE_HOME%\jdeveloper\ant\lib\ant-apache-log4j.jar;%ORACLE_HOME%\jdeveloper\ant\lib\ant-apache-oro.jar;%ORACLE_HOME%\jdeveloper\ant\lib\ant-apache-regexp.jar;%ORACLE_HOME%\jdevelop...

Using Soap UI to test services

I needed to test a screen that was backed by services and it was suggested that I use soapUI. I haven't used soapUI for a while now and was surprised to see mock service functionality. Mock Service ( http://www.soapui.org/Service-Mocking/concept.html ) So first take the wsdl you have and generate a mock service using soap ui. Create a new project: File Menu > Create new soapUI project. Select the wsdl you will be working with. Right click on the new Binding and select Generate MockService Press ok twice. Right click on the new Mock and select Start minimized. Ok I like using the Query Match functionality it just works for my brain: You can create as many mock responses as you like and edit the xml response as you wish. You the add Query matches for each of your responses based on data passed in. The xpath bit is the matching rules The expected value is the value to match on in the incoming message Last dropdown is the response you choose to retur...

ADF: Eclipse plugin

http://marketplace.eclipse.org/content/oracle-enterprise-pack-eclipse Anybody given this a try would really like to know if it works.  Will be giving it a look soon and will post comment here.

ADF : Pojo Data Control : structure definition does not have a primary key attribute

I had a minor difficulty with creating a POJO data control today. The create data control failed with the following error: structure definition does not have a primary key attribute Fixed the package problem (DC java file resided in a package different from what was specified in the package section inside the java class) Not a very clear error indeed, note to self don't make stupid errors.

ADF: debugging taskflows

I was having huge hassles with my task flow rerouting to themselves. I am using routers and pageflow scope varibles across bounded task flows. Mainly failed on task flow return items that went by default to a router. This post saved my bacon : http://biemond.blogspot.com/2008/10/debugging-task-flow-in-jdeveloper-11g.html Before and after listeners in your task-flow-call are also helpful for debugging: <before-listener>#{viewScope.chargeOutsEditBean.afterListener}</before-listener> <after-listener>#{viewScope.chargeOutsEditBean.afterListener}</after-listener>   public String beforeListener() {     System.out.println("beforeListener() {");     System.out.println("--------------------------->route Before:" + ADFContext.getCurrent().getPageFlowScope().get("route"));     return "blist";   }   public String afterListener() {     System.out.println("afterListener() {");   ...

ADF odd error : ADFC-10001: cannot instantiate class

Running one of my adf pages with some code in the construtor O got the following error: JspServlet error: Servlet unable to dispatch to the following requested page: The following exception occurred:javax.faces.FacesException: javax.faces.FacesException: oracle.adf.controller.ControllerException: ADFC-10001: cannot instantiate class 'za.co.test.adf.ops.view.common.form.TestBean' I was adding a partial target to my page in the constructor which is a no no - remove the line AdfFacesContext.getCurrentInstance().addPartialTarget(getResultTable()); and all was well again. Note: this can also be caused by any error in the bean constructor.

Java basic encryption decrypt util

Because I always need to do this for passwords in files and various utilities I thought I would post the code. Note: it is more secure to encrypt one way (cryptographic hashing) this is for simple no hassle cases. package za.co.test.common.util; import java.io.UnsupportedEncodingException; import java.security.InvalidKeyException; import java.security.Key; import java.security.NoSuchAlgorithmException; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.binary.Base64; public class EncryptionUtil { private static final byte[] SECRET_KEY = "TESTKEY2013StormersRugby".getBytes();     public static byte[] encryptToByteArray(String input)         throws InvalidKeyException, BadPaddingException, IllegalBlockSizeException, NoS...

ADF: PS_TXN unique constraint violated passivation

Ok so I had this problem in a few applications and want to solve it the best way once and for all. java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (SCHEMA.PS_TXN_PK) violated or oracle.jbo.PCollException: JBO-28030: Could not insert row into table PS_TXN, collection id . What a pain. So I have come across a couple of methods to solve this one: 1) Cleanup table regularly - this is a poor solution and is not guaranteed to work all the time. This involves creating a job to run (maybe twice a day) to sort the sequences out and clean up tables. Although it is the easiest to implement and requires no code changes. Can use this as a stop gap measure while your developers are fixing the real problem. 2) use a file store for passivation - better solution this one but I must test the performance impact and what to do if the filestore get corrupt. This involves setting the AM property  jbo.passivationstore = file on all Application Modules. Not...

Weblogic and ADF : migrateSecurityStore the hard way

I was struggeling to use WSLT to migrate my policy store for our production cluster there where classpath problems and naming problems and I just want to make the process easier for my self. So I wrote a little util to do the migration if nothing else this post will help me remeber the classes needed for the migration exercise. Script and classpath (I can post my linux script if anyone wants it) My jar file that you wont have but I will post the code: common.0.0.1.jar, ./migrator.jar Non adf etc 3rd party jars: ./lib/commons-cli-1.2.jar;./lib/commons-io-2.0.1.jar; SET WEBLOGIC_JAR=[your Middleware location]\wlserver_10.3\server\lib\weblogic.jar SET OLD_CLASSPATH=%CLASSPATH% SET CLASSPATH=%CLASSPATH%;%WEBLOGIC_JAR%;./lib/adf-controller-security.jar;./migrator.jar;./lib/adf-share-mbeans-wlst.jar;./lib/adfscripting.jar;./lib/commons-cli-1.2.jar;./lib/commons-io-2.0.1.jar;./lib/commons-logging-1.1.1.jar;./lib/common.0.0.1.jar;./lib/ldapjclnt11.jar;./lib/adf-share-base.jar;./lib/...

Weblogic and ADF: Unintended Consequences new session between weblogic apps and our project structure

Ok so a bit of background the following is our project stucture and all works well between applications that are deployed on one weblogic server they share sessions and user principals and roles. This setup allows us seperate jazn files across projects and to keep everything contained. Our base application is common which contains a set of projects for view, model, and common java code Common >     LoginModule (JAAS stuff)     Common (java code)     Model (company wide common model components)     View (company wide common model components) Shared Model     Model (All common lov, eo, vo files used across projects : NO Application Modules here) Various applications deployed as ears like finance, reports etc that contain Model and View projects   Home - this is the glue that binds all our applications together in a single menu etc it has NO dependacies on the other ear applications.   View...

ADF errors with template binding for templates within templates

I refactored my templates to contain templates within templates and all new screens I created stopped working. By not working my binding where not found using my utils methods to get the DCBindingContainer. For some reason when I created screens of my new templates it includes an extra form tag and binds my template to a page variable in the bindings <page path="za.co.test.pageDefs.defaultFormTemplatePageDef" id="ptb1" Refresh="ifNeeded"/>. If I remove the form tags and remove the page variable and its binding to my template all is good. Hopefully this saves you some time.

ADF : MDS-00013: no metadata found for metadata object

Weird error happend on one of my screens when I tried to call it, all my other screens worked perfectly. Removed the two MDS jars from my Model and View projects and like magic errors appeared in my build. Fixed up the errors (mainly related to refactoring and windows not recognising a difference in upper/ lowercase). Also had to do a clean before I built and remove the project directory in the o.j2ee folder. NOTE: Refactoring and changing case is dangerous. Also had this error where I had misspelt a task flow name.

ADF popups : Note to self

When using a popup dont have a trigger from your button onto the area in which your popup is. Behaviour: popup.show in code brought back nothing no popup and the code works elsewhere. Solution: move the popup to an area outside of the refreshed area.

Really now wtf : Jdeveloper 11.1.1.6 released

Warning Rant to follow : So where is 11.1.2.2 which has weblogic 10.3.6 and why two streams why not migrate the SOA/ Webcentre stuff etc to 11.1.2 and be done with it. I vote for one stream for all. Interesting addtitions: Drag and Drop on Touch Devices: On touch devices like tablets, the component drag and drop has a different gesture than with the mouse. An item that can be dragged must activated by a tap and hold gesture. The item will change its appearance to indicate that it can be dragged once held long enough. The same gesture applies to reordering table columns. Tap and hold the column header, then drag it to reorder the columns. MySQL Support: ADF Business Components have been tested with MySQL 5.5 Improved Compression of JavaScript: By using improved obfuscation techniques, the size of the compressed ADF JavaScript libraries has decreased by an average of 20% across all libraries. https://blogs.oracle.com/jdeveloperpm/entry/jdeveloper_11_1_1_6 http://ww...

ADF: Help my pages have dissapered from jazn-data.xml configuration

I opened my jazn-data and I had no task flows and web pages in the resource grants section. Shock and horror : I had made sure the show resource with and without grants was on (little lock and key icons) still not happening. Then I realized my mistake : ALWAYS have your Source Project set correctly to the view project mine was set to my build project. *embarrassed*

Hudson ADF ojdeploy build failure (Too many open files)

I moved our hudson server  (just zip up the $HUDSON_HOME directory and copy it across very easy) to a new redhat machine and the builds started failing with the error (Too many open files). This indicates that my open file limit has been reached for my user. - check this with the ulimit -n [this command check the users limit for open files ulimit -a to check all limits] and lsof -p <pid> | wc -l [get the pid by doing a ps -ef | grep hudson] To address this the easy way vi /etc/security/limits.conf and add/ edt the following lines (my was the default 1024): * soft nofile 2048 * hard nofile 2048

ADF : Automated testing lessons learned

Ok needed to help with some performance testing of our ADF apps login process and struggled a bit with some of the stuff so here are my findings: Firefox and Tamper Data: https://addons.mozilla.org/en-US/firefox/addon/tamper-data/ So so handy for catching all your post and get parameters cookies and headers. A must for automated testing to see what is going on in your app. More of a diagnostic tool. JMeter:  http://jmeter.apache.org/ Really really cool once I had found Chris Muirs post on setting up jmeter for ADF. (link below). You can make complicated test cases here very easily and run them any number of times in the ide. Very handy for doing volume testing. BadBoy: http://www.badboy.com.au/ If you want something that will record what you are doing/ click in your browser and export your scripts to JMeter for automated testing this is the tool for you. Selenium: http://seleniumhq.org/ Holy moly this is so easy to use and test with - just fire up firefox start the s...

Nexus vs Artifactory : My experience

Nexus : 1.9.2.4 Artifactory : 2.3.3.1 We needed a repository manager for our maven builds and decided to evaluate  Nexus (I had used Artifactory many time before and needed no evaluation). I found the Nexus UI was slicker and easier to use than Artifactory also like the file system storage idea. Very cool product. Unfortunatley we ran into some issues the Nexus builds we were doing where slower and kept timing out and blocking the repos. (The error was : this is 3 (re)try, cause: java.net.SocketException: Connection reset) NOTE: we are going through a proxy to get to the internet and could be the cause of the Nexus problem This was probably a configuration issue but I could not find a solution easily. So hi-ho hi-ho its back to Artifactory we go.