I want to set a timeout for 120 minutes in the session of Camunda.
This is the configuration in my pom.xml :
...
...
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-engine-rest-core</artifactId>
<version>7.8.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
...
...
I tried a lot of tracks, two of which are the most proposed on the forums, one to use if spring boot version is < 1 and the other if spring boot is > 2 :
server.connection-timeout=...
server.servlet.session.timeout=...
For the version of dependecies :
<springboot.version>2.3.0</springboot.version>
<version.camunda>7.8.0</version.camunda>
Are there other possibilities to set the timeout session ?
I achieved something similar using spring session, when using spring boot 2.x.x.
My pom.xml has these dependencies:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-core</artifactId>
</dependency>
Using these, Camunda will rely on spring session for session management so you can control session using standard options provided by spring session. However, keep in mind this will use you persistence layer (postgres/h2/etc).
There's a spring.session.timeout available, try setting that one to 120m in application.properties / application.yaml.
I have these in my application.yaml config file
spring:
session:
store-type: jdbc
jdbc.initialize-schema: always
Related
I have a java spring boot graphql project.
My dependencies in the pom.xml:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.graphql-java-kickstart</groupId>
<artifactId>graphql-spring-boot-starter</artifactId>
<version>12.0.0</version>
</dependency>
<dependency>
<groupId>com.graphql-java-kickstart</groupId>
<artifactId>playground-spring-boot-starter</artifactId>
<version>5.10.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
When i run the application and visit http://localhost:3001/playground i get an empty page saying
"Loading GraphQL Playground"
What may be possibly my problem here.
You can use only this dependency for graphQL playground interfaces and remove the playground-spring-boot-starter:
<dependency>
<groupId>com.graphql-java-kickstart</groupId>
<artifactId>graphql-spring-boot-starter</artifactId>
<version>12.0.0</version>
</dependency>
In your application.yml you need to explicit set the static path for interface files (the path is /vendor/playground/):
static-path:
base: <YOUR-CONTEXT-PATH>/vendor/playground/
Here is a example of some options to enable GraphQL playground, notice that the context-path here is /api:
graphql:
playground:
endpoint: /graphql
subscriptionEndpoint: /subscriptions
enabled: true
pageTitle: Playground
cdn:
enabled: false
version: latest
static-path:
base: /api/vendor/playground/
I had the same issue and the settings above worked for me.
The documentation here uses jdbc template.
https://docs.spring.io/spring-batch/docs/4.1.x/reference/html/testing.html#testing
I would like to ask on how I could write an integration test with Spring Batch using MongoDB? Preferably, if you guys could provide me a concrete example.
I am using these dependencies for your information
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-batch</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-test</artifactId>
<version>${spring.batch.version}</version>
<scope>test</scope>
</dependency>
If only I could find a spring batch example using mongodb
You can find an example of a job reading/writing data from/to MongoDB here: https://github.com/spring-projects/spring-batch/tree/master/spring-batch-samples#mongodb-sample.
The code of the example is here: https://github.com/spring-projects/spring-batch/blob/master/spring-batch-samples/src/main/java/org/springframework/batch/sample/mongodb/MongoDBSampleApp.java.
If you are planning to write an integration test against MongoDB, you can use flapdoodle.embed.mongo or testcontainers.
I am following the spring security tutorial from this link on that tutorial third part. I have to use redis to hand away session information to resource backend.
Here my applicaiton.yml file:
server:
port: 9000
security:
sessions: NEVER
spring:
session:
store-type: redis
redis:
host: localhost
port: 6379
logging:
level:
org.springframework:
security: DEBUG
session: TRACE
Also, I use HeaderHttpSessionStrategy bean as a session strategy
#Bean
HeaderHttpSessionStrategy sessionStrategy() {
return new HeaderHttpSessionStrategy();
}
My pom couldn't find the related class declaration and give me
package org.springframework.session.web.http does not exist
Above error Here my pom.xml file.
<properties>
<java.version>14</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
I am new in spring and spring-security world. Can any advice solve this problem?
Edit:
After I added the new dependency in pom
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session</artifactId>
<version>1.3.5.RELEASE</version>
</dependency>
I solve the above problem but this time hit me the new one it says:
No session repository could be auto-configured, check your configuration (session store type is 'redis'
My redis configuration on application.yml is above. And I am using redis on docker. My docker yml is:
redis:
image: redis
ports:
- "6379:6379"
I got this error recently. I was using Spring Boot 2.4.0. I had added the dependency for Spring Session, but forgot to add one for Jedis.
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
</dependency>
When I first deployed, with that it gave me the message:
No session repository could be auto-configured, check your configuration (session store type is 'redis')
After I added this dependency and rebuilt my JAR, everything worked.
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency>
Perhaps that will help someone else.
Resilience4j version: 1.1.0
Java version: 1.8
Spring boot : 2.2.0
I am trying to configure the Resilience4j with spring boot project but getting below class not found
org.springframework.boot.SpringApplication: Application run failed
java.lang.IllegalArgumentException: Could not find class [org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration]
at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:327)
Java Code as follows :
#RateLimiter(name ="service1",fallbackMethod = "rateLimiterfallback")
#PostMapping(value = "${URL_AUTH}")
public ResponseEntity<AuthRespDTO> fetchToken(#RequestParam("userId") String Id, #RequestParam("password") String pwd, HttpServletRequest httpRequest) {
}
application.yml as below
resilience4j.ratelimiter:
instances:
service1:
limitForPeriod: 1
limitRefreshPeriod: 100000
timeoutDuration: 1000ms
I have below dependencies mentioned in POM.xml .
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-spring-boot2</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-ratelimiter</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId>
<version>2.2.0.RELEASE</version>
</dependency>
Please help me in resolving the issue .
For fixing this issue you have to update the POM with the spring-boot-starter-actuator and spring-boot-starter-aop dependencies.
At present you have a dependency of spring-boot-actuator which should be updated to spring-boot-starter-actuator.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
<version>2.3.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>2.3.2.RELEASE</version>
</dependency>
Note : Release version of spring boot depends on your project.
Similar issue reference
I am trying to lookup for a connectionFactory in a code which is deployed as part of osgi bundle in servicemix (karaf)
final Hashtable<String, Object> jndiContext = new Hashtable<String, Object>();
jndiContext.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
jndiContext.put(Context.SECURITY_AUTHENTICATION, "none");
jndiContext.put(Context.PROVIDER_URL, pJndiLDAPserver);
ctx = new InitialContext(jndiContext);
ConnectionFactory lResult = (ConnectionFactory) ctx.lookup(pJndiCFname);
The issue I am facing is -
when I do a ctx.lookup("xyz") - It gives me a object of javax.naming.Reference instead of MQconnectionFactory. (The same code works perfectly fine as standalone java application)
Also, ctx = new InitialContext(jndiContext) gives me an object of InitialContext with defaultInitContext as -
org.apache.aries.jndi.DelegateContext. Ideally it should give me defaultInitiContext as LdapCtx (as my provider url is a Ldap server)
I have the following dependency in my pom.xml -
<dependency>
<groupId>javax.jms</groupId>
<artifactId>javax.jms-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>com.ibm.mq.osgi</groupId>
<artifactId>java</artifactId>
<version>9.0.0.0</version>
</dependency>
<dependency>
<groupId>com.ibm.msg.client.osgi.jms</groupId>
<artifactId>prereq</artifactId>
<version>9.0.0.0</version>
</dependency>
<dependency>
<groupId>com.ibm.msg.client.osgi</groupId>
<artifactId>jms</artifactId>
<version>9.0.0.0</version>
</dependency>
<dependency>
<groupId>com.ibm.msg.client.osgi.commonservices</groupId>
<artifactId>j2se</artifactId>
<version>9.0.0.0</version>
</dependency>
<dependency>
<groupId>com.ibm.mq.osgi</groupId>
<artifactId>allclient</artifactId>
<version>9.0.0.0</version>
</dependency>
<dependency>
<groupId>com.ibm.mq.osgi</groupId>
<artifactId>allclientprereqs</artifactId>
<version>9.0.0.0</version>
</dependency>
<dependency>
<groupId>com.ibm.msg.client.osgi</groupId>
<artifactId>nls</artifactId>
<version>9.0.0.0</version>
</dependency>
<dependency>
<groupId>com.ibm.msg.client.osgi.wmq</groupId>
<artifactId>nls</artifactId>
<version>9.0.0.0</version>
</dependency>
<dependency>
<groupId>com.ibm.msg.client.osgi.wmq</groupId>
<artifactId>prereq</artifactId>
<version>9.0.0.0</version>
</dependency>
<dependency>
<groupId>com.ibm.msg.client.osgi</groupId>
<artifactId>wmq</artifactId>
<version>9.0.0.0</version>
</dependency>
<dependency>
<groupId>com.csg.npms.pilatus</groupId>
<artifactId>pilatus-common</artifactId>
<version>0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.logging</groupId>
<artifactId>pax-logging-api</artifactId>
<version>1.8.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>4.3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0-m09</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.1.4</version>
<scope>provided</scope>
</dependency>
and the same com.ibm dependency has been installed as part of karaf bundles.
So, therefore w.r.t abouve point 2, how can I bypass default jndi aries lookup in Karaf (org.apache.aries.jndi.DelegateContext), so that it gives me LdapContextFactory Object instead of DelegateContext. Am I missing any jars as part of mq in karaf.
This is the key part of the error:
Unresolved requirements: [[org.apache.qpid.jms.client [464](R 464.8)] osgi.wiring.package; (&(osgi.wiring.package=javax.jms (version>=1.1.0)(!(version>=2.0.0)))
This says that the bundle named org.apache.qpid.jms.client cannot be resolved because it imports the package javax.jms but there is no other bundle that exports the package javax.jms. In OSGi, every import must be matched by an export of that package. Additionally there is a version constraint: you need version [1.1.0, 2.0.0), i.e at least 1.1.0 but less than 2.0.0.
I would suggest using the following bundle from Maven Central: https://search.maven.org/#artifactdetails%7Corg.jboss.spec.javax.jms%7Cjboss-jms-api_1.1_spec%7C1.0.1.Final%7Cjar.
While I don't know how to bypass default jndi look up in karaf , something I myself am struggling with at the moment, trying to figure out how to get it to use an initial context factory that i need , i was able to get a MQ connection factory working by instantiating it directly via a bean in a blueprint, then you can name it and reference it from jndi as a normal service , like this:
<bean id="wmqcf" class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="hostname" value="my.host">
...port, channel, queue manager, etc ...
</bean>
<service interface="javax.jms.ConnectionFactory" ref="wmqcf">
<service-properties>
<entry key="osgi.jndi.service.name" value="jms/wmqcf">
</service-properties>
</srevice>
This way you don't need to worry about any bridges, pools, etc. Just a quick way to get a connection factory in your application for wmq.