I have a Scriptella etl file where I parse a csv file and also use a sample janino script. I always get an exception of driver not found for scriptella, although i have it in libs folder.
etl.xml
<!DOCTYPE etl SYSTEM "http://scriptella.javaforge.com/dtd/etl.dtd">
<etl>
<description>
Queries CSV data from from file and store the results in a DB and other CSV file.
</description>
<connection id="in" driver="csv" url="input.csv"/>
<connection id="out" driver="csv" url="output.csv">
#Use empty quote to turn off quoting
quote=
</connection>
<connection id="java" driver="janino" classpath="../lib/janino.jar"/>
<script connection-id="out"><!--Writing header if necessary-->
Name,Age,VIP
</script>
<query connection-id="in">
<!--Empty CSV query means select all-->
<script connection-id="java">
import java.io.*;
String ntteCode;
Object o = get("Age");
if (o == null)
ntteCode = "";
else
ntteCode = o.toString().trim();
system.out.println("-----------"+ntteCode);
</script>
</query>
</etl>
And here is the exception that I get when I run the etl.xml from command prompt.
E:\scriptella-1.0>java -jar scriptella.jar jstack_etl.xml
Apr 19, 2013 4:44:07 PM <INFO> Execution Progress.Initializing properties: 1%
Apr 19, 2013 4:44:07 PM <INFO> Execution Progress.Connection id=in, CsvConnection, Dialect{CSV 1.0} registered: 2%
Apr 19, 2013 4:44:07 PM <INFO> Execution Progress.Connection id=out, CsvConnection, Dialect{CSV 1.0} registered: 3%
Apr 19, 2013 4:44:07 PM <SEVERE> Script E:\scriptella-1.0\jstack_etl.xml execution failed.
Unable to initialize driver for ConnectionParameters{properties={}, url='null', user='null', password='null', schema='null', catalog='null'}
:Unable to instantiate driver for class scriptella.driver.janino.Driver
Janino provider exception: Janino not found on the class path. Check if connection classpath attribute points to janino.jar
Error codes: []
Driver exception: java.lang.ClassNotFoundException: org.codehaus.janino.ScriptEvaluator
You need to download the janino driver here:
http://dist.codehaus.org/janino/changelog.html
copy the following libraries to the scriptella/lib directory:
commons-compiler.jar
janino.jar
commons-compiler-jdk.jar
Try to start scriptella with the script in the bin directory:
scriptella.bat
scriptella.sh
This script will add the libraries to the classpath.
You can add the libraries also manually with this command:
java -classpath lib/commons-compiler.jar;lib/janino.jar;lib/commons-compiler-jdk.jar -jar scriptella.jar jstack_etl.xml
Related
I have exe file downloaded in the VM in specific folder, I am trying to install Adobe using Powershell dsc code.
Script is failing with below error during execution (Configuration is called through ARM template), however if I check inside the VM, adobe is installed.
Tried running the same script manually inside the VM. Not facing any error though.
[{"code":"VMExtensionProvisioningError","message":"VM has reported a failure when processing extension 'configureWindowsServer'. Error message: "DSC Configuration 'Adobe' completed with error(s). Following are the first few: PowerShell DSC resource MSFT_PackageResource failed to execute Set-TargetResource functionality with error message: The return code 1618 was not expected. Configuration is likely not correct The SendConfigurationApply function did not succeed."\r\n\r\nMore information on troubleshooting is available at https://aka.ms/VMExtensionDSCWindowsTroubleshoot "}]}
Configuration Adobe
{
$PackagesFolder = "C:\Packages\Adobe"
$AcrobatReader = #{
"Name" = "Adobe Acrobat Reader DC"
"ProductId" = "XXXXXX-XXXXX-XXXXXXX"
"Installer" = "AcroRdrDC.exe"
"FileHash" = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
"HashAlgorithm" = "SHA256"
"DestinationPath" = "$PackagesFolder\AdobeAcrobatReaderDC"
"Arguments" = "/msi EULA_ACCEPT=YES /qn"
}
Package AdobeAcrobatReaderDC {
Ensure = "Present"
Name = $AcrobatReader.Name
ProductId = $AcrobatReader.ProductId
Path = ("{0}\{1}" -f $AcrobatReader.DestinationPath, $AcrobatReader.Installer)
Arguments = $AcrobatReader.Arguments
}
}
I downloaded the MySQL JDBC driver to connect Scala to a MySQL database, but I cannot install it with java -jar mysql-connector-java-5.1.45-bin.jar. It says, no main manifest attribute, in mysql-connector-java-5.1.45-bin.jar
I cannot find any MANIFEST.MF file.
Any help would be appreciated.
EDIT: warnings after I run sbt run
[info] Loading project definition from /home/alessandro/Scala/tests/project
[info] Loading settings from build.sbt ...
[info] Set current project to MyProject (in build file:/home/alessandro/Scala/tests/)
[info] Running tests.ScalaJdbcConnectSelect
Sun Feb 18 21:51:33 CET 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'pmanager.user' doesn't exist
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
at com.mysql.jdbc.Util.getInstance(Util.java:408)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2480)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2438)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1381)
at tests.ScalaJdbcConnectSelect$.delayedEndpoint$tests$ScalaJdbcConnectSelect$1(ScalaJdbcConnectSelect.scala:16)
at tests.ScalaJdbcConnectSelect$delayedInit$body.apply(ScalaJdbcConnectSelect.scala:5)
at scala.Function0.apply$mcV$sp(Function0.scala:34)
at scala.Function0.apply$mcV$sp$(Function0.scala:34)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App.$anonfun$main$1$adapted(App.scala:76)
at scala.collection.immutable.List.foreach(List.scala:389)
at scala.App.main(App.scala:76)
at scala.App.main$(App.scala:74)
at tests.ScalaJdbcConnectSelect$.main(ScalaJdbcConnectSelect.scala:5)
at tests.ScalaJdbcConnectSelect.main(ScalaJdbcConnectSelect.scala)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at sbt.Run.invokeMain(Run.scala:93)
at sbt.Run.run0(Run.scala:87)
at sbt.Run.execute$1(Run.scala:65)
at sbt.Run.$anonfun$run$4(Run.scala:77)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at sbt.util.InterfaceUtil$$anon$1.get(InterfaceUtil.scala:10)
at sbt.TrapExit$App.run(TrapExit.scala:252)
at java.base/java.lang.Thread.run(Thread.java:844)
[success] Total time: 3 s, completed Feb 18, 2018, 9:51:34 PM
UPDATE:
I found two options:
The first
In your build.sbt replace line
libraryDependencies += "mysql" % "mysql-connector-java" % "5.1.24"
with this:
libraryDependencies ++= Seq(
"mysql" % "mysql-connector-java" % "5.1.16"
)
In command line:
sbt compile
sbt run
The second
Use this in command line:
set fullClasspath in Compile += Attributed.blank(file("path-to-your-connector-jar"))
sbt compile
sbt run
After that, the problem with the driver should disappear, but check the data to connect to the database.
BEFORE UPDATE:
In your project on Scala you also can use this:
package tests
import java.sql.{Connection,DriverManager}
object ScalaJdbcConnectSelect extends App {
// connect to the database named "mysql" on port 8889 of localhost
val url = "jdbc:mysql://localhost:8889/mysql"
val driver = "com.mysql.jdbc.Driver"
val username = "root"
val password = "root"
var connection:Connection = _
try {
Class.forName(driver)
connection = DriverManager.getConnection(url, username, password)
val statement = connection.createStatement
val rs = statement.executeQuery("SELECT host, user FROM user")
while (rs.next) {
val host = rs.getString("host")
val user = rs.getString("user")
println("host = %s, user = %s".format(host,user))
}
} catch {
case e: Exception => e.printStackTrace
}
connection.close
}
Link to source 1
Link to source 2
Please read this line:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'pmanager.user' doesn't exist
Check if there is such a table. If so, leave characters after the point (user).
In my current project using IBM Content Collector 4.0.1 SP5 with IBM Filenet P8 Content Engine 5.2.1 I need to collect files from file system and add them to a certain P8's object store.
This issue is related and comes after this one.
The WS response must conform to a custom metadata source called Esito which contains two metadata properties called resultCode and message.
The call seems correct but when getting the response I can read this message in the log and the file is not uploaded into P8 Content Manager:
2017-11-10T08:54:05.708Z FINEST [52] [ctms-native]
2017-11-10T08:54:05Z Trace2 0x15a4 Feeding JavaTask with 1 TaskInputs
ufibridge.dll:0x114ac [com.ibm.afu.ufibridge.logging.LoggingAdapter
log] [CTMS-task-15a4 45] 2017-11-10T08:54:05.708Z FINEST [53] Prepared
content to send to
webservice:{"e:\report\amm_000001_00001\2017\11\201711_amm_000001_00001_qxn_report_00.pdf":{"esito":"KO","fileName":"201711_AMM_000001_00001_QXN_REPORT_00(1)(2)(3).pdf"},"e:\report\amm_000001_00001\2017\11\201711_amm_000001_00001_qxn_report_00.xml":{"esito":"KO","fileName":"201711_AMM_000001_00001_QXN_REPORT_00(1)(2)(3).xml"}}
[com.ibm.afu.connector.webservice.task.InvokeServiceTask
getInputHttpEntity] [CTMS-task-15a4 45] 2017-11-10T08:54:05.708Z
FINEST [54] Configuration:
property name="message" type="STRING" displayName="message"
property name="resultCode" type="STRING" displayName="resultCode"
http://192.168.8.29:8080/sirfAcq/filenet/notificaArchiviazione
fileName esito
[com.ibm.afu.connector.webservice.task.InvokeServiceTask execute]
[CTMS-task-15a4 45] 2017-11-10T08:54:05.708Z FINEST [55] Invoking
webservice
URI:http://192.168.8.29:8080/sirfAcq/filenet/notificaArchiviazione
[com.ibm.afu.connector.webservice.task.InvokeServiceTask execute]
[CTMS-task-15a4 45] 2017-11-10T08:54:05.739Z FINEST [56] Invocation
took time (ms): 31
[com.ibm.afu.connector.webservice.task.InvokeServiceTask execute]
[CTMS-task-15a4 45] 2017-11-10T08:54:05.739Z SEVERE [57]
java.lang.String incompatible with com.ibm.json.java.JSONObject
[com.ibm.afu.connector.webservice.task.InvokeServiceTask execute]
[CTMS-task-15a4 45]Exception [java.lang.ClassCastException]:
java.lang.String incompatible with com.ibm.json.java.JSONObject
com.ibm.afu.connector.webservice.task.InvokeServiceTask.processResponse(InvokeServiceTask.java:140)
com.ibm.afu.connector.webservice.task.InvokeServiceTask.execute(InvokeServiceTask.java:112)
Could someone please explain me the correct format of the WS response JSON?
Could it be possible to use the One-Way mode instead of the Request-Response mode?
This issue seems to happen because of the incompatibility between the produce and the response body definition, based on the code snippet I had for your first post, your problem should be here:
produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE })
#ResponseBody
String notificaArchiviazione(#RequestParam("fileName") String fileName, #RequestParam("esito") String esito)
The first parameter in produce is sat as JSONMediaType.APPLICATION_JSON_VALUE while in the response body you expect a string #RequestParam("fileName") String fileName
Post upgrading ojdbc driver to ojdbc7, camel-sql component started creating issues when executed queries with named parameters.
Provided the simple SQL query which failed during the execution. Not all the queries are failing but only few of them.
SELECT some_id
FROM app_schema.app_store_table
WHERE store_id = :#storeId
AND source = :#source;
On Database side verified that the username has access to the object with app_schema and also tried creating a PUBLIC synonym, but no luck.
Based on my understanding, it fails while trying to get the parameter count in SqlProducer.java → process() → execute() → ps.getParameterMetaData()
jdbcTemplate.execute(statementCreator, new PreparedStatementCallback<Map<?, ?>>() {
public Map<?, ?> doInPreparedStatement(PreparedStatement ps) throws SQLException {
int expected = parametersCount > 0 ? parametersCount : ps.getParameterMetaData().getParameterCount();
...
Further debugging found the following error from ojdbc7 driver. It confirms that the ojdbc7 driver failed to parse the query correctly. In the below example, the "." ([DOT]) between schema_name and table_name is replaced by ojdbc driver before execution.
Aug 30, 2017 9:06:57 AM oracle.jdbc.driver.OracleConnection isValid
FINE: 19C71BE Exit [17.696372ms]
Aug 30, 2017 9:06:57 AM oracle.jdbc.driver.PhysicalConnection prepareStatement
FINE: 19C71BE Public Enter: "**SELECT some_id FROM app_schema.app_store_table WHERE store_id = ? and source = ?**"
Aug 30, 2017 9:06:57 AM oracle.jdbc.driver.PhysicalConnection prepareStatement
FINE: 19C71BE Return: oracle.jdbc.driver.OraclePreparedStatementWrapper#c2c269
Aug 30, 2017 9:06:57 AM oracle.jdbc.driver.PhysicalConnection prepareStatement
FINE: 19C71BE Exit [226.482362ms]
Aug 30, 2017 9:06:57 AM oracle.jdbc.driver.PhysicalConnection prepareStatement
FINE: 19C71BE Public Enter: "***SELECT store_id, source FROM app_schemaapp_store_table***" <-- .[DOT] between schema_name and table_name is replaced by the driver which results in this error.
Aug 30, 2017 9:06:57 AM oracle.jdbc.driver.PhysicalConnection prepareStatement
FINE: 19C71BE Return: oracle.jdbc.driver.OraclePreparedStatementWrapper#e1e592
Aug 30, 2017 9:06:57 AM oracle.jdbc.driver.PhysicalConnection prepareStatement
FINE: 19C71BE Exit [0.413825ms]
Aug 30, 2017 9:06:57 AM oracle.jdbc.driver.OraclePreparedStatement getMetaData
FINE: E1E592 Public Enter:
Aug 30, 2017 9:06:57 AM oracle.jdbc.driver.T4CTTIoer processError
SEVERE: CD5A42 Throwing SQLException: ORA-00942: table or view does not exist
This can be replicated easily using the following command
-- example for .[DOT] getting replaced between schema_name and table_name. Refer Parameter SQL.
C:\Users\xxxxxx\Desktop\ojdbc\oracle>java -cp ojdbc7_g-12.1.0.2.jar oracle.jdbc.driver.OracleParameterMetaDataParser "*SELECT some_id FROM app_schema.app_store_table WHERE store_id = ? and source = ?*"
SQL:SELECT some_id FROM app_schema.app_store_table WHERE store_id = :1 and source = :2
SqlKind:SELECT, Parameter Count=2
Parameter SQL: ***SELECT store_id, source FROM app_schemaapp_store_table***
-- example for invalid parsing of the query. Refer Parameter SQL.
C:\Users\vm\ojdbc\oracle>java -cp ojdbc7_g-12.1.0.2.jar oracle.jdbc.driver.OracleParameterMetaDataParser "*SELECT f_some_id FROM app_store_table WHERE f_store_id = ? and f_source = ?*"
SQL:SELECT f_some_id FROM app_store_table WHERE f_store_id = :1 and f_source = :2
SqlKind:SELECT, Parameter Count=2
Parameter SQL: ***SELECT f, f FROM app_store_table***
Exception:
Caused by: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:450)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:392)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:385)
at oracle.jdbc.driver.T4CTTIfun.processError(T4CTTIfun.java:1018)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:522)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:257)
at oracle.jdbc.driver.T4C8Odscrarr.doODNY(T4C8Odscrarr.java:96)
at oracle.jdbc.driver.T4CPreparedStatement.doDescribe(T4CPreparedStatement.java:717)
at oracle.jdbc.driver.OracleStatement.describe(OracleStatement.java:4404)
at oracle.jdbc.driver.OracleResultSetMetaData.<init>(OracleResultSetMetaData.java:52)
at oracle.jdbc.driver.OracleStatement.getResultSetMetaData(OracleStatement.java:4387)
at oracle.jdbc.driver.OraclePreparedStatement.getMetaData(OraclePreparedStatement.java:5581)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.getMetaData(OraclePreparedStatementWrapper.java:1509)
at oracle.jdbc.driver.OracleParameterMetaData.getParameterMetaData(OracleParameterMetaData.java:70)
at oracle.jdbc.driver.OraclePreparedStatement.getParameterMetaData(OraclePreparedStatement.java:12861)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.getParameterMetaData(OraclePreparedStatementWrapper.java:1551)
at org.apache.commons.dbcp2.DelegatingPreparedStatement.getParameterMetaData(DelegatingPreparedStatement.java:266)
at org.apache.commons.dbcp2.DelegatingPreparedStatement.getParameterMetaData(DelegatingPreparedStatement.java:266)
at org.apache.camel.component.sql.SqlProducer$2.doInPreparedStatement(SqlProducer.java:92)
at org.apache.camel.component.sql.SqlProducer$2.doInPreparedStatement(SqlProducer.java:90)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:589)
... 29 more
The same component worked well with ojdbc6.
Environment Details:
-Camel : 2.15.1.redhat-621166
-Fuse : 6.2.1
-OJDBC : ojdbc7 (12.1.0.2)
Additonal Dependecies.
-commons-dbcp2 (2.1.1)
-commons-pool2 (2.4.2)
-spring-jdbc (3.2.12.RELEASE)
enter code hereHi I'm using Entity manager(EJB) which internally depends on hibernate to get Object.
My query is ........
TypedQuery<FraudDetectionInfoEntity> queryKount = em_oltp.createQuery("SELECT o FROM FraudDetectionInfoEntity o WHERE o.order.orderId=:orderId",FraudDetectionInfoEntity.class);
query.setParameter("orderId", orderEntity.getOrderId());
FraudDetectionInfoEntity infoEntity=queryKount.getSingleResult();
I'm getting folowing error If I run that query.
org.hibernate.QueryParameterException: could not locate named parameter [orderId]
org.hibernate.QueryParameterException: could not locate named parameter [orderId]
12:46:58,639 ERROR [com.vip.enterprise.admin.web.controller.OrderPlacementController] (http-/127.0.0.1:8084-6) error com.vip.enterprise.service.exception.ServiceException: org.hibernate.QueryParameterException: could not locate named parameter [orderId]
12:47:00,001 ERROR [com.vip.enterprise.service.jobs.ReplenishmentJob] (EJB default - 4) Replenish Orders JOB : Mon Jan 27 12:47:00 IST 2014
Your code is ok. Missing variable query or queryKount?
TypedQuery<FraudDetectionInfoEntity> queryKount = em_oltp.createQuery("SELECT o FROM FraudDetectionInfoEntity o WHERE o.order.orderId=:orderId",FraudDetectionInfoEntity.class);
query.setParameter("orderId", orderEntity.getOrderId());
<or>
queryKount.setParameter("orderId", orderEntity.getOrderId());