Tuesday, August 12, 2014

SOA Composite Cheat sheet

Declaring a new variable of XMLType
Technically it can be defined in any scope of any XMLType (if not found import it), but it is recommended to define it where it is really needed.
Create a new scope in the block where it is needed and define it, otherwise it may throw totally unrelated exceptions - you will not be able to figure out.

Initializing a new variable of XMLType already declared
Any XMLType variable must be initialized before it is getting used.


How to avoid generation of xmlns="" while doing mapping in xpaths
Declare and initialize the parent XMLType variable and while assigning or appending use the child of the newly defined variable to avoid getting xmlns="" in the xml tag.


How to append instead of assign while mapping xpaths
Do the mapping as you normally do first. Once mapping is done then right click the mapped path and convert it to append, it should create a + plus icon in the left xml xpath which shows that it got converted to append instead of assign.


Tuesday, March 18, 2014

Oracle Business Rules Cheat sheets

Section 1: Oracle Business Rules

Details:

  • When facts are modified as part of action inside business rules, business rules are getting fired again based on the new data
  • Priority/Order can be set in business rules in order to call them in a particular order
  • Business rules can be made active/inactive by checking the "Rule Active" check box
  • Inactive business rules are not getting fired and are same as commented code

Section 2: Oracle Business Rule Facts

Details:

  • Facts can be defined as RL Facts and properties (one or more) can be added to the fact.
  • While defining a property as an ArrayList, defining the property's array list item type (e.g. Person type fact) throws an undefined fact error, so its better to leave the array list item type as blank.
  • Facts can be asserted using assert new action in initial action, these assertions will not be maintained by names -
  • Facts can be created using assign new and then can be asserted, these will be available by names as well
  • Facts are directly accessible in Oracle Business Rules
  • Facts are not accessible in BRE Functions
  • Collection of facts or fact itself can be passed from Oracle BRE to function while calling the function
  • Facts need to be used in BRE, if they are not used in BRE, BRE cannot be compiled and deployed even if they are used in initial actions

Section 3: Oracle Business Rule Functions

Details:

Section 4: Oracle Business Rule Initial Action

Details:

Monday, December 30, 2013

Reset SVN (Subversion) account information in JDeveloper

Once the account info (username, password or repository url) is set in JDeveloper, SVN (subversion) plugin its hard to change any of these using jDeveloper.

Here is how these can be changed:
  1. Save your data and close JDeveloper
  2. Find the repositories.xml file, normally it is located in user's home directory and in following subdirectory: 
      .jdeveloper/system11.1.1.6.38.61.92/o.jdeveloper.subversion
  3. Rename the file repositories.xml to repositories.xml.bak
  4. Open JDeveloper and try to checkout a file, it will ask you to enter the account information again.
  5. Enter the updated account info, test access and you are done!

Monday, April 1, 2013

Update the remote producer handle

How to update the remote producer handle?
There are multiple ways to update the remote producer handle, two of them are given here:
1. By accessing the Portal Admin Console
2. By updating the Portal database directly

Both of these methods has pros and cons.
Updating via path 1 is a standard procedure and lot of documentation can be found on the web and oracle technical documentation website. It may take lot of time to update the remote producer handles depending upon the network, firewall and number of handles itself, since every update attempted via console will try to connect to the incorrect url first and should return error as a result before one can update it.

However going via path 2 requires little courage and technical expertise. Make sure you have a database backup before you attempt this path.
Steps to update the remote producer handles directly through database:
- Find all the producer details that need to be updated
- Verify along the table pf_consumer_registry to see if you need to update the producers
- Find the PRODUCER_ID and WSDL_URL from pf_consumer_registry table
- Update the WSDL_URL for the PRODUCER_ID that needed to be updated.
- Commit the transaction and verify the same using portal admin console.

If things go wrong, feel free to restore the database.

Note: WebLogic Portal 10.3.2 & WebLogic Portal 10.3.4 has been used and tested while writing this post and they were successfully updated.

Wednesday, March 20, 2013

org.xml.sax.SAXParseException: Element type

Problem: While using tag <shellscript>  as example given below the word boundaries < and > does not work with build file and throws the error as given below:
Sample <shellscript> block:



                  echo "mybuild.xml" | grep "\.xml\>" 1> /dev/null
                  OUTPUT1=$?



Error stack trace:


BUILD FAILED
/opt/appl/project/build.xml:274: Element type "build" must be followed by either attribute specifications, ">" or "/>".
        at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:225)
        at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:138)
        at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:97)
        at org.apache.tools.ant.Main.runBuild(Main.java:683)
        at org.apache.tools.ant.Main.startAnt(Main.java:200)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: org.xml.sax.SAXParseException: Element type "build" must be followed by either attribute specifications, ">" or "/>".
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
        at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1414)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.seekCloseOfStartTag(XMLDocumentFragmentScannerImpl.java:1395)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:269)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
        at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:133)
        at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:173)
        at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:209)
        at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:138)
        at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:96)
        at org.apache.tools.ant.Main.runBuild(Main.java:683)
        at org.apache.tools.ant.Main.startAnt(Main.java:199)
        ... 2 more
--- Nested Exception ---
org.xml.sax.SAXParseException: Element type "build" must be followed by either attribute specifications, ">" or "/>".
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
        at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1414)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.seekCloseOfStartTag(XMLDocumentFragmentScannerImpl.java:1395)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:269)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
        at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:133)
        at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:173)
        at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:209)
        at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:138)
        at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:96)
        at org.apache.tools.ant.Main.runBuild(Main.java:683)
        at org.apache.tools.ant.Main.startAnt(Main.java:199)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)



Cause: < is assumed to be the start tag for build.xml file i.e. in the above example <build is assumed to be the start tag and it complains about the missing closing tag >

Solution: Replace <s; with b i.e. word boundries. Start boundary \< can be replaced with \b and end boundry \> can be replaced with \b in the regular expression.

Friday, February 8, 2013

Propagation Timeout Exception

Problem: While running propagation on WebLogic Portal, it is timing out after 1 Hour/ 3600 seconds.

Error Stack Trace:

Caused By: javax.ejb.EJBException: nested exception is: javax.ejb.EJBException: SQL Error while performing get operation on portlet instance: SQL [select DEF.MARKUP_DEFINITION_ID, DEF.IS_FORKABLE, INST.INTERSECTION_ID, DEF.PORTLET_LABEL, INST.PORTLET_LABEL, DEF.CONTENT_URI, DEF.BACKING_FILE, DEF.IS_PUBLIC, INST.PORTLET_DEFINITION_ID, INST.THEME_DEFINITION_ID, INST.TITLE_BAR_ORIENTATION, INST.DEFAULT_MINIMIZED, INST.INSTANCE_TYPE, INST.PARENT_PORTLET_INSTANCE_ID, DEF.FORK_RENDER, DEF.IS_CACHEABLE, DEF.CACHE_EXPIRES, DEF.PORTLET_FILE, DEF.IS_PORTLET_FILE_DELETED, DEF.HELP_URI, DEF.EDIT_URI, DEF.WEBAPP_NAME, INST.CREATION_DATE, INST.MODIFIED_DATE, DEF.CREATION_DATE, DEF.MODIFIED_DATE, PPV.PRODUCER_HANDLE, PPV.PORTLET_HANDLE, PPV.PORTLET_STATE_CHANGE, PPV.REQUIRES_URL_TEMPLATES, PPV.TEMPLATES_STORED_IN_SESSION, PPV.PORTLET_STATE, PPV.IS_PRODUCER_OFFERED, INST.TITLE_KEY from PF_PORTLET_DEFINITION DEF, PF_PORTLET_INSTANCE INST left outer join PF_PROXY_PORTLET_INSTANCE_V PPV on PPV.PORTLET_INSTANCE_ID = INST.PORTLET_INSTANCE_ID where INST.PORTLET_INSTANCE_ID = ? and DEF.PORTLET_DEFINITION_ID = INST.PORTLET_DEFINITION_ID] portletInstanceId [1,456,041] database error code [0] SQL state [null].; nested exception is: java.sql.SQLException: The transaction is no longer active - status: 'Marked rollback. [Reason=weblogic.transaction.internal.TimedOutException: Transaction timed out after 36002 seconds 
BEA1-5C8E244BF578F5B2D7B1]'. No further JDBC access is allowed within this transaction.
at com.bea.netuix.application.manager.persistence.jdbc.ExportImportManagerImpl.updateDesktopView(ExportImportManagerImpl.java:144)
at com.bea.netuix.application.manager.persistence.jdbc.ExportImportManager_7mrwg_EOImpl.updateDesktopView(ExportImportManager_7mrwg_EOImpl.java:366)
at com.bea.propagation.netuix.online.util.PortalXIPHelper.importDesktop(PortalXIPHelper.java:292)
at com.bea.propagation.netuix.online.util.PortalXIPHelper.addOrUpdateDesktopDefinitionInternal(PortalXIPHelper.java:254)
at com.bea.propagation.netuix.online.util.PortalXIPHelper.addDesktopDefinition(PortalXIPHelper.java:193)
at com.bea.propagation.netuix.online.util.PortalXIPHelper.updateDesktopDefinition_Standard(PortalXIPHelper.java:211)
at com.bea.propagation.netuix.online.updater.PortalDesktopDefnNodeUpdater.updateNode(PortalDesktopDefnNodeUpdater.java:123)
at com.bea.propagation.framework.tool.resolver.TreeResolver.processUpdate(TreeResolver.java:868)
at com.bea.propagation.framework.tool.resolver.TreeResolver.processElectionsIterative(TreeResolver.java:509)
at com.bea.propagation.framework.tool.resolver.TreeResolver.processElections(TreeResolver.java:408)
at com.bea.propagation.framework.tool.resolver.TreeResolver.resolveTree(TreeResolver.java:317)
at com.bea.propagation.framework.tool.servlet.InventoryManagementServlet.commitOperation(InventoryManagementServlet.java:816)
at com.bea.propagation.framework.tool.servlet.InventoryManagementServlet.doOperation(InventoryManagementServlet.java:301)
at com.bea.propagation.framework.tool.servlet.InventoryManagementServlet.doPost(InventoryManagementServlet.java:201)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:821)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57)
at com.bea.p13n.servlets.PortalServletFilter.doFilter(PortalServletFilter.java:338)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)


Main cause: 
Since the propagation is running more than one hour (predefined timeout limit), it is getting timeout after one hour and transactions are being rolled back.

Other possible reasons:
Propagating between two domains which are separated by a firewall, could result in increased time for transactions going over the firewall. Firewall could consume as much as 400% time of actual propagation transactions depending upon the network configurations in enterprise environments. 

Proposed solutions:
Solution 1. Scope the propagation and/or use policy file for propagation to complete within 1 Hour.
Solution 2. Remove the firewall between the propagation domains (source and target), this may or may not save significant amount of time during propagation transactions.
Solution 3. Increase the transaction time out for propagation itself - this requires little more work, details to follow in upcoming posts.

These are the few possible solutions, there could be more like changing the way propagation works e.g. change the proliferation mode to ASYNC or OFF or so.

Tuesday, October 16, 2012

How to use Spring inside Struts Actions?

Spring can be integrated into Struts actions to take advantage of seamless bean findings, here is how:
Step 1: 
Create a BaseAction class and extend this class to create struts actions.
 
BaseAction.java (add spring-webmvc-struts.jar to web-inf/lib)
 
import org.springframework.web.struts.DispatchActionSupport;
public class BaseAction extends DispatchActionSupport {
 protected Object getBean(String name) {
  return getWebApplicationContext().getBean(name);
 }
} 
 
Step 2: Action class sample: 
BalanceAction.java 
public class BalanceAction extends BaseAction {
 @Override
 public ActionForward execute(ActionMapping mapping, ActionForm form,
   HttpServletRequest request, HttpServletResponse response)
   throws Exception {
  try {
   BeanService handle = (BeanService)getBean("BeanName");
   handle.businessMethod();
  } catch (Exception ex) {
   System.out.println("Cannot find the bean...");
  }
  return mapping.findForward("success");
 }
}

Maven Build Script setup for various configurations

Steps to include a jar in the EAR package while building:
Scenario 1. If the jar project is part of same EAR project heirarchy and need to build before packaging
Follow the steps given here:
step1: Add plugin maven-ear-plugin
step2: Add <configuration> block, add <modules> as follows:
 <configuration>
  <modules>
   <javaModule>
    <groupId>myProjectGroup</groupId>
    <artifactId>myArtifact</artifactId>
    <bundleFileName>myArtifact-x.0.jar</bundleFileName>
    <bundleDir>[Destination-Path]</bundleDir>
   </javaModule>
  </modules>
 </configuration>
Step3: Add the dependency as follows:
 <dependency>
  <groupId>myProjectGroup</groupId>
  <artifactId>myArtifact</artifactId>
  <version>x.0</version>
  <type>jar</type>
 </dependency>
Note: Don't specify the <bundleDir> if you want the jar file to go to default folder.

Scenario 2. If the jar is external and not part of EAR project heirarchy
Follow the steps given here:
step1: Add plugin maven-ear-plugin
step2: Add <configuration> block, add <modules> as follows:
 <configuration>
  <modules>
   <javaModule>
    <groupId>externalGroup</groupId>
    <artifactId>externalJarArtifact</artifactId>
    <bundleFileName>externalJarArtifact-x.0.jar</bundleFileName>
    <bundleDir>[Destination-Path]</bundleDir>
   </javaModule>
  </modules>
 </configuration>
Step3: Add the dependency as follows:
 <dependency>
  <groupId>externalGroup</groupId>
  <artifactId>externalJarArtifact</artifactId>
  <version>x.0</version>
  <scope>system</scope>
  <systemPath>[external-jar-local-path]/externalJarArtifact-x.0.jar</systemPath>
 </dependency>
Note: Don't specify the <bundleDir> if you want the jar file to go to default folder.

Is it the right time to buy a home or rent ?

To analyze whether you should buy a home now or still rent it depends on so many factors including:
- How long you will live in the home?
- How big you want the home?
- How much you can afford?
- What is the market trend?
- How much rent you are paying?
- Property tax
- Mortgage rate

You can analyze here http://www.ginniemae.gov/