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/
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.
J2EE
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>
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
To apply session into atg app, we need to create pipeline servlet component using one of the following:
- projects.b2bstore.servlet. WACheckSessionExpiration
- 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.
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.
We had the requirement to append Order ID for each logging statement. This is how we achieved that.
Create Component:
\atg\dynamo\service\logging\LogQueue.properties
$class=atg.nucleus.logging.CustomLogListenerQueue
logListeners=LogDispatch
customLogging=true
Path of property file should not be changed.
CustomLogListenerQueue.java
package atg.nucleus.logging;
import atg.commerce.order.OrderHolder;
import atg.core.util.StringUtils;
import atg.nucleus.logging.LogEvent;
import atg.nucleus.logging.LogListenerQueue;
import atg.servlet.ServletUtil;
public class CustomLogListenerQueue extends LogListenerQueue {
private boolean mCustomLogging;
private static String ORDER_PATH = “/atg/commerce/ShoppingCart”;
/**
* @return the customLogging
*/
public boolean isCustomLogging() {
return mCustomLogging;
}
/**
* @param pCustomLogging
* the customLogging to set
*/
public void setCustomLogging(boolean pCustomLogging) {
mCustomLogging = pCustomLogging;
}
/* (non-Javadoc)
* @see atg.nucleus.logging.LogListenerQueue#logEvent(atg.nucleus.logging.LogEvent)
* Following would append order id in front of all log messages
*/
@Override
public synchronized void logEvent(LogEvent pArg0) {
if (isCustomLogging()) {
String lCustomLogMessage = “”;
if (null != pArg0 && !StringUtils.isBlank(pArg0.mMessage) && null != ServletUtil.getCurrentRequest()) {
OrderHolder lOrderHolder = (OrderHolder) ServletUtil.getCurrentRequest().resolveName(ORDER_PATH);
if (null != lOrderHolder && null != lOrderHolder.getCurrent(Boolean.FALSE)) {
lCustomLogMessage = “OrderID: ” + lOrderHolder.getCurrent().getId() + ” “;
}
pArg0.mMessage = lCustomLogMessage + pArg0.mMessage;
}
}
super.logEvent(pArg0);
}
}
Parent JSP:
<dsp:include page=”/common/getTaxedPrice.jsp”>
<dsp:param name=”freePrice” value=”${paymentCost}”/>
</dsp:include>
Child JSP:
Read passed value:
<dsp:getvalueof param=”freePrice” var=”freePrice”/>
Pass value to parent JSP:
Option 1 – DSP TAGS:
<dsp:getvalueof param=”intergerlVal” var=”integerValue” scope=”request” />
<dsp:getvalueof param=”decimalVal” var=”decimalValue” scope=”request”/>
Option 2 – JSTL:
<c:set var=”integerValue” scope=”request” value=”integerValue”></c:set>
<c:set var=”decimalValue” scope=”request” value=”decimalValue”></c:set>
Parent JSP:
Variables can be printed or used as:
${integerValue}
${decimalValue}
Problem:
Java file has line numbers like following:
Tools:
Notepad++
Steps:
- Paste your complete content into Notepad++
- Ctrl+F to open find box.
- Select “Regular expression” radio button
- Enter this expression to search for line number with comments (.*)[1-9](.*)(/)
- Replace you can keep blank to replace it with nothing. Which means deleting it.
- Click “Replace All” button.
Resolution:
I created new reverse engineering XML “hibernateII.reveng.xml” from Hibernate tool plugin in STS eclipse, and it resolved the problem.
Though i had also tried changing content of existing file, but that did not work out and content of old and new files were same, weird, but new file solved the issue.
Example 1:
If you want to search for all <script…. > tags which do not have “src” attribute. Use following regex.
<script(?!.*src).*$
Example 2:
If you want to search for all <dsp:form …> tags which do not have “formid” attribute, use following.
<dsp:form(?!.*formid).*$
Note: Do not forget to check regex box.
Option 1: Copy jar in local repo
Under dependencies section, add following block.
<dependency>
<!– groupId – 0 level directory name = you may give any name –>
<groupId>custom</groupId>
<!– artifactId- 1 level sub directory name = should be name of the jar without version number –>
<artifactId>simplecaptcha</artifactId>
<!– version- 2 level sub directory name = jar version mentioned in jar file name –>
<version>1.2.1</version>
</dependency>
Under C:\Users\<username>\.m2\repository
- Create directory with name as value you have given in <groupId></groupId>
-
- Go into this directory
-
- Create directory with name as value you have given in <artifactId></artifactId>
-
- Go into this directory
- Create directory with name as value you have given in <version></version>
-
- Copy your jar here
Example:
My file is stored here:
C:\Users\<username>\.m2\repository\custom\simplecaptcha\1.2.1\simplecaptcha-1.2.1.jar
Option 2: Use system scope
Example:
<!– Hibernate –>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.6.Final</version>
<scope>system</scope>
<systemPath>G:/Setups/hibernate-release-4.3.6.Final/hibernate-release-4.3.6.Final/lib/required/hibernate-core-4.3.6.Final.jar</systemPath>
</dependency>