To turn on JPA logging as per the link here
This needs to be done where? in persistence.xml?
<property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE"/>
This needs to be done in the persistence.xml, yes.
-Dopenjpa.Log=DefaultLevel=WARN,Runtime=INFO,Tool=INFO,SQL=TRACE
It can also be set as a JVM property.
Related
I am upgrading Spring from Spring 2.x to Spring 4.2.4 and Quartz from 1.8 to 2.3
Following bean throws "Invalid property 'durability' of bean class [org.springframework.scheduling.quartz.SchedulerFactoryBean]"
If I remove the durability property, I get "org.quartz.SchedulerException: Jobs added with no trigger must be durable"
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="durability" value="true"/>
<property name="recover" value="false"/>
<property name="jobDetails">
<list>
<ref bean="deleteTempFileJobScheduler" />
</list>
</property>
<property name="triggers">
<list>
<ref bean="deleteTempFileJobSchedulerTrigger" />
</list>
</property>
</bean>
Any suggestion?
Thanks in advance.
A Quartz-Job has a attribute called durability.
This property determines whether a Job without triggers should automatically deleted.
I.e. if you set
<property name="durability" value="true"/>
than Jobs remain in the JobStore even if no triggers point to it anymore.
But if you set
<property name="durability" value="false"/>
than jobs should be removed from the JobStore if no triggers point to it.
In that case Quartz gives you the mentioned Exception if you try to add a Job without Triggers to the JobStore (since you add a Job which will be immediately removed).
To prevent such an Exception you could add a Job together with an Trigger to the JobStore.
You need set durability property to JobDetailFactoryBean
(in your case, this is deleteTempFileJobScheduler) and not to SchedulerFactoryBeam
When we are creating job itself , you can add storeDurably(true)
. It is work for me .
JobDetail job = newJob(JobScheduler.class)
.withIdentity( sc.getId()+ "_Job")
.usingJobData(getJobDataMap(sc))
.storeDurably(true)
.build();
I am having an issue where I am attempting to create a Cucumber/Arquillian test for a new service that performs a batch update with JPQL. Everything seems to work correctly, except my #Then code validating the change.
I am setting up my test data in my feature file and it gets added to the H2 database that is created in memory for each test. When the batch update runs it reports back the expected update count based on that data. But when I retrieve one of the objects that should have been updated, the data on that object appears to be unchanged.
Please note: When I execute the service call in my application against our Oracle database it works correctly and the table is updated as expected. The problem seems to be with caching on the H2 in memory database.
My datasource that gets deployed to JBoss by Arquillian is:
<datasource enabled="true"
jndi-name="jdbc/arquillian"
pool-name="ArquillianEmbeddedH2Pool">
<connection-url>
jdbc:h2:mem:arquillian;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS TEST_DB
</connection-url>
<driver>h2</driver>
</datasource>
My Cucumber test defines #PersistenceContext(unitName = "localH2-testDB")
My persistence.xml contains:
<persistence-unit name="localH2-testDB">
<jta-data-source>jdbc/arquillian</jta-data-source>
<properties>
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
<property name="hibernate.cache.use_second_level_cache" value="false"/>
<property name="hibernate.cache.use_query_cache" value="false"/>
</properties>
</persistence-unit>
I don't know what other settings for the H2 database I can change to try and eliminate any caching.
It turns out the problem is inherent to how batch updates are handled in JPA. They do NOT update the persistence cache as one might expect. So the tables were updated correctly, but when the object was re-queried, it didn't have the updates. This is why my test was failing (everything was inside the same transaction) and my deployed code worked (separate transactions performing the update and re-querying the data).
I have tried to save the Orbeon forms in Postgres DB. I created data bases persistence layer but still forms are stored in the default eXist DB. I have created context(Data Base source) in the "Server.xml" from the tomcat7 and I have created "properties-local.xml" file in the Orbeon4.8 (orbeon/src/resources/config/properties-local.xml). My reference is this.
Some one help me how to save the orbeon forms in Postgres DB?
Once the database resource is configured, you can tell Orbeon to use it by adding a like like this to your properties-local.xml:
<property as="xs:string" name="oxf.fr.persistence.provider.*.*.*" value="postgresql"/>
You can see the default configuration for the resource names Orbeon accepts out of the box in properties-form-runner.xml.
Exist will still be used for the example forms. But you can disable it with:
<property as="xs:boolean" name="oxf.fr.persistence.exist.active" value="false"/>
If you need to define a resource with a name other than the default names (e.g. postgresql), you will need to provide more information as shown below (remember to replace all occurances of pg_other_name with your resource name).
<property as="xs:string" name="oxf.fr.persistence.provider.*.*.*" value="pg_other_name"/>
<property as="xs:anyURI" name="oxf.fr.persistence.pg_other_name.uri" value="/fr/service/postgresql"/>
<property as="xs:string" name="oxf.fr.persistence.pg_other_name.datasource" value="pg_other_name"/>
<property as="xs:boolean" name="oxf.fr.persistence.pg_other_name.create-flat-view" value="true"/>
<property as="xs:boolean" name="oxf.fr.persistence.pg_other_name.autosave" value="true"/>
<property as="xs:boolean" name="oxf.fr.persistence.pg_other_name.permissions" value="true"/>
<property as="xs:boolean" name="oxf.fr.persistence.pg_other_name.versioning" value="true"/>
I'm not sure what you mean by "created context in the Server.xml".
In tomcat's server.xml you should have a datasource defined. For example:
<GlobalNamingResources>
<Resource
name="jdbc/postgresql"
auth="Container"
type="javax.sql.DataSource"
initialSize="3"
maxActive="10"
maxIdle="20"
maxWait="30000"
driverClassName="org.postgresql.Driver"
validationQuery="select 1"
testOnBorrow="true"
poolPreparedStatements="true"
username="orbeon"
password="orbeon"
url="jdbc:postgresql://server:5432/database?useUnicode=true&characterEncoding=UTF8&socketTimeout=30&tcpKeepAlive=true"/>
</GlobalNamingResources>
Then in tomcat's context.xml you should have a ResourceLink for the datasource:
<ResourceLink global="jdbc/postgresql" name="jdbc/postgresql" type="javax.sql.DataSource"/>
properties-local.xml should be either in webapps/orbeon/WEB-INF/resources/config or in an external directory you have defined in tomcat's context.xml, for example:
<Parameter name="oxf.resources.priority.0" override="false" value="org.orbeon.oxf.resources.FilesystemResourceManagerFactory"/>
<Parameter name="oxf.resources.priority.0.oxf.resources.filesystem.sandbox-directory" override="false" value="C:/orbeon_resources"/>
In that case the properties-local.xml should be here: C:\orbeon_resources\properties-local.xml. See Storing configurations outside of the Orbeon Forms war file.
Also, make sure you have performed the Orbeon Forms setup. That is general database configuration, not specific to postgresql or any other database implementation. The examples they give are for oracle but you can just replace oracle with postgresql.
I use restlet in camel route in from("restlet:http/myLink") clause. When user's requests more then ten per second, I begin recieve errors processing request like a "org.restlet.engine.connector.Controller run
INFO: Connector overload detected. Stop accepting new work"
I think, that error is caused by number of threads,request query's size or number,or something like that. I try set to maxThreads param different values in spring config
<bean id="restlet" class="org.apache.camel.component.restlet.RestletComponent">
<property name="maxThreads" value="15"/>
</bean>
but I am not succeed. In documentation http://camel.apache.org/restlet.html I ddin't find ant param for setting size\number of request queue. I need help :(
P.S. camel-restlet version is 2.12.2
Update
I try to set big numbers to maxThreads,maxConnectionsPerHost,maxTotalConnections, but it's useless. If inject org.restlet.Component to camel's config like that:
<bean id="restletComponent" class="org.restlet.Component" />
<bean id="restlet" class="org.apache.camel.component.restlet.RestletComponent">
<constructor-arg index="0">
<ref bean="restletComponent" />
</constructor-arg>
<property name="maxThreads" value="255"/>
<property name="maxConnectionsPerHost" value="1000"/>
<property name="maxTotalConnections" value="1000" />
</bean>
How I can override properties, that use BaseHelper params?
After go through the options of lowThread as well.
But I found current released camel doesn't support it.
I test Mapper with JUnit, and I get the log info bellow infinite loop.
14:07:54.040 [main] DEBUG o.m.spring.SqlSessionFactoryBean - Property 'configLocation' not specified, using default MyBatis Configuration
This is just a information that you haven't included <property name="configLocation" value="path_to_mybatis_config_file.xml"/>.
Note that this message is not indicating any error, as it's not always neccessary to include this XML file, because some configuration can be performed directly using bean property tags.
In order for others to help you, please show your application context setup for org.mybatis.spring.SqlSessionFactoryBean. This is a working example:
<bean id="YOUR_BEAN_ID" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="YOUR_DATA_SOURCE"/>
<property name="mapperLocations" value="classpath*:*Mapper.xml"/>
<property name="configLocation" value="classpath:TO_YOUR_MYBATIS_CONFIG.XML"/>
</bean>