I run IBM JSR 352 batch job under Liberty Profile server. My JSL contains decision, e.g.
<decision id="condition_FTP" ref="ifConditionalStepDecider">
<properties>
<property name="IF_CONDITIONS" value='{"conditions":
[
"STEP2,=,0"
]}'/>
</properties>
<next on="SHOULD_EXECUTE" to="STEP03" />
<next on="SHOULD_SKIP" to="intermediateStep_EMAILERR" />
</decision>
I have tried to retrieve the id of the decision from decider/batchlet but with no luck. It is not inside JobContext or StepContext. Does any of you guys know how I can retrieve it? Thanks a bunch!
Related
I am trying to configure a JDBC-backed Infinispan cache to act as the backend for my Java EE app making use of Hibernate Search. I am deploying on JBoss EAP 7.0 or Wildfly 10. I have a module, cache container, and persistence.xml configuration that does not give me any errors on startup. In addition, I am able to create JPA objects and have them indexed via Hibernate Search as expected. I am then able to query those objects successfully. However, at no time are the SQL tables created in the database that I have configured as my JDBC data source for the cache container. So, obviously, the search indices only exist in memory and are not persisted across app server restarts. Here is what I have done thus far:
Downloaded the Infinispan 8.1.x release that corresponds to the Infinispan release embedded within JBoss EAP. This was done because the hibernate-search modules from Infinispan are not included in the embedded module
I've configured the appropriate modules for the Infinispan hibernate-search module within JBoss EAP
Modified my standalone-full-ha.xml JBoss EAP configuration file to include a JDBC-backed cache-container and cache definitions
Modified my persistence.xml file to make use of an Infinispan cache manager and directory provider
Here is the definition for my cache-container as found in standalone-full-ha.xml:
<cache-container name="hibernateSearch" default-cache="LuceneIndexesData" module="org.infinispan.cachestore.jdbc" jndi-name="java:jboss/infinispan/hibernateSearch">
<transport lock-timeout="60000"/>
<replicated-cache name="LuceneIndexesMetadata" statistics-enabled="true" mode="SYNC">
<binary-keyed-jdbc-store data-source="InfinispanCacheDS" passivation="false" purge="false" shared="true">
<binary-keyed-table>
<id-column name="ID_COLUMN" type="VARCHAR(255)"/>
<data-column name="DATUM" type="BYTEA"/>
</binary-keyed-table>
</binary-keyed-jdbc-store>
</replicated-cache>
<replicated-cache name="LuceneIndexesData" statistics-enabled="true" mode="SYNC">
<binary-keyed-jdbc-store data-source="InfinispanCacheDS" passivation="false" purge="false" shared="true">
<binary-keyed-table>
<id-column name="ID_COLUMN" type="VARCHAR(255)"/>
<data-column name="DATUM" type="BYTEA"/>
</binary-keyed-table>
</binary-keyed-jdbc-store>
</replicated-cache>
<replicated-cache name="LuceneIndexesLocking" statistics-enabled="true" mode="SYNC"/>
</cache-container>
Here is my JDBC data source from standalone-full-ha.xml:
<datasource jndi-name="java:jboss/datasources/InfinispanCacheDS" pool-name="InfinispanCacheDS" enabled="true" use-java-context="true" statistics-enabled="true">
<connection-url>jdbc:postgresql://localhost:5432/db_infinispan_cache</connection-url>
<driver>postgresql-jdbc4</driver>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>20</max-pool-size>
<prefill>true</prefill>
<flush-strategy>IdleConnections</flush-strategy>
</pool>
<security>
<user-name>infinispan_cache</user-name>
<password>mypassword</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/>
<validate-on-match>true</validate-on-match>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/>
</validation>
<statement>
<track-statements>true</track-statements>
</statement>
</datasource>
Here is my persistence.xml file:
<?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_1.xsd"
version="2.1">
<persistence-unit name="MyPU" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/jdbc/datasources/MyDataSourceDS</jta-data-source>
<shared-cache-mode>ALL</shared-cache-mode>
<properties>
<property name="jboss.entity.manager.factory.jndi.name"
value="java:/MyDataSourceEntityManagerFactory" />
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
<property name="hibernate.jdbc.batch_size" value="50" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.generate_statistics" value="true" />
<property name="hibernate.connection.release_mode" value="auto" />
<!-- Transactions -->
<property name="hibernate.transaction.jta.platform"
value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" />
<property name="hibernate.transaction.flush_before_completion"
value="true" />
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.JBossTransactionManagerLookup" />
<property name="hibernate.max_fetch_depth" value="5" />
<!-- Caching support - Infinispan -->
<property name="hibernate.cache.use_second_level_cache"
value="true" />
<property name="hibernate.cache.infinispan.cachemanager"
value="java:jboss/infinispan/container/hibernate" />
<property name="hibernate.cache.use_second_level_cache"
value="true" />
<!-- Hibernate Search properties - Generic -->
<property name="hibernate.search.reader.strategy" value="shared" />
<property name="hibernate.search.worker.execution" value="sync" />
<property name="hibernate.search.jmx_enabled" value="true" />
<!-- Hibernate Search properties - Infinispan -->
<property name="hibernate.search.infinispan.cachemanager_jndiname"
value="java:jboss/infinispan/hibernateSearch" />
<property name="hibernate.search.default.directory_provider"
value="infinispan" />
<property name="hibernate.search.infinispan.chunk_size"
value="300000000" />
</properties>
</persistence-unit>
</persistence>
When JBoss starts up, I do not see any errors. I also don't see any reference to JDBC, however. I also do not see any errors when persisting JPA objects, so it seems they are being indexed appropriately. It's just that my Hibernate Search index isn't being saved in the database as I would expect.
Can anyone shed some light on what I'm missing here?
As you noticed, the Infinispan extensions used by Hibernate Search for this purpose are not included within the Infinispan module which is part of WildFly / JBoss EAP, so you correctly downloaded the Infinispan modules from the Infinispan project.
What you are missing is that WildFly is able to isolate modules very effectively, so the first thing you have to realise is that you really don't have to match the version of Infinispan as included in WildFly.
Since you will be using the module set from infinispan.org, you should NOT configure these caches in your JBoss EAP configuration file, as the caches defined there are controlled by the clustering subsystem and will affect the cache definitions created by the Infinispan modules included in WildFly (the Infinispan modules at slot "main").
You should include an Infinispan configuration file in your Hibernate Search based application, and have it start a new CacheManager using the right module.
Alternatively you can create another application to start the CacheManager in any way you like - as long as you depend on the right Infinispan modules (avoid the "main" slot) - then register it to JNDI and have Hibernate Search look for that name.
N.B. the Hibernate Search module has a dependency to the optional Infinispan module, so it will attempt to load the right Infinispan module if it's present:
https://github.com/wildfly/wildfly/blob/84d88b8/feature-pack/src/main/resources/modules/system/layers/base/org/hibernate/search/engine/main/module.xml#L53
Be aware also that thanks to the module system, you can override / upgrade the Hibernate Search version.
In terms of versions your restrictions are :
pick an Infinispan module version compatible with your Hibernate Search version of choice
pick an Hibernate Search version compatible with the Hibernate ORM version of choice
(That's right, you can override / upgrade Hibernate ORM as well).
Assuming you are using the default version of Hibernate ORM and Hibernate Search as included in WildFly 10, you could download the Infinispan modules at version 8.2.6.Final (the latest stable release) as it also contains a module
<module name="org.infinispan.hibernate-search.directory-provider" slot="for-hibernatesearch-5.5" >
Or if you're using JBoss EAP, you might prefer to download the JBoss Data Grid distribution, which will contain the same features as the Infinispan modules.
I'm trying to use the System Properties' proxy settings for the http4 component to no avail.
The documentation gives this example:
<camelContext>
<properties>
<property key="http.proxyHost" value="172.168.18.9"/>
<property key="http.proxyPort" value="8080"/>
</properties>
</camelContext>
but that's just using hardcoded values.
Is there a way to use placeholders within the camelContext properties?
First of all, you need the PropertiesComponent to resolve properties within the <camelContext>:
<bean id="propertiesComponent" class="org.apache.camel.component.properties.PropertiesComponent" />
You don't need to specify a location, if you just need support for one of the following:
EnvPropertiesFunction
SysPropertiesFunction
ServicePropertiesFunction
Now you can use placeholders in the camelContext properties:
<camelContext>
<properties>
<property key="http.proxyHost" value="{{http.proxyHost}}"/>
<property key="http.proxyPort" value="{{http.proxyPort}}"/>
</properties>
</camelContext>
One other thing to note is that this will fail if the system property is not set. You can (and probably should) specify a default value after a colon
<property key="http.proxyHost" value="{{http.proxyHost:}}"/>
<property key="http.proxyPort" value="{{http.proxyPort:}}"/>
to assure it works in both cases.
I'm trying to trigger a custom build using the TeamCity 8.1 REST API (see https://confluence.jetbrains.com/display/TCD8/REST+API#RESTAPI-TriggeringaBuild). My builds run fine and I'm able to specify custom branches and properties with no issue. My goal is now to specify a custom artifact dependency for the builds I'm triggering.
The response I receive when creating a build is something like the following:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<build taskId="1234" buildTypeId="buildConfig1" state="queued" ...>
<buildType id="buildConfig1" name="Build Config Name" ... />
...
<properties count="1">
<property name="testParam" value="Test 123" own="true" />
</properties>
<custom-artifact-dependencies />
</build>
The "custom-artifact-dependencies" tag in this response leads me to believe that there is a way to specify custom dependencies, but I have not found anything in the TeamCity documentation, the TeamCity forums, or from Google explaining how this can be accomplished. Is there something I'm overlooking here or another way of accomplishing this?
Adding the following to as a child of the "build" tag results in an "Artifact dependency should have type 'artifact_dependency'." error:
<custom-artifact-dependencies>
<artifact-dependency buildId="5432" buildTypeId="parentBuildConfig"/>
</custom-artifact-dependencies>
The server may be confusing my intention with the build configuration API for setting and viewing artifact dependencies (e.g. http://teamcity:8111/httpAuth/app/rest/buildTypes/<buildTypeLocator>/artifact-dependencies/)
I had the same problem
This is what worked for me:
<build>
<triggeringOptions queueAtTop="true"/>
<buildType id="buildConfig1"/>
<custom-artifact-dependencies count="1">
<artifact-dependency id="0" type="artifact_dependency">
<properties>
<property name="pathRules" value="Artifacts_1.zip
Artifacts_2.zip
Artifacts_To_Unzip.zip!/**
"/>
<property name="cleanDestinationDirectory" value="true"/>
<property name="revisionName" value="buildId"/>
<property name="revisionValue" value="5432"/>
</properties>
<source-buildType id="parentBuildConfig" />
</artifact-dependency>
</custom-artifact-dependencies>
</build>
If the 'parentBuildConfig' build is still running, replace the buildId parameter with taskId
Bean Decleration:
bean id="cacheManager" class="org.infinispan.spring.provider.SpringEmbeddedCacheManagerFactoryBean"
p:configurationFileLocation="classpath:infinispan.xml" ..
infinispan.xml
<infinispan
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:5.1 http://www.infinispan.org/schemas/infinispan-config-5.1.xsd"
xmlns="urn:infinispan:config:5.1">
<global>
<transport clusterName="CASCluster"/>
<globalJmxStatistics enabled="true"/>
</global>
<default>
<jmxStatistics enabled="true"/>
<clustering mode="distribution">
<hash numOwners="2" rehashRpcTimeout="120000"/>
<sync/>
</clustering>
</default>
<namedCache name="mtx.infinispan.global">
<eviction strategy="LIRS" maxEntries="50000" />
</namedCache>
<namedCache name="books">
<eviction strategy="LIRS" maxEntries="50000" />
</namedCache>
<namedCache name="scheduleprofiletemplates">
<eviction maxEntries="1000000" strategy="LIRS" />
<loaders passivation="false" shared="false" preload="true">
<!-- We can have multiple cache loaders, which get chained -->
<loader class="org.infinispan.loaders.file.FileCacheStore"
fetchPersistentState="true" purgerThreads="3" purgeSynchronously="true"
ignoreModifications="false" purgeOnStartup="false">
<!-- See the documentation for more configuration examples and flags. -->
<properties>
<property name="location" value="/home/cas/infinispanCache" />
</properties>
</loader>
</loaders>
</namedCache>
I want deploy the application Jboss cluster so that the cache created in one node is accessible/replicated to other node also....
I am using Jboss Domain mode full-ha for the deployment....I have HornetQ, Mod_cluster working properly on the same cluster.
By googling, I cam to know that it achieving thru JNDI....Can you pls tel how to modify the XMl files to achiiev this....I have to create 4 named cache(Where to create this ? In sping config file or Jboss domain.xml).
Thanks in advance
Create a Jboss cluster full-ha profile.
2.Create queus on Jboss side
3.Ovveride the SpringEmbeddedCacheManagerFactoryBean cacheManager
Can't test a jpa/maven project. I have the error
"javax.persistence.PersistenceException: No Persistence provider for EntityManager named xxx"
when I run "mvn cleant test" from commandline. I have a Java SE project.
I have the persistence confiuration in 'src/test/resources/META-INF/persistence.xml'. And I also has the same for 'src/main/...'.
I can see the persistence.xml in 'target/classes/META-INF'. Only that is from the main, not from the test as I run the tests. This is not yet the problem, since both should work anyway.
Trying the JPA for the first time, but as I see, the files should be ok (location and content).
The persistence unit names should match also.
I'm using Eclipse (EE) with m2 and other necessary plugins, but running maven from commandline. I see no errors in the project.
// Update
Tried fixing the maven build as I noticed it should have the test classes and resources in 'target/test-classes'.
Changed the command to "mvn clean test-compile test"
Now the resources can be found from the correct place, but I still got the same error.
// update
For clarity here's the full persistence.xml
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="xxx"
transaction-type="RESOURCE_LOCAL">
<provider>my.package.EntityManagerFactoryHelper</provider>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/db" />
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
<property name="javax.persistence.jdbc.user" value="yyy" />
<property name="javax.persistence.jdbc.password" value="zzz" />
<property name="eclipselink.ddl-generation" value="DROP_AND_CREATE" />
</properties>
</persistence-unit>
I took the helper example from other posts. Basically it just creates the emf using the 'xxx' persistence unit. Here's the helper class. http://pastebin.com/1GE6uMa1
Try to add < provider>org.hibernate.ejb.HibernatePersistence< /provider> inside tag
The provider has to be:
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
Else the table creation fails, even that there is no errors when creating the tables from the entities.
Spent about 2 days resolving this, since I thought I was pointed the right direction by the given hint and didn't check the provider then.
The provider has to be according to the eclipselink, as you could spot it in the configuration of the 'persistence.xml'.
But I failed to say it explicitly. Didn't know it would matter that much and it even succeeded with the table creation once. Not really sure what I had for the provider then, but it failed subsequently (after changes made to the table).
Probably there should had been other configurations by the provider.