Hello,
Sometimes, the execution of a job/method Documentum via Java Method Server (JMS) can generate a Core dump error for various reasons : content file protected, document corrupted, …etc…especially when using IRM protection which produces the stopping of DCTM job.
Here, an example of error:
1 | EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000000111b9d09, pid=3684, tid=7584 |
3 | # JRE version: 7.0_17-b02 |
4 | # Java VM: Java HotSpot(TM) 64-Bit Server VM (23.7-b01 mixed mode windows-amd64 compressed oops) |
6 | # C [libemcdctmirm.dll+0x1f9d09] PVS_TemplateListFree+0x7069 |
8 | # Core dump written. Default location: D:\App\Workspaces\....\hs_err_pid3684.mdmp |
So, I will try to expose a simple solution in order to avoid the stopping of JMS by by-passing the use of JMS:
DCTM JOB => DCTM METHOD => Script BATCH CMD => Script POWERSHELL => JAVA DFC/JVM
- Creation of a DCTM job My_Method_PowershellScript :
In Documentum Administrator, in the section Administration/Job Management/Methods, create a method My_Method_PowershellScript:
01 | ***** in tab "Method Info" |
02 | * Name = My_Method_PowershellScript |
03 | * Verb = D:\App\MyFolder4DCTM\My_ScriptProcess.cmd |
04 | * Method Type = program |
06 | * Timeout Default = 172800 |
07 | * Timeout Maximum = 345600 |
08 | * Launch Direct = [X] Use the exec call to execute the procedure |
09 | * Launch Asynchronously = [X] Launch as a separate process |
10 | * Run As Owner = [X] Run as the installation owner |
- Creation of a DCTM method My_Job_BatchScript :
In Documentum Administrator, in the section Administration/Job Management/Jobs, create a method My_Job_BatchScript:
02 | * Name = My_Job_BatchScript |
03 | * Trace Level = 0 (no trace) |
04 | * Designated Server = Any Running Server |
08 | * Method Name = My_Method_PowershellScript |
10 | ***** in tab "SysObject Info" |
11 | * Title = My_Job_BatchScript |
- Creation of folder containing the scripts and librairies D:\App\MyFolder4DCTM on DCTM server
- Creation of BATCH CMD script My_ScriptProcess.cmd in the folder D:\App\MyFolder4DCTM calling the POWERSHELL script:
04 | IF "%~1" == "" GOTO endparse |
05 | if "%DOCUMENTIDS%" == "" ( |
06 | SET DOCUMENTIDS=-DocumentIds %~1 |
08 | SET DOCUMENTIDS=%DOCUMENTIDS%,%~1 |
15 | CD "D:\App\MyFolder4DCTM" |
18 | SET CurrentDirectory=%CD% |
19 | SET JavaHome=D:\Documentum\java64\1.7.0_17 |
20 | SET DctmDirectory=D:\Documentum |
21 | SET DctmConfigDirectory=%DctmDirectory%\config |
22 | SET DctmIrmDirectory=%DctmDirectory%\irm |
24 | powershell .\My_ScriptProcess.ps1 "%DOCUMENTIDS%" -DctmEnv ALL -CurrentDirectory "%CurrentDirectory%" -JavaHome "%JavaHome%" -DctmConfigDirectory "%DctmConfigDirectory%" -DctmIrmDirectory "%DctmIrmDirectory%" |
- Creation of POWERSHELL script My_ScriptProcess.ps1 in the folder D:\App\MyFolder4DCTM calling the JAVA com.java.lu.business.service.ecm.utils.main.CreateListToProcess:
002 | [Int32[]] $DocumentIds, |
003 | [String] $CurrentDirectory, |
005 | [String] $DctmConfigDirectory, |
006 | [String] $DctmIrmDirectory, |
013 | [String] $DocumentIds, |
014 | [String] $CurrentDirectory, |
016 | [String] $DctmConfigDirectory, |
017 | [String] $DctmIrmDirectory, |
019 | [String] $IdsToProcessFile |
022 | Write-Host "Calling CreateIdList with parameters:" |
023 | Write-Host " * DocumentIds: $DocumentIds" |
024 | Write-Host " * CurrentDirectory: $CurrentDirectory" |
025 | Write-Host " * JavaHome: $JavaHome" |
026 | Write-Host " * DctmConfigDirectory: $DctmConfigDirectory" |
027 | Write-Host " * DctmIrmDirectory: $DctmIrmDirectory" |
028 | Write-Host " * DctmEnv: $DctmEnv" |
029 | Write-Host " * IdsToProcessFile: $IdsToProcessFile" |
031 | $ClassPath = $DctmConfigDirectory; |
033 | foreach($Jar IN Get-ChildItem "$CurrentDirectory\dfc" -filter "*.jar" - Name ){ |
034 | $ClassPath += ";$CurrentDirectory\dfc\$Jar" |
037 | foreach($Jar IN Get-ChildItem "$CurrentDirectory\lib" -filter "*.jar" - Name ){ |
038 | $ClassPath += ";$CurrentDirectory\lib\$Jar" |
041 | $ClassPath += ";$DctmIrmDirectory\emcdctmirm.jar" |
042 | $ClassPath += ";$CurrentDirectory\IRMisationDocs4ArchivedDeliverable.jar" |
044 | $JavaLibraryPath = "$DctmIrmDirectory" |
045 | $JavaLibraryPath += ";$DctmIrmDirectory\Common" |
046 | $JavaLibraryPath += ";$env:path" |
047 | $JavaLibraryPath = $JavaLibraryPath - replace "\\" , "/" |
049 | $pInfo = New-Object System.Diagnostics.ProcessStartInfo |
050 | $pInfo.FileName = "$JavaHome\bin\java.exe" |
052 | $LogFile = "$CurrentDirectory\log\My_ScriptProcess_log_$((Get-Date).ToString(" yyyyMMdd_HHmmss ")).log" |
054 | # "-Xrunjdwp:transport=dt_socket,address=9797,server=y,suspend=y" , |
058 | "-Doracle.net.tns_admin=" "$env:TNS_ADMIN" "" , |
059 | "-Djava.library.path=" "$JavaLibraryPath" "" , |
060 | "-cp" , "" "$ClassPath" "" , |
061 | "com.java.lu.business.service.ecm.utils.main.CreateListToProcess" , |
064 | "" "$IdsToProcessFile" "" , |
067 | $p = New-Object System.Diagnostics.Process |
074 | Write-Host "Content of $($IdsToProcessFile):" |
075 | Get-Content -Path $IdsToProcessFile | Foreach-Object { Write-Host $_ } |
076 | Write-Host "End of Content" |
079 | function LaunchSensitiveProcess |
083 | [String] $CurrentDirectory, |
085 | [String] $DctmConfigDirectory, |
086 | [String] $DctmIrmDirectory, |
100 | [Int32[]] $DocumentIds, |
101 | [String] $CurrentDirectory, |
103 | [String] $DctmConfigDirectory, |
104 | [String] $DctmIrmDirectory, |
107 | $DocumentIdsToProcess=$DocumentIds - join ',' |
109 | $IdsToProcessFile = "$CurrentDirectory\My_ScriptProcess_$((Get-Date).ToString(" yyyyMMdd_HHmmss ")).txt" |
111 | CreateIdList -DocumentIds $DocumentIdsToProcess -CurrentDirectory $CurrentDirectory -JavaHome $JavaHome -DctmConfigDirectory $DctmConfigDirectory -DctmIrmDirectory $DctmIrmDirectory -DctmEnv $DctmEnv -IdsToProcessFile $IdsToProcessFile |
113 | foreach ($IdsToProcess in Get-Content -Path $IdsToProcessFile) { |
114 | LaunchSensitiveProcess -ObjectIds $IdsToProcess -CurrentDirectory $CurrentDirectory -JavaHome $JavaHome -DctmConfigDirectory $DctmConfigDirectory -DctmIrmDirectory $DctmIrmDirectory -DctmEnv $DctmEnv |
117 | #Remove-Item -Path $IdsToProcessFile |
120 | $MaxNbOfDocumentIds = 150 |
122 | if ($DocumentIds. Count -gt $MaxNbOfDocumentIds){ |
123 | while($DocumentIds. Count -gt 0){ |
124 | $NewDocumentIds = New-Object System.Collections.ArrayList |
125 | while(($NewDocumentIds. Count -le $MaxNbOfDocumentIds) - and ($DocumentIds. Count -gt 0)){ |
126 | $DocumentId = $DocumentIds[0] |
127 | if ($DocumentIds. Count -gt 1){ |
128 | $DocumentIds = $DocumentIds[1..($DocumentIds. Count -1)] |
132 | $NewDocumentIds. Add ($DocumentId) > $ null |
135 | MyProcess -DocumentIds $NewDocumentIds -CurrentDirectory $CurrentDirectory -JavaHome $JavaHome -DctmConfigDirectory $DctmConfigDirectory -DctmIrmDirectory $DctmIrmDirectory -DctmEnv $DctmEnv |
138 | MyProcess -DocumentIds $DocumentIds -CurrentDirectory $CurrentDirectory -JavaHome $JavaHome -DctmConfigDirectory $DctmConfigDirectory -DctmIrmDirectory $DctmIrmDirectory -DctmEnv $DctmEnv |
- Creation of java class com.java.lu.business.service.ecm.utils.main.CreateListToProcess:
001 | package com.java.lu.business.service.ecm.utils.main; |
004 | import java.io.PrintWriter; |
005 | import java.text.MessageFormat; |
006 | import java.util.ArrayList; |
007 | import java.util.HashSet; |
008 | import java.util.List; |
009 | import java.util.Properties; |
012 | import javax.naming.spi.NamingManager; |
013 | import javax.sql.DataSource; |
015 | import org.apache.commons.configuration.PropertiesConfiguration; |
016 | import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy; |
017 | import org.apache.commons.lang.StringUtils; |
019 | import com.documentum.com.DfClientX; |
020 | import com.documentum.com.IDfClientX; |
021 | import com.documentum.fc.client.DfQuery; |
022 | import com.documentum.fc.client.IDfClient; |
023 | import com.documentum.fc.client.IDfCollection; |
024 | import com.documentum.fc.client.IDfQuery; |
025 | import com.documentum.fc.client.IDfSession; |
026 | import com.documentum.fc.client.IDfSessionManager; |
027 | import com.documentum.fc.client.IDfUser; |
028 | import com.documentum.fc.common.DfException; |
029 | import com.documentum.fc.common.DfLoginInfo; |
030 | import com.documentum.fc.common.IDfId; |
032 | public class CreateListToProcess { |
033 | public static void main(String[] args) { |
035 | String myRepository = "MY_DOCBASE" ; |
036 | String adminLogin = "adminuser" ; |
037 | String adminPassword = "pwd4adminuser" ; |
039 | IDfClientX clientx = new DfClientX(); |
040 | IDfClient client = clientx.getLocalClient(); |
041 | final IDfSessionManager sMgr = client.newSessionManager(); |
042 | sMgr.setIdentity(IDfSessionManager.ALL_DOCBASES, new DfLoginInfo(adminLogin, adminPassword)); |
043 | IDfSession dfSession = sMgr.getSession(myRepository); |
046 | if (dfSession.getUser( null ).getUserPrivileges() != IDfUser.DF_PRIVILEGE_SUPERUSER) { |
047 | throw new DfException(MessageFormat.format( "{0} is not a superuser." , dfSession.getUser( null ).getUserName())); |
050 | PrintWriter printWriterLog = new PrintWriter( new File(args[ 1 ])) { |
052 | public void println(String x) { |
055 | System.out.println(x); |
059 | HashSet<String> docsIdsSet = new HashSet<String>(); |
060 | File fileToCreate = null ; |
062 | for ( int i = 2 ; i < args.length; i++) { |
064 | fileToCreate = new File(args[i]); |
066 | docsIdsSet.add(args[i]); |
072 | PrintWriter printWriterIdsFile = new PrintWriter(fileToCreate); |
074 | final int lineSize = 100 ; |
076 | IDfCollection dfCollection = getDocumentIdsToProcess(dfSession); |
078 | List<String> list = new ArrayList<String>(); |
079 | while (dfCollection.next()) { |
081 | IDfId dfId = dfCollection.getId( "r_object_id" ); |
082 | list.add(dfId.getId()); |
083 | if (list.size() == lineSize) { |
084 | printWriterIdsFile.println(StringUtils.join(list, ',' )); |
085 | printWriterIdsFile.flush(); |
089 | if (list.size() > 0 ) { |
090 | printWriterIdsFile.println(StringUtils.join(list, ',' )); |
091 | printWriterIdsFile.flush(); |
099 | printWriterLog.write(MessageFormat.format( "There {0,choice,0#are no documents|1#is one document|1<are {0,number,integer} documents} to process." , cpt)); |
100 | printWriterLog.close(); |
104 | sMgr.release(dfSession); |
106 | } catch (Throwable e) { |
112 | * Get the documents for the scope's current execution |
117 | public static IDfCollection getDocumentIdsToProcess(IDfSession session) throws Throwable { |
118 | IDfCollection collection = null ; |
120 | StringBuilder sb = new StringBuilder(); |
121 | sb.append( " SELECT DISTINCT docsall.r_object_id FROM my_document (ALL) docsall WHERE docsall.i_chronicle_id " ); |
122 | sb.append( " IN ( SELECT docs.i_chronicle_id from my_document docs " ); |
123 | sb.append( " WHERE ANY docs.r_aspect_name = 'my_aspect' and docs.my_aspect.is_ok=1 " ); |
124 | sb.append( " AND docs.r_content_size>0 " ); |
128 | System.out.println(MessageFormat.format( "Building and execution of query: {0}" , sb.toString())); |
129 | IDfQuery dfQuery = new DfQuery(sb.toString()); |
130 | collection = dfQuery.execute(session, IDfQuery.DF_READ_QUERY); |
- So, on the DCTM server, in the folder D:\App\MyFolder4DCTM, there will be:
o My_ScriptProcess.cmd
o My_ScriptProcess.ps1
o MyJavaLuLib.jar : containing all needed classes
o \lib : commons-collections-3.2.jar + commons-configuration-1.5.jar + commons-io-1.2.jar + commons-logging-1.1.1.jar + ojdbc6.jar + commons-csv-1.1.jar …etc.
o \dfc : all JARs and DLLs of DFC (dfc.jar,Dfc.dll, …etc).
o \log : log files
Just a last point, in the POWERSHELL script the below command allows debugging of remote server execution from local IDE (Composer) via the port 9797:
“-Xrunjdwp:transport=dt_socket,address=9797,server=y,suspend=y”
however, if this instruction is uncommented, the execution is put on hold until the launch of the IDE on the port.
Best regards,
Huseyin OZVEREN
Related