Class Cast Exception when using spring API for Unmarshalling xml - spring

Below is the error message :
INFO [integration.ordXX.controller.PaymentOrder] (http-127.0.0.1:7070-1) ......Request Received for the ordergetPackagesToScan : [Ljava.lang.String;#6472d5b3
2017-06-20 14:57:02,989 ERROR [integration.ordXX.controller.PaymentOrder] (http-127.0.0.1:7070-1) Error in submit method: java.lang.ClassCastException: integration.ordXX.request.Order cannot be cast to javax.xml.bind.JAXBElement
at integration.ordXX.controller.PaymentOrder.submit(PaymentOrder.java:72) [classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_111]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_111]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_111]
at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_111]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) [spring-web-4.3.6.RELEASE.j
Here we are using spring API :
//JAXBElement<Order> element = (JAXBElement<Order>) convertor.unmarshal(ordXXReqMarshaller, orderXml);
Order ord=(Order)JAXBIntrospector.getValue(ordXXReqMarshaller.unmarshal(new StreamSource(new StringReader(orderXml))));
//order = element.getValue();
We are trying to unmarshall the xml object with above code but we are getting exception on top of code.
When we tried to achieve the same with camel route it is successful.
Can someone help me please?
Camel route used
from("read from file")
.unmarshall()
.jaxb("package")
.process(new TestProcess())
.to()

Related

FeignClient API-Call with application/x-www-form-urlencoded HEADER

i try to call an azure-api to get a access-token. With postman this work verry well. Now i'am trying to do it with spring boot and feign client.
The Azure-Api-Call need a application/x-www-form-urlencoded header. On the internet I found out that a lot of people have trouble fith feign and this header. I found a git-repro with an FormEncoder which should do the trick, but didn't.
So what i do:
I create a credentialObject with getter and setters which include grant_type, client_id, client_secret and the resource.
Second I create the client itself
import feign.Headers;
import feign.RequestLine;
import org.springframework.web.bind.annotation.RequestBody;
public interface AzureProvisioningClient {
#RequestLine("POST c760270c-f3da-4cfa-9737-03808ef5579f/oauth2/token")
#Headers("Content-Type: application/x-www-form-urlencoded")
Token getToken(#RequestBody Credentials credentials);
}
After that I use the feign.Build to uenter code herese the own Encoder which is suggested here https://github.com/OpenFeign/feign-form
AzureProvisioningClient azureProvisioningClient;
Credentials credentials = new Credentials();
credentials.setGrant_type("client_credentials");
credentials.setClient_id("b7021287-ec86-4864-acbe-0bd55b4e7adc");
credentials.setClient_secret("j7v/mxLDsTA9JIkiyev9/E3+vJdaWQ8Ilz/127ASwK4=");
credentials.setResource("https://management.azure.com/");
azureProvisioningClient = Feign.builder().encoder(new FormEncoder())
.target(AzureProvisioningClient.class, "https://login.microsoftonline.com/");
Token token = azureProvisioningClient.getToken(credentials);
If i run this example I get the following Error:
Caused by: feign.codec.EncodeException: class
de.telemotive.loggerIngressService.client.Credentials is not a type supported
by this encoder.
I also tried with the following: Instead of
Token getToken(#RequestBody Credentials credentials);
I try this: Token getToken(#Param("grant_type") String grant_type, #Param("client_id") String client_id .......);
and than
Token token = azureProvisioningClient.getToken("client_credentials", "b7021287-ec86-4864-acbe-0bd55b4e7adc", ......);
Now I get the following error:
Caused by: feign.FeignException: status 401 reading AzureProvisioningClient#getToken(String,String,String,String)
at feign.FeignException.errorStatus(FeignException.java:60) ~[feign-core-9.7.0.jar:na]
at feign.codec.ErrorDecoder$Default.decode(ErrorDecoder.java:89) ~[feign-core-9.7.0.jar:na]
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:143) ~[feign-core-9.7.0.jar:na]
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:77) ~[feign-core-9.7.0.jar:na]
at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:102) ~[feign-core-9.7.0.jar:na]
at com.sun.proxy.$Proxy237.getToken(Unknown Source) ~[na:na]
at de.telemotive.loggerIngressService.handler.LoggerDeleteListener.handleIncommingDelete(LoggerDeleteListener.java:38) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_181]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_181]
at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:181) ~[spring-messaging-5.0.10.RELEASE.jar:5.0.10.RELEASE]
at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:114) ~[spring-messaging-5.0.10.RELEASE.jar:5.0.10.RELEASE]
at org.springframework.cloud.stream.binding.StreamListenerMessageHandler.handleRequestMessage(StreamListenerMessageHandler.java:55) ~[spring-cloud-stream-2.0.1.RELEASE.jar:2.0.1.RELEASE]
... 29 common frames omitted
Hope you can help me :)

JobInstanceAlreadyCompleteException when running a Batch-Task in Spring cloud Dataflow

I have a Batch job working as a Task in spring cloud dataflow. When i try to execute the same task Definition a second time i get the exception:
java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:793)
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:774)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:335)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1234)
at com.tigerbooks.importer.ImportTask.main(ImportTask.java:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException: A job instance already exists and is complete for parameters={-spring.cloud.task.executionid=3, -spring.datasource.username=dataflow_stage, -spring.datasource.url=jdbc:mysql://10.59.254.101:3306/dataflow_staging, -spring.datasource.driverClassName=org.mariadb.jdbc.Driver, -import.import-audio-content=false, -spring.datasource.password=bVs64CMlKvcTdkRLWL2zNPANYD3HMB, -import.syncfolder=/import-integrationtest, -spring.cloud.task.name=Integration-Test, -spring.profiles.active=ftp01,dev}. If you want to run this job again, change the parameters.
at org.springframework.batch.core.repository.support.SimpleJobRepository.createJobExecution(SimpleJobRepository.java:130)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:338)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:197)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java
My Job configuration looks like this:
#EnableBatchProcessing
public class JobConfiguration {
#Bean
public Job importJob() {
return jobBuilderFactory.get("Import-Products").incrementer(new RunIdIncrementer())
.flow(step1())
.next(step2())
.end()
.build();
}
}
As far as i found out, a JobParametersIncrementor is supposed to fix this exception by adding a incrementing runId to the parameters. But in my case i can only run the job once on the server, then i have to clear the database (mysql) and the RunId is nowhere in the database.
As #Michael Minela already guessed my jobs where started with the wrong docker image-version. So the RunIdIncrementer was not present and it did not work.
After registering a new app with the correct version everything worked. Thanks.

spring redis running script : how to pass expiry time value

I use the lua script:
local lock = redis.call('get', KEYS[1])
if not lock then
return redis.call('SETEX', KEYS[1], ARGV[1] ,ARGV[2] );
end
return false
From spring boot application I use to call redis with the script
DefaultRedisScript<Boolean> redisScript = new
DefaultRedisScript<Boolean>();
redisScript.setScriptSource(new ResourceScriptSource(new ClassPathResource("checkandset2.lua")));
redisScript.setResultType(Boolean.class);
System.out.println(redisTemplate.execute(redisScript , Collections.singletonList("value123"),"10" ,"key123"));
I always get exception :
java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String
at org.springframework.data.redis.serializer.StringRedisSerializer.serialize(StringRedisSerializer.java:32)
at org.springframework.data.redis.core.script.DefaultScriptExecutor.keysAndArgs(DefaultScriptExecutor.java:116)
at org.springframework.data.redis.core.script.DefaultScriptExecutor$1.doInRedis(DefaultScriptExecutor.java:63)
at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:202)
at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:164)
at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:152)
at org.springframework.data.redis.core.script.DefaultScriptExecutor.execute(DefaultScriptExecutor.java:60)
at org.springframework.data.redis.core.script.DefaultScriptExecutor.execute(DefaultScriptExecutor.java:54)
at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:298)
at com.masary.ledger.ResisScriptTestClass.msisdnJustRechargedException(ResisScriptTestClass.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
When I use
System.out.println(redisTemplate.execute(redisScript ,
Collections.singletonList("value123"),new Long(10) ,"key123"));
I get exception
org.springframework.data.redis.RedisSystemException: Unknown redis exception; nested exception is java.lang.ClassCastException: [B cannot be cast to java.lang.Long
at org.springframework.data.redis.FallbackExceptionTranslationStrategy.getFallback(FallbackExceptionTranslationStrategy.java:48)
at org.springframework.data.redis.FallbackExceptionTranslationStrategy.translate(FallbackExceptionTranslationStrategy.java:38)
at org.springframework.data.redis.connection.jedis.JedisConnection.convertJedisAccessException(JedisConnection.java:212)
at org.springframework.data.redis.connection.jedis.JedisConnection.evalSha(JedisConnection.java:3173)
at org.springframework.data.redis.connection.jedis.JedisConnection.evalSha(JedisConnection.java:3158)
at org.springframework.data.redis.connection.DefaultStringRedisConnection.evalSha(DefaultStringRedisConnection.java:1374)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.data.redis.core.CloseSuppressingInvocationHandler.invoke(CloseSuppressingInvocationHandler.java:57)
at com.sun.proxy.$Proxy182.evalSha(Unknown Source)
at org.springframework.data.redis.core.script.DefaultScriptExecutor.eval(DefaultScriptExecutor.java:81)
at org.springframework.data.redis.core.script.DefaultScriptExecutor$1.doInRedis(DefaultScriptExecutor.java:71)
at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:202)
at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:164)
at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:152)
at org.springframework.data.redis.core.script.DefaultScriptExecutor.execute(DefaultScriptExecutor.java:60)
at org.springframework.data.redis.core.script.DefaultScriptExecutor.execute(DefaultScriptExecutor.java:54)
at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:298)
at com.masary.ledger.ResisScriptTestClass.msisdnJustRechargedException(ResisScriptTestClass.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
.
.
Caused by: java.lang.ClassCastException: [B cannot be cast to java.lang.Long
at org.springframework.data.redis.connection.jedis.JedisScriptReturnConverter.convert(JedisScriptReturnConverter.java:53)
at org.springframework.data.redis.connection.jedis.JedisConnection.evalSha(JedisConnection.java:3171)
... 46 more
any advice how can I pass expiry time value to the lua script?
I'm a newbie myself, and was having a similar problem. Try sending the string "10", instead of the Long. Worked for me.
The thread might be old, but might be helpful for others who might stumble upon this.
For me, the reason was using JdkSerializationRedisSerializer as value serializer, like: redisTemplate.setValueSerializer(new JdkSerializationRedisSerializer()), this is also the default.
To fix this, see below the fix:
private static void redisEvalForExpire(String scriptText, List<String> keys, Object[] argv) {
// since spring boot serializes data to - "\xac\xed\x00\x05t\x00\x0" it was not being recognized by redis as integer
redisTemplate.execute(new DefaultRedisScript<>(scriptText), new StringRedisSerializer(), new StringRedisSerializer(), keys, argv);
}
This says use StringRedisSerializer for any value, so when we do - set a 2, using JdkSerializationRedisSerializer, 2 serialized to something like:
"\xac\xed\x00\x05sr\x00\x11java.lang.Integer\x12\xe2\xa0\xa4\xf7\x81\x878\x02\x00\x01I\x00\x05valuexr\x00\x10java.lang.Number\x86\xac\x95\x1d\x0b\x94\xe0\x8b\x02\x00\x00xp\x00\x00\x00\x02"
but when we say use StringRedisSerializer, 2 is sent as "2", which Redis can easily recognize.
Official Documentation

org.apache.hadoop.net.StandardSocketFactory not found

configuration = new Configuration();
configuration.set("fs.default.name",NAME_NODE_URL);
hdfs = FileSystem.get(configuration);
i am getting the below exception while using the code specified above,
java.lang.RuntimeException: Socket Factory class not found: java.lang.ClassNotFoundException: Class org.apache.hadoop.net.StandardSocketFactory not found
at org.apache.hadoop.net.NetUtils.getSocketFactoryFromProperty(NetUtils.java:142)
at org.apache.hadoop.net.NetUtils.getDefaultSocketFactory(NetUtils.java:122)
at org.apache.hadoop.net.NetUtils.getSocketFactory(NetUtils.java:100)
at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:477)
at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:453)
at org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedFileSystem.java:136)
at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2433)
at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:88)
at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2467)
at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2449)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:367)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:166)
at com.arista.cvp.commons.db.HdfsClient.copyfromLocaltoHdfs(HdfsClient.java:55)
at com.arista.cvp.services.hadoop.HDFSService.copyFromLocal(HDFSService.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
could anyone help in resolving the issue?
You definitely need either the hadoop-common-2.x jar on the classpath or the hadoop-core-1.x!

Difference in groovy between calling a method

What is the difference under the hood in groovy between the calls of the function service.defects and service.getDefects()
#RequestMapping("/test1")
ModelAndView getTest1() {
ModelAndView mav = new ModelAndView()
mav.viewName = "test"
List<Defect> defects = service.defects
mav
}
#RequestMapping("/test2")
ModelAndView getTest2() {
ModelAndView mav = new ModelAndView()
mav.viewName = "test"
List<Defect> defects = service.getDefects()
mav
}
I was struggling with this problem for quite a while, and although I thought the calls where the same, they are not. In my scenario the call of service.defects caused a "org.hibernate.HibernateException: No Session found for current thread" exception (getDefects() is Transactional though).
Can anybody explain me what is going on under the hood when I call the method with "service.defects"
This is the stack trace I get:
org.hibernate.HibernateException: No Session found for current thread
at org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:97)
at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:883)
at org.hibernate.SessionFactory$getCurrentSession.call(Unknown Source)
at com.test.dao.LogDBDao.getExceptionLogFileEntry(LogDBDao.groovy:35)
at com.test.dao.ILogDBDao$getExceptionLogFileEntry.call(Unknown Source)
at com.test.service.ImportLogsService.getIncidents(ImportLogsService.groovy:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1580)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3308)
at com.test.service.ImportLogsService.getProperty(ImportLogsService.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
at com.test.service.$Proxy27.getProperty(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:227)
at com.test.controller.IncidentController.getIncidents(IncidentController.groovy:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
In a Groovy class, a property access
service.defects
becomes a call to service.getProperty("defects"), the default implementation of which will ultimately delegate to service.getDefects(). So working up that stack trace from the bottom, IncidentController calls getProperty("incidents") on the service object, which is a Spring AOP proxy.
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
at com.test.service.$Proxy27.getProperty(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:227)
at com.test.controller.IncidentController.getIncidents(IncidentController.groovy:22)
That method is not marked as transactional, so Spring has no need to set up the transaction context before calling the method on the underlying object
at com.test.service.ImportLogsService.getProperty(ImportLogsService.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
Now the getProperty implementation of ImportLogsService does the usual default behaviour and calls its own getIncidents method
at com.test.service.ImportLogsService.getIncidents(ImportLogsService.groovy:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1580)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3308)
Note that this is internal to the target service object, so does not go through the Spring transactional proxy layer again. Thus, even if getIncidents() is marked as #Transactional the transaction interceptor is not called. Finally getIncidents() calls into the DAO layer
at org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:97)
at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:883)
at org.hibernate.SessionFactory$getCurrentSession.call(Unknown Source)
at com.test.dao.LogDBDao.getExceptionLogFileEntry(LogDBDao.groovy:35)
at com.test.dao.ILogDBDao$getExceptionLogFileEntry.call(Unknown Source)
which fails because there's no context set up.
If you called service.getIncidents() in the first place then that method (which is marked transactional) would be the first point of entry into the Spring proxy, and the transaction context would be set up correctly.
Try annotating the whole ImportLogsService class as #Transactional, rather than just the individual methods. This should cause the transaction interceptors to fire on getProperty as well as getIncidents().

Resources