Tuesday 1 February 2011

WebSphere Portal v7 - Problems creating Virtual Portals

*CAVEAT* This worked for me - it may not work for you - if in doubt, please contact IBM Support and raise a PMR. In addition, please check this Wiki article re Virtual Portals and WebSphere Portal v7.

Back in 2008 and 2009, I had blogged about using templates to drive the creation of Virtual Portals.

Well, today a colleague and I both saw a similar problem where the Virtual Portal wizard was failing with: -

Error EJPAH2010E: Failed to create virtual portal.

com.ibm.portal.WpsException: EJPAH5002E: Failed to initialize virtual portal.
at com.ibm.wps.portlets.managevirtualportals.actions.DoCreateVirtualPortalAction.initializeVPContentTree(DoCreateVirtualPortalAction.java:780)
at com.ibm.wps.portlets.managevirtualportals.actions.DoCreateVirtualPortalAction$2.run(DoCreateVirtualPortalAction.java:284)
at com.ibm.wps.portlets.managevirtualportals.actions.DoCreateVirtualPortalAction$2.run(DoCreateVirtualPortalAction.java:280)
at com.ibm.wps.ac.impl.UnrestrictedAccessImpl.run(UnrestrictedAccessImpl.java:84)
at com.ibm.wps.command.ac.ExecuteUnrestrictedCommand.execute(ExecuteUnrestrictedCommand.java:95)
at com.ibm.wps.portlets.managevirtualportals.actions.DoCreateVirtualPortalAction.createVirtualPortal(DoCreateVirtualPortalAction.java:288)
at com.ibm.wps.portlets.managevirtualportals.actions.DoCreateVirtualPortalAction.doExecute(DoCreateVirtualPortalAction.java:115)
at com.ibm.wps.portlets.adminstruts.actions.BaseAction.execute(BaseAction.java:64)
at com.ibm.wps.portlets.struts.WpsRequestProcessor.processActionPerform(WpsRequestProcessor.java:338)

Error EJPAH2013E: Failed to execute xmlaccess script.

com.ibm.portal.WpsException: EJPAH2013E: Failed to execute xmlaccess script.
at com.ibm.wps.portlets.managevirtualportals.utils.XmlAccessUtil.executeXmlScript(XmlAccessUtil.java:118)
at com.ibm.wps.portlets.managevirtualportals.actions.DoCreateVirtualPortalAction.initializeVPContentTree(DoCreateVirtualPortalAction.java:766)
at com.ibm.wps.portlets.managevirtualportals.actions.DoCreateVirtualPortalAction$2.run(DoCreateVirtualPortalAction.java:284)
at com.ibm.wps.portlets.managevirtualportals.actions.DoCreateVirtualPortalAction$2.run(DoCreateVirtualPortalAction.java:280)
at com.ibm.wps.ac.impl.UnrestrictedAccessImpl.run(UnrestrictedAccessImpl.java:84)
at com.ibm.wps.command.ac.ExecuteUnrestrictedCommand.execute(ExecuteUnrestrictedCommand.java:95)
at com.ibm.wps.portlets.managevirtualportals.actions.DoCreateVirtualPortalAction.createVirtualPortal(DoCreateVirtualPortalAction.java:288)
at com.ibm.wps.portlets.managevirtualportals.actions.DoCreateVirtualPortalAction.doExecute(DoCreateVirtualPortalAction.java:115)
at com.ibm.wps.portlets.adminstruts.actions.BaseAction.execute(BaseAction.java:64)

Error EJPEB0002E: An exception occurred.

com.ibm.wps.command.CommandFailedException: EJPEB0002E: An exception occurred.
WrappedException is: com.ibm.wps.command.xml.XmlCommandException: EJPXA0025E: The resource was not found in the portal, either because it does not exist or because you have not specified an identifying attribute in the XML input. [portlet Z3_CGAH47L000J610IAHHCB8L2G70 name=IWidgetWrapper.$cloned.Z3_CGAH47L000J610IAHHCB8L2G70]
at com.ibm.wps.command.xml.XmlCommand.execute(XmlCommand.java:264)
at com.ibm.wps.portlets.managevirtualportals.utils.XmlAccessUtil.executeXmlScript(XmlAccessUtil.java:101)
at com.ibm.wps.portlets.managevirtualportals.actions.DoCreateVirtualPortalAction.initializeVPContentTree(DoCreateVirtualPortalAction.java:766)
at com.ibm.wps.portlets.managevirtualportals.actions.DoCreateVirtualPortalAction$2.run(DoCreateVirtualPortalAction.java:284)
at com.ibm.wps.portlets.managevirtualportals.actions.DoCreateVirtualPortalAction$2.run(DoCreateVirtualPortalAction.java:280)
at com.ibm.wps.ac.impl.UnrestrictedAccessImpl.run(UnrestrictedAccessImpl.java:84)
at com.ibm.wps.command.ac.ExecuteUnrestrictedCommand.execute(ExecuteUnrestrictedCommand.java:95)
at com.ibm.wps.portlets.managevirtualportals.actions.DoCreateVirtualPortalAction.createVirtualPortal(DoCreateVirtualPortalAction.java:288)

Error EJPXA0025E: The resource was not found in the portal, either because it does not exist or because you have not specified an identifying attribute in the XML input.

com.ibm.wps.command.xml.XmlCommandException: EJPXA0025E: The resource was not found in the portal, either because it does not exist or because you have not specified an identifying attribute in the XML input. [portlet Z3_CGAH47L000J610IAHHCB8L2G70 name=IWidgetWrapper.$cloned.Z3_CGAH47L000J610IAHHCB8L2G70]
at com.ibm.wps.command.xml.UpdateEngine.locateItem(UpdateEngine.java:422)
at com.ibm.wps.command.xml.UpdateEngine.processItem(UpdateEngine.java:230)
at com.ibm.wps.command.xml.UpdateEngine.processItem(UpdateEngine.java:238)
at com.ibm.wps.command.xml.UpdateEngine.processItem(UpdateEngine.java:238)
at com.ibm.wps.command.xml.UpdateEngine.updateTopLevelItem(UpdateEngine.java:188)
at com.ibm.wps.command.xml.XmlAccessHandler.fillObjectModel(XmlAccessHandler.java:345)
at com.ibm.wps.command.xml.XmlAccessHandler.endElement(XmlAccessHandler.java:227)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.endElement(Unknown Source)

Now we both suspected that the problem was with the template that's used to actually create the VP itself.

In the past, this template was called InitVirtualPortal.xml and was located in: -

/opt/IBM/WebSphere/AppServer/profiles/wp_profile/installedApps/wpx7/wps.ear/wps.war/virtualportal

However, in version 7, things have changed.

It now transpires that it's, by default, located within a ZIP file ( VirtualPortal.zip ) in this directory: -

/opt/IBM/WebSphere/AppServer/profiles/wp_profile/config/cells/wpx7/assets/VirtualPortal.zip/aver/BASE/bin

Therefore,  I needed to do the following: -

a) Backup the original VP template ZIP file: -

cd /opt/IBM/WebSphere/AppServer/profiles/wp_profile/config/cells/wpx7/assets/VirtualPortal.zip/aver/BASE/bin/
mv VirtualPortal.zip Original_VirtualPortal.zip

b) Create a temporary directory - mkdir /tmp/foobar
c) Change to this directory - cd /tmp/foobar
d) Extract the contents of the zip file - unzip /opt/IBM/WebSphere/AppServer/profiles/wp_profile/config/cells/wpx7/assets/VirtualPortal.zip/aver/BASE/bin/VirtualPortal.zip
e) Edit the VP template - vi InitVirtualContentPortal.xml
f) Locate and remove the offending resources - there were actually references to three iWidgetWrapper clones: -

<portlet action="locate" name="IWidgetWrapper.$cloned.Z3_CGAH47L000J610IAHHCB8L2G70" objectid="Z3_CGAH47L000J610IAHHCB8L2G70"/>
<portlet action="locate" name="IWidgetWrapper.$cloned.Z3_CGAH47L000J610IAHHCB8L2G77" objectid="Z3_CGAH47L000J610IAHHCB8L2G77"/>
<portlet action="locate" name="IWidgetWrapper.$cloned.Z3_CGAH47L000J610IAHHCB8L2GN1" objectid="Z3_CGAH47L000J610IAHHCB8L2GN1"/>

g) Re-zip the files - zip ~/VirtualPortal.zip *
h) Place the newly created VirtualPortal.zip into the appropriate directory - cp ~/VirtualPortal.zip /opt/IBM/WebSphere/AppServer/profiles/wp_profile/config/cells/wpx7/assets/VirtualPortal.zip/aver/BASE/bin/. For the record, this is what I now have in that directory: -

-rwxrwx--- 1 root root 281206 Nov 12 09:49 Original_VirtualPortal.zip
-rwxr-xr-x 1 root root 276607 Feb  1 00:47 VirtualPortal.zip

i) Re-try the VP creation process

And, with the click of my heels, it all worked OK.

*UPDATE* My colleague also mentioned that, if you see exceptions such as when you try and create a Virtual Portal of the same name as the one that had previously failed, you may need to do a "clean-up", as per these two Technotes: -

Error messages when attempting to recreate a virtual portal

Unable to create new virtual portal after virtual portal deletion

In essence, you need to create an XMLAccess script e.g. cleanup.xml,
and invoke it as follows: -

/opt/IBM/WebSphere/PortalServer/bin/xmlaccess.sh -in cleanup.xml -url http://localhost:10039/wps/config -user wpadmin -password passw0rd


I'm not sure what led to this problem - it *MAY* have been something I did early on when I was "playing" with Widgets and Portlets - I'll try the same process with a vanilla installation, and report back.

*CAVEAT* This worked for me - it may not work for you - if in doubt, please contact IBM Support and raise a PMR. In addition, please check this Wiki article re Virtual Portals and WebSphere Portal v7.

2 comments:

HAITX said...

Dear Dave Hay!

I used websphere portal 7 and create multi vitual portal; some of them has problem. I delete vitual portal has failed. When I recreate a new virtual portal using the same URL context was meet error:
EJPAH2010E: Failed to create virtual portal. Detail:
EJPAH2010E: Failed to create virtual portal
EJPEB0806E: Creating a virutal portal failed because a unique key constraint in the data backend was violated. Likely a virutal portal with the same context was deleted but still exists in the database. It is recommended to run the cleanup task for deleting resources by running the XML script Task.xml using the XML configuration interface.


I had run XMLAccess using the input script Task.xml. Then still error.
Next, I run remove and recreate the scheduler by running the following task:

ConfigEngine remove-scheduler

ConfigEngine create-scheduler

and run script Task.xml again.

Results still error.

I readed this article see your command:

xmlaccess.sh -in cleanup.xml -url http://localhost:10039/wps/config -user wpadmin -password passw0rd
I dont find cleanup.xml file.

Can you help me fix this problem and sent to me cleanup.xml file.

Thank You very much!
---
Hai

Dave Hay said...

@Hai - thanks for your comments. You will find the source XML file within this Technote: -

Unable to create new virtual portal after virtual portal deletion

Visual Studio Code - Wow 🙀

Why did I not know that I can merely hit [cmd] [p]  to bring up a search box allowing me to search my project e.g. a repo cloned from GitHub...