BCC Snapshot error fix

1. Click on Critical Reset (this may take several minutes)
2. Halt Deployments
3. In the “Overview” Section (Staging or Production – depending on which the error is occuring) click on the Projects tab and note the prdm id of the most latest project. You will need this id.
4. Go here: /nucleus/atg/epub/DeploymentServer/
5. Put the ID in step 4 in the “Force Snapshot ID” box and click Init.
6. This will force the snapshot.
7. Resume Deployments.
8. This will make the agents “healthy” but it will not resolve the initial issue that caused this. This “solution” is only to allow other deployments to go through. You will will need to resolve the issue that caused this.

Delete BCC Project

select * from epub_process where display_name = ‘ Name of your project‘; (this will give u processid)

select * from epub_process where display_name = ‘TEST1’

select * from epub_project where display_name = ‘Name of your project‘;(this will give u projectid)

select * from epub_project where display_name =  ‘TEST1’

 Go to publishing repository(atg/epub/publishingRepository in the dyn/admin of your BCC) and delete the process first by using remove-item then delete the project using remove-item

<remove-item item-descriptor=”process” id=”prc739000″></remove-item>

<remove-item item-descriptor=”project” id=”prj739000″></remove-item>

 

Checkout tag at Remote machine

Install git at CentOS:

sudo yum install git

List Tags:

git ls-remote –tags https://<username>:<password>@bitbucket.org/<bitbucket username>/<project>.git

Clone Tag:

git clone https://<username>:<password>@bitbucket.org/<bitbucket username>/<project>.git –branch “<TagName>” –depth 1

Clone Branch:

git clone https://<username>:<password>@bitbucket.org/<bitbucket username>/<project>.git -b <branch name>

Global AJAX method

Using following two ways you can handle all AJAX errors of your application at one central place.

Include these files in a common JS file which is available across all pages.

  1. ajaxSetup

$(function() {

$.ajaxSetup({
error : function(jqxhr, status, error) {
//do some action
}
});
});

2.  ajaxError

$(document).ajaxError(function(event, jqxhr, settings, thrownError) {
//do some action
});

 

Difference between ajaxSetup and ajaxError:

Well both can catch AJAX errors but in case of ajaxSetup, it would not be invoked if error method is defined individually for AJAX call, it would catch the errors only when error method is not defined for any AJAX call.

Whereas ajaxError always catches ajax error even if error method is defined for individual AJAX call.

 

So for examle, AJAX call has its own individual error method.

In case of ajaxSetup: error method of ajax call would be executed, ajaxSetup would not be executed.

In case of ajaxError: error method of ajax call would be executed, ajaxError would also be executed.

ATG application session implementation

Tools:

  • ATG 10.2
  • Weblogic 10.2.3

Target:

Handle time based session expiry and redirect user to home page.

Overview:

A servlet can be inserted into the dafpipeline through which all requests are passed, using out of the box component we can know if the session has expired for this request, once found we can take appropriate action like redirecting user to session time out page or home page.

Steps:

Configure time in weblogic

Home Page -> Domain Structure -> Deploymnets -> <Your deployment> -> Configuration tab -> Session Timeout (in seconds):

Default value is 1800 seconds i.e. 30 minutes

weblogictimeout

To apply session into atg app, we need to create pipeline servlet component using one of the following:

  1. projects.b2bstore.servlet. WACheckSessionExpiration
  2. projects.b2bstore.servlet. CheckSessionExpiration

 

If you are using WACheckSessionExpiration:

Create a property file like following:

$class=atg.projects.b2bstore.servlet.WACheckSessionExpiration
 # Specify where in the servlet pipeline this servlet should appear
insertAfterServlet=/atg/dynamo/servlet/dafpipeline/SessionSaverServlet
# Specify the root path (relative to the web app context root) of URLs'
# that we should check for session expiration
relativeExpirationPath=/checkout
# Specify the URL (relative to the web app context root) that we should
# redirect to if an expired session is detected.
relativeExpirationURL=/home
# Specify the web application registry where app is registered
webAppRegistry=/atg/registry/webappregistry/ServletContextWebAppRegistry
# Specify the name under which the web app is registered
webApplicationName=<Web App name>

If you are using CheckSessionExpiration:

Create a property file like following:

$class=atg.projects.b2bstore.servlet.CheckSessionExpiration
# Specify where in the servlet pipeline this servlet should appear
insertAfterServlet=/atg/dynamo/servlet/dafpipeline/SessionSaverServlet
#Complete URL where user would be redirected in case of session expiry
expirationURL=http://myhomepage.es
#Session would be checked for files under this directory only
sessionExpirationPath=/store/checkout

 

AJAX Calls:

Above solution would work for form submission but not for AJAX calls, by adding following to your JS file which is common for all pages you can handle the scenario.

$(document).ajaxError(function(event, jqxhr, settings, thrownError) {
if(jqxhr.status == 0){
window.location.href = ‘http://myhomepage.es’;
}
});

 

This is a global error method for AJAX which would be called for all AJAX errors.

As pipeline would redirect the request to home page, it will cause AJAX calls to fail hence status would be 0 and then you can do any action you want.

Fix VDI with corrupted header

Issue:

Abrupt shutdown lead to corruption of VDI header due to which it could not be re-booted again.

 

Could not open the medium ‘C:\Users\mohit\VirtualBox VMs\Ubuntu-Working\LinuxAgain.vdi’.

VDI: invalid header in ‘C:\Users\mohit\VirtualBox VMs\Ubuntu-Working\LinuxAgain.vdi’ (VERR_VD_VDI_INVALID_HEADER).

VD: error VERR_VD_VDI_INVALID_HEADER opening image file ‘C:\Users\mohit\VirtualBox VMs\Ubuntu-Working\LinuxAgain.vdi’ (VERR_VD_VDI_INVALID_HEADER).

Result Code: E_FAIL (0x80004005)
Component: MediumWrap
Interface: IMedium {4afe423b-43e0-e9d0-82e8-ceb307940dda}

 

 

VBoxError

 

Environment:

Host: Windows 10 64 bit

Guest: Ubuntu 32 bit

VM Tool: Oracle Virtual Box 5.0.8

 

Fix:

Take back up of corrupted VDI as we are going to edit it.

Downloaded “Free Hex Editor Neo 6.20” using which VDIs could be edited.

Opened two VDIs using Hex Editor:

  1. Corrupted
  2. Working (This also had Ubuntu 32 bit version, do not know if it would work if not this)

 

HexEdi-2

 

From Original VDI, copy data until you see all dots there after.

For me it was 465 bytes, displayed in in Right Side “Information” pane.

HexEdi-3

 

Then go to corrupted VDI, go to start of the data & paste & save.

 

HexEdi-4

 

If this VDI name is still same as configured in VM and still present at the same position then it should work.

 

But i tried creating new VM using corrupted->fixed VDI and ran into the another issue of UUID clash. Please find details below.

(Following screenshot & error are taken from internet, therefore will not match my environment details)

 

Error:

“Failed to open the hard disk E:\VirtualBox VMs\Windows 8 \Windows 8 Enterprise2.vhd.

Cannot register the hard disk ‘E:\VirtualBox VMs\Windows 8 \Windows 8 Enterprise2.vhd’{ca2bdc6a-a487-4e57-9fcd-509d0c31d86d} because a hard disk ‘E:\VirtualBox VMs\Windows 8 Enterprise\Windows 8 Enterprise2.vhd’ with UUID {ca2bdc6a-a487-4e57-9fcd-509d0c31d86d} already exists.

Result Code:
E_INVALIDARG (0x80070057)

Component:
VirtualBox

Interface:
IVirtualBox {3b2f08eb-b810-4715-bee0-bb06b9880ad2}

Callee RC:
VBOX_E_OBJECT_NOT_FOUND (0x80BB0001)”

 

HexEdi-5

 

 

Fix:

Reset the UUID of corrupted->fixed VDI

cd C:\Program Files\Oracle\VirtualBox\

VBOXMANAGE.EXE internalcommands sethduuid “pathtovhdfile”

HexEdi-6

Now try re-loading this VDI into existing VDI or try creating new VM using this.

It should work out. Good luck.

 

BCC Snapshot error

In the BCC Admin Console (open BCC home > Admin Console > MySiteName), you will be able to see the current state of deployments to that site.  A snapshot mismatch is easy to see – the deployment will be halted and the following error message will be displayed below:

“Cannot perform a incremental deployment on target,  Check for snapshots mismatched on agents.”
This occurs when something has interrupted the publishing process and the DeploymentTarget (on the target we’re trying to publish to) has failed to update it’s latest snapshot id.  The snapshot id allows the DeploymentTarget to know what version of content it has received which in turns means the publishing process can verify if a project has aleady been published. Each snapshot id is mapped to a target and a project in the BCC server’s database schema.

So enough background, time to follow the steps to resolve the problem!  Firstly, we need that snapshot id and ideally, the target id so we can confirm it’s the right one.  A wise man once showed me an effective cheat to get this simply and quickly.  The links to previous projects in the site admin screen we opened contain the ids of our projects.  Therefore, copy the link for the previously deployed project and search through the params until you spot the id of the project as below:

http://<your_host>:<bcc_port>/atg/bcc/process?paf_portalId=default&paf_communityId=100001&paf_pageId=100004&paf_dm=shared&paf_gear_id=1000006&paf_gm=content&projectView=1&project=prjXXXXX&processPortlet=200002

Now, open your DB and connect to the BCC schema and execute the following statement, inserting the project id at the appropriate spot:

select * from EPUB_PRJ_TG_SNSHT where PROJECT_ID = ‘<id>’;

You can now open the BCC dyn/admin page for the DeploymentServer component, located at the following path:

http://<your_host>:<bcc_port>/dyn/admin/nucleus/atg/epub/DeploymentServer

You should see one or more DeploymentTargets with various properties indicating their status. Below each one is an input field where you can type a snapshot id and click the “Init” button to force the snapshot.  Find the target that has a null in the snapshot field and use the form to input your snapshot id.  Assuming this works, you should now be able to return to the Production site page in the BCC Admin Console and Resume deployments.