I´ve a quartz-config file and I want to load my cron expression from my property file, here is the code:
<?xml version='1.0' encoding='utf-8'?>
<job-scheduling-data version="1.8"
xmlns="http://www.quartz-scheduler.org/xml/JobSchedulingData"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.quartz-scheduler.org/xml/JobSchedulingData http://www.quartz-scheduler.org/xml/job_scheduling_data_1_8.xsd">
<properties>
<property url="file:///C:/apps/Labels/resources/ftp.properties"></property>
</properties>
<schedule>
<job>
<name>DevolucionesShippingJob</name>
<group>DevolucionesShippingJob</group>
<description>Retrieve FTP jobs procesed files from BIDS</description>
<job-class>com.quartz.DevolucionesShippingJob</job-class>
</job>
<trigger>
<cron>
<name>DevolucionesShippingTrigger</name>
<group>DEFAULT</group>
<job-name>DevolucionesShippingJob</job-name>
<job-group>DevolucionesShippingJob</job-group>
<cron-expression>0 07 19 * * ?</cron-expression>
</cron>
</trigger>
</schedule>
</job-scheduling-data>
The problem is that the eclipse parse marks an error in the line that has
How can I import a property file into my xml?
Thanks in advance.
It has been a while since I used Quartz but I do not recall seeing this done before. Also, if I'm looking at the referenced schema correctly, the properties element is not valid (hence Eclipse showing an error). In short, I don't think you can do this.
Related
I'm facing a problem using Liquibase with MySQL 8 where the following script is not putting the fraction part of type "time(3)", it only puts "time" on the type of the column. We run this script before with MySQL 5 and it worked fine.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.16.xsd"
logicalFilePath="20220901.xml">
<changeSet author="MyUser" id="Change column 'time' to Datatype to milliseconds">
<modifyDataType
columnName="time"
newDataType="TIME(3)"
schemaName="${defaultSchema}"
tableName="table1"/>
<addNotNullConstraint
columnDataType="TIME(3)"
columnName="time"
schemaName="${defaultSchema}"
tableName="table1" />
</changeSet>
</databaseChangeLog>
I tried to update to most recent versions on maven dependencies of liquibase.core(to 4.16.1) and mysql-connector-java(to 8.0.30), the problem persists.
After multiple tests, i discover that the problem may be on liquibase generated query that not includes the fraction part "(3)", so as a workaround I used "modifySql" to change the query at the end.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.16.xsd"
logicalFilePath="20220901.xml">
<!-- WORK-AROUND - Liquibase was generating a query with type 'TIME' instead of 'TIME(3)' so
we use 'REPLACE_WITH_TIME' as auxiliary type to replace all of it's occurrences in query
by 'TIME(3)' with 'modifySql'. -->
<changeSet author="MyUser"
id="Fix time column type to time(3) - 2022-10-06">
<modifyDataType columnName="time"
newDataType="REPLACE_WITH_TIME" schemaName="${defaultSchema}"
tableName="table1" />
<addNotNullConstraint columnDataType="REPLACE_WITH_TIME"
columnName="time" schemaName="${defaultSchema}"
tableName="table1" />
<modifySql>
<replace replace="REPLACE_WITH_TIME" with="TIME(3)" />
</modifySql>
</changeSet>
</databaseChangeLog>
It resolves the problem but its not the best solution.
So i wanted to ask if anybody noticed that and knows if its actally a liquibase bug or not.
Thanks in advance.
good evening.
I'm trying to create a project that uses:
Java
JSF 2.3
Maven
CDI 2.0
Hibernate
Wildfly server
My intention here is to learn the basics of all these fellas.
At first I followed an awesome [tutorial by #BalusC][1] that tought me how to set up and first run the webapp.
My problem now rests on integrating the database with the application. I followed some guides and searched a bit on internet and found that a way to do it is by editing web.xml and persistence.xml. (I tried to keep it as close to hist tutorial as possible).
Here are my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0" metadata-complete="true">
<display-name>project</display-name>
... (some params)
<data-source>
<name>java:global/projectDS</name>
<class-name>org.postgresql.ds.PGConnectionPoolDataSource</class-name>
<url>jdbc:postgresql://localhost:5432/project</url>
</data-source>
... (servlet info)
</web-app>
And my persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd"
version="2.2">
<persistence-unit name="projectPU"
transaction-type="JTA">
<jta-data-source>java:global/projectDS</jta-data-source>
<class>project.entity.Message</class>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.PostgreSQL95Dialect" />
<property name="hibernate.default_schema" value="main" />
<property name="hibernate.hbm2ddl.auto" value="create" />
<property name="javax.persistence.jdbc.driver"
value="org.postgresql.Driver" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
</properties>
</persistence-unit>
</persistence>
When I run the web app I receive the following error:
Caused by: org.jboss.as.controller.OperationFailedException: WFLYJCA0117: org.postgresql.ds.PGConnectionPoolDataSource is not a valid javax.sql.DataSource implementation [ "WFLYJCA0117: org.postgresql.ds.PGConnectionPoolDataSource is not a valid javax.sql.DataSource implementation" ]
I'd like to know if any of you know what I'm doing wrong and how can I work it out.
P.S.: I read on WildFly's page that WildFly has it's own Hibernate "version", and some foruns said that there might be some issues while working with an "external" hibernate source. However, as my Hibernate configuration has nothing linked to any of Wildfly's config (i believe so), I guess that's not the problem.
Thanks in advance.
UPDATE #1
I tried solution #2 from link #TacheDeChoco sent. At first it worker, but I got another error that I'm still trying to solve. I'll try I little bit more and will come here If a more complete feedback.
Ansewring your questions: by the time I first asked, I hadn't done any of the things you asked.
TY very much.
Did you
register a new postgres module (with the appropriate jar) in Wildfly ?
Declare the datasource, along with the used driver, in wildfly config file (standalone-***.xml) ?
Nice explanations can be found here (see option#2):
https://www.stenusys.com/how_to_setup_postgresql_datasource_with_wildfly/
I build a function that create JUnit report format xml that Jenkins can read.
my problem is that when I report 2 or more failures \ errors, Jenkins shows just the first on.
Also I tried to gather all error to one detailed error but jenkins show it not clear.
my xml looks like:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<testsuite errors="0" failures="2" hostName="name" name="Reporter" tests="1" time="202.053" timeStamp="Sun Jul 15 07:38:13 UTC 2018">
<testcase classname="bla" name="fail1" time="105.704">
<failure message="failure1" type="">trace...</failure>
<failure message="failure2" type="">trace2...</failure>
</testcase>
</testsuite>
jenkins shows he first only.
On other side if I put all failures in one node looks like this (I build it):
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><testsuite errors="0" failures="2" hostName="name" name="Reporter" tests="1" time="202.053" timeStamp="Sun Jul 15 07:38:13 UTC 2018">
<testcase classname="bla" name="fail1" time="105.704">
<failure message=
"failure1
failure2
failure3
...
.."
type="">trace...</failure>
</testcase>
</testsuite>
all failures shown in on line without new line char.
can someone assist if there is a way to do it correctly?
Thanks,
Hezi
I'm trying to setup a Quartz Scheduler job using an XML file, the scheduler object is reading the .properties file and finds the XML job definition file.
however I am getting a parsing validation exception and I can't seem to be able to find what's wrong based on the error
11:14:12.314 [localhost-startStop-1] ERROR o.q.p.x.XMLSchedulingDataProcessorPlugin - Error scheduling jobs: Encountered 2 validation exceptions.
org.quartz.xml.ValidationException: Encountered 2 validation exceptions.
and then
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'group'. One of '{"http://www.quartz-scheduler.org/xml/JobSchedulingData":durability, "http://www.quartz-scheduler.org/xml/JobSchedulingData":job-data-map}' is expected.
I have already defined <durability> and the job doesn't require a data map.
My XML is
<?xml version="1.0" encoding="UTF-8"?>
<job-scheduling-data
xmlns="http://www.quartz-scheduler.org/xml/JobSchedulingData"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.quartz-scheduler.org/xml/JobSchedulingData
http://www.quartz-scheduler.org/xml/job_scheduling_data_1_8.xsd"
version="1.8">
<schedule>
<job>
<name>MailJob</name>
<description>Mail dispatcher job</description>
<job-class>com.myapplication.reporting.MailJob</job-class>
<group>MailGroup</group>
<durability>false</durability>
</job>
<trigger>
<simple>
<name>MailTrigger</name>
<description>Mail dispatcher job trigger, this should be set to run every 1 minute</description>
<repeat-interval>60000</repeat-interval>
<group>MailTriggerGroup</group>
<job-name>MailJob</job-name>
<job-group>mailGroup</job-group>
</simple>
</trigger>
</schedule>
</job-scheduling-data>
I am using Quartz 2.2.2
I suppose the problem may be in the order in which you define nodes in your XML.
Try reorder them like here
I.e. name/group/description then other settings.
It appears the order of the XML elements is important for the parser, using the Netbeans XML validation feature I edited the XML file and it's now working fine
<?xml version="1.0" encoding="UTF-8"?>
<job-scheduling-data
xmlns="http://www.quartz-scheduler.org/xml/JobSchedulingData"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.quartz-scheduler.org/xml/JobSchedulingData
http://www.quartz-scheduler.org/xml/job_scheduling_data_1_8.xsd"
version="1.8">
<schedule>
<job>
<name>MailJob</name>
<group>MailGroup</group>
<description>Mail dispatcher job</description>
<job-class>com.myapplication.reporter.MailJob</job-class>
</job>
<trigger>
<simple>
<name>MailTrigger</name>
<description>Mail dispatcher job trigger, this should be set to run every 1 minute</description>
<job-name>MailJob</job-name>
<job-group>MailGroup</job-group>
<repeat-count>0</repeat-count>
<repeat-interval>60000</repeat-interval>
</simple>
</trigger>
</schedule>
</job-scheduling-data>
Is there a way, to instruct Maven Surefire, to save the test starting time of each JUnit Test Case in the report xml file?
I expect that the report should look a bit like this:
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="com.chris.testcases.Timestamp" time="1,962.965" tests="1" errors="0" skipped="0" failures="0">
<properties>
<property ...>
</properties>
<testcase
name="Timestampfilter"
classname="com.chris.testcases.Timestamp"
time="1,339.383" <-- this is the already existing execution time
--> timestamp="2015-03-11 16:44:05" /> <-- this is the NEW attribute I need
...
</testsuite>
Background: I need this paramter for future processing in this xml, and just writing the timestamp in the "normal" logfile/output is no solution.
I am using: Maven 3.2.5 with Surefire-Plugin 2.18.1.
Update: I found an similar question here: https://jira.codehaus.org/browse/SUREFIRE-681