In Workbench for AEM Forms 6.4, in an executeScript activity, I have been getting some odd errors with my code. It is telling me that there are missing methods and classes that should be there. This code works fine outside of the executeScript activity (in Eclipse running the same java version). I even checked in the jar of the Microsoft sql and can see the class file in the server class path/modules folder. I have found other ways around these errors, but I would prefer to use the "missing" classes. I am not sure what I am doing wrong with this. Does anyone have any suggestions?
[org.jboss.as.ejb3.invocation] (default-threads - 29) WFLYEJB0034: EJB Invocation failed on component EjbTransactionCMTAdapter for method public abstract java.lang.Object com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterLocal.doRequired(com.adobe.idp.dsc.transaction.TransactionDefinition,com.adobe.idp.dsc.transaction.TransactionCallback) throws com.adobe.idp.dsc.DSCException: javax.ejb.EJBTransactionRolledbackException: Sourced file: inline evaluation of: ``import java.io.File; import java.io.IOException; import java.nio.file.Files; imp . . . '' : Error in method invocation: Static method readAttributes( sun.nio.fs.WindowsPath, java.lang.Class ) not found in class'java.nio.file.Files' : at Line: 274 : in file: inline evaluation of: ``import java.io.File; import java.io.IOException; import java.nio.file.Files; imp . . . '' : Files .readAttributes ( f .toPath ( ) , BasicFileAttributes .class )
[org.jboss.as.ejb3.invocation] (default-threads - 33) WFLYEJB0034: EJB Invocation failed on component EjbTransactionCMTAdapter for method public abstract java.lang.Object com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterLocal.doRequired(com.adobe.idp.dsc.transaction.TransactionDefinition,com.adobe.idp.dsc.transaction.TransactionCallback) throws com.adobe.idp.dsc.DSCException: javax.ejb.EJBTransactionRolledbackException: Sourced file: inline evaluation of: ``import javax.naming.InitialContext; import javax.sql.DataSource; import java.s . . . '' : Class: com.microsoft.sqlserver.jdbc.SQLServerException not found in namespace : at Line: 93 : in file: inline evaluation of: ``import javax.naming.InitialContext; import javax.sql.DataSource; import java.s . . . '' : com .microsoft .sqlserver .jdbc .SQLServerException
Solved! Go to Solution.
Views
Replies
Total Likes
The script generates some values to pass along to a stored procedure, and collects the output for use later on in the process. We are not using the OOTB JDBC stored procedure activity because the multiple possible values for sp inputs would have made the process too large to debug (the process recorder can only record so many activities). The script has been running with no issues in our ES4 production environment for almost a decade, so I don't think the script is the issue.
I expect an exception (and get one) if one of my sp parameters is incorrect. I generate the error above when the exception is caught. If I change the code to import com.microsoft.sqlserver.jdbc.SQLServerException; and only catch SQLServerException, I still get the same error.
Here is the script, with the non-stored procedure logic stripped out.
import javax.naming.InitialContext;
import javax.sql.DataSource;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.*;
PreparedStatement stmt = null;
Connection conn = null;
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:/FIN_DS");
//logic to set up sp input parameters goes here
conn = ds.getConnection();
try
{
stmt = conn.prepareCall("{call TransacTable_Insert(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
//set the sp input/output parameters here
stmt.execute();
//collect output here
}
catch(com.microsoft.sqlserver.jdbc.SQLServerException e)
{
patExecContext.setProcessDataStringValue("/process_data/@exceptionText", e,getMessage());
return;
}
//write results to process variables
Views
Replies
Total Likes
Are you querying using javax.sql.DataSource ? You may use SQL related operations available on OOTB JDBC category. It appears to be issue with the script. Make sure you import the required classes. Share your sample script here if possible
Thanks,
Wasil
Views
Replies
Total Likes
The script generates some values to pass along to a stored procedure, and collects the output for use later on in the process. We are not using the OOTB JDBC stored procedure activity because the multiple possible values for sp inputs would have made the process too large to debug (the process recorder can only record so many activities). The script has been running with no issues in our ES4 production environment for almost a decade, so I don't think the script is the issue.
I expect an exception (and get one) if one of my sp parameters is incorrect. I generate the error above when the exception is caught. If I change the code to import com.microsoft.sqlserver.jdbc.SQLServerException; and only catch SQLServerException, I still get the same error.
Here is the script, with the non-stored procedure logic stripped out.
import javax.naming.InitialContext;
import javax.sql.DataSource;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.*;
PreparedStatement stmt = null;
Connection conn = null;
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:/FIN_DS");
//logic to set up sp input parameters goes here
conn = ds.getConnection();
try
{
stmt = conn.prepareCall("{call TransacTable_Insert(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
//set the sp input/output parameters here
stmt.execute();
//collect output here
}
catch(com.microsoft.sqlserver.jdbc.SQLServerException e)
{
patExecContext.setProcessDataStringValue("/process_data/@exceptionText", e,getMessage());
return;
}
//write results to process variables
Views
Replies
Total Likes