Ich entwickle eine Webanwendung mit AngularJs als Frontend und Spring+Hibernate als Serviceschicht. Service Layer verfügt über eine Reihe von REST-APIs, die von AngularJs genutzt werden. Das Frontend der Anwendung weist keine größeren Probleme auf. Aber auf der Serviceebene habe ich einige Probleme mit der Parallelität. In einigen Szenarien muss ich von derselben HTTP-Sitzung aus parallele asynchrone Aufrufe an dieselben REST-APIs durchführen. Wenn ich das mache, erhalte ich manchmal die obige Fehlermeldung. Tatsächlich ändert sich der Fehler jedes Mal. Manchmal erhalte ich auch eine NULLPointerException bei der Operation Query.List(). Manchmal erhalte ich die Ausnahme „TransactionResourceAlreadyClosed“. Nachfolgend finden Sie verschiedene Konfigurationen und Codeausschnitte.
Web.xml
Code: Select all
contextConfigLocation
WEB-INF/config/fs-cxf-serverContext.xml,WEB-INF/config/fs-spring-jpa-config.xml,WEB-INF/config/security-beans.xml
org.springframework.web.context.request.RequestContextListener
org.springframework.web.context.ContextLoaderListener
CorsFilter
org.apache.catalina.filters.CorsFilter
cors.allowed.origins
*
cors.allowed.headers
Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers,Access-Control-Allow-Origin
cors.exposed.headers
Access-Control-Allow-Origin
cors.allowed.methods
GET, POST, PUT, DELETE, OPTIONS, HEAD
CorsFilter
/*
springSecurityFilterChain
org.springframework.web.filter.DelegatingFilterProxy
springSecurityFilterChain
/*
Servlet to Initialize and shutdown the Scheduler
QuartzInitializer
org.quartz.ee.servlet.QuartzInitializerServlet
config-file
quartz.properties
shutdown-on-unload
true
start-scheduler-on-load
true
2
CXFServlet
org.apache.cxf.transport.servlet.CXFServlet
1
CXFServlet
/services/*
jdbc/foodsafetyDS
javax.sql.DataSource
Container
Shareable
JPA-Konfiguration
Hibernate.cfg.xml
Code: Select all
com.mysql.jdbc.Driver
org.hibernate.dialect.MySQLDialect
java:comp/env/jdbc/foodsafetyDS
update
false
Ich habe mit CXF einen einfachen Rest-Controller erstellt. Der REST-Endpunkt ist wie folgt
Code: Select all
@Path("/units")
@Produces(MediaType.APPLICATION_JSON)
public interface UnitService extends Serializable {
@GET
@Path("/getGraphData/{type}")
@Produces(MediaType.APPLICATION_JSON)
public UnitServiceBean getGraphData(@PathParam("type") String type)
throws FoodSafetyException;
}
Die Implementierung des Controllers erfolgt wie folgt
xxxServiceImpl.java
Code: Select all
@Service("unit")
@Transactional
public class xxxServiceImpl implements xxxService {
private static final long serialVersionUID = 1L;
@Autowired
xxxDelegate xxxDelegate;
@Override
public UnitServiceBean getGraphData(String type) throws FoodSafetyException {
UnitServiceBean bean = new UnitServiceBean();
List data = unitDelegate.getGraphData(type);
....
....
return bean;
}
Delegate ruft das DAO auf. (Wir haben das Business-Objekt noch nicht eingeführt). Die Implementierung von DAO ist wie folgt
Code: Select all
@Component
public class UnitDAOImpl extends FoodSafetyDAO implements UnitDAO {
@Override
public List getGraphData(String type) {
List data = new ArrayList();
Map readings = new HashMap();
SimpleDateFormat df = CommonConstants.TIME_FORMATTER;
// Get all the Units
Query query = getSession().getNamedQuery(
QueryConstants.FIND_UNITS_BY_TYPE);
query.setParameter(QueryConstants.TYPE, type);
List units = (List) query.list();
if (units != null && units.size() != 0) {
.....
.....
for (UnitEntity unit : units) {
Calendar cal1 = Calendar.getInstance();
cal1.add(Calendar.DAY_OF_YEAR, -1);
query = getSession().getNamedQuery(
QueryConstants.FIND_READING_BY_UNIT_TIME).setLong(
QueryConstants.UNIT_ID, unit.getUnitId());
List rr = query.list();
...
...
}
}
return data;
}
Wenn ich jetzt den REST-Dienst „getGraphData“ einmal mit POSTMAN usw. aufrufe, funktioniert es einwandfrei und ohne Probleme. Aber wenn ich einen gleichzeitigen Aufruf dieses Restdienstes mit simuliere, erhalte ich die folgende Fehlermeldung
Code: Select all
Caused by: org.hibernate.AssertionFailure: p o s s i b l e n o n - t h r e a d s a f e a c c e s s t o t h e s e s s i o n < b r / > a t o r g . h i b e r n a t e . e n g i n e . i n t e r n a l . T w o P h a s e L o a d . i n i t i a l i z e E n t i t y ( T w o P h a s e L o a d . j a v a : 1 3 0 ) < b r / > a t o r g . h i b e r n a t e . l o a d e r . L o a d e r . i n i t i a l i z e E n t i t i e s A n d C o l l e c t i o n s ( L o a d e r . j a v a : 1 1 0 8 ) < b r / > a t o r g . h i b e r n a t e . l o a d e r . L o a d e r . p r o c e s s R e s u l t S e t ( L o a d e r . j a v a : 9 6 4 ) < b r / > a t o r g . h i b e r n a t e . l o a d e r . L o a d e r . d o Q u e r y ( L o a d e r . j a v a : 9 1 1 ) < b r / > a t o r g . h i b e r n a t e . l o a d e r . L o a d e r . d o Q u e r y A n d I n i t i a l i z e N o n L a z y C o l l e c t i o n s ( L o a d e r . j a v a : 3 4 2 ) < b r / > a t o r g . h i b e r n a t e . l o a d e r . L o a d e r . d o L i s t ( L o a d e r . j a v a : 2 5 2 6 ) < b r / > a t o r g . h i b e r n a t e . l o a d e r . L o a d e r . d o L i s t ( L o a d e r . j a v a : 2 5 1 2 ) < b r / > a t o r g . h i b e r n a t e . l o a d e r . L o a d e r . l i s t I g n o r e Q u e r y C a c h e ( L o a d e r . j a v a : 2 3 4 2 ) < b r / > a t o r g . h i b e r n a t e . l o a d e r . L o a d e r . l i s t ( L o a d e r . j a v a : 2 3 3 7 ) < b r / > a t o r g . h i b e r n a t e . l o a d e r . h q l . Q u e r y L o a d e r . l i s t ( Q u e r y L o a d e r . j a v a : 4 9 5 ) < b r / > a t o r g . h i b e r n a t e . h q l . i n t e r n a l . a s t . Q u e r y T r a n s l a t o r I m p l . l i s t ( Q u e r y T r a n s l a t o r I m p l . j a v a : 3 5 6 ) < b r / > a t o r g . h i b e r n a t e . e n g i n e . q u e r y . s p i . H Q L Q u e r y P l a n . p e r f o r m L i s t ( H Q L Q u e r y P l a n . j a v a : 1 9 5 ) < b r / > a t o r g . h i b e r n a t e . i n t e r n a l . S e s s i o n I m p l . l i s t ( S e s s i o n I m p l . j a v a : 1 2 6 9 ) < b r / > a t o r g . h i b e r n a t e . i n t e r n a l . Q u e r y I m p l . l i s t ( Q u e r y I m p l . j a v a : 1 0 1 ) < b r / > a t c o m . c t s . f o o d S a f e t y . m o d e l . d a o . i m p l . U n i t D A O I m p l . g e t G r a p h D a t a ( U n i t D A O I m p l . j a v a : 2 5 5 ) < b r / > a t s u n . r e f l e c t . N a t i v e M e t h o d A c c e s s o r I m p l . i n v o k e 0 ( N a t i v e M e t h o d ) < b r / > a t s u n . r e f l e c t . N a t i v e M e t h o d A c c e s s o r I m p l . i n v o k e ( N a t i v e M e t h o d A c c e s s o r I m p l . j a v a : 3 9 ) < b r / > a t s u n . r e f l e c t . D e l e g a t i n g M e t h o d A c c e s s o r I m p l . i n v o k e ( D e l e g a t i n g M e t h o d A c c e s s o r I m p l . j a v a : 2 5 ) < b r / > a t j a v a . l a n g . r e f l e c t . M e t h o d . i n v o k e ( M e t h o d . j a v a : 5 9 7 ) < b r / > a t o r g . s p r i n g f r a m e w o r k . a o p . s u p p o r t . A o p U t i l s . i n v o k e J o i n p o i n t U s i n g R e f l e c t i o n ( A o p U t i l s . j a v a : 3 1 7 ) < b r / > a t o r g . s p r i n g f r a m e w o r k . a o p . f r a m e w o r k . R e f l e c t i v e M e t h o d I n v o c a t i o n . i n v o k e J o i n p o i n t ( R e f l e c t i v e M e t h o d I n v o c a t i o n . j a v a : 1 8 3 ) < b r / > a t o r g . s p r i n g f r a m e w o r k . a o p . f r a m e w o r k . R e f l e c t i v e M e t h o d I n v o c a t i o n . p r o c e e d ( R e f l e c t i v e M e t h o d I n v o c a t i o n . j a v a : 1 5 0 ) < b r / > a t o r g . s p r i n g f r a m e w o r k . a o p . f r a m e w o r k . a d a p t e r . M ethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:51)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.aspectj.AspectJAfterAdvice.invoke(AspectJAfterAdvice.java:42)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy51.getGraphData(Unknown Source)
at com.cts.foodSafety.delegate.UnitDelegate.getGraphData(UnitDelegate.java:39)
at com.cts.foodSafety.delegate.UnitDelegate$$FastClassByCGLIB$$aac35d0d.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:51)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.aspectj.AspectJAfterAdvice.invoke(AspectJAfterAdvice.java:42)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)
at com.cts.foodSafety.delegate.UnitDelegate$$EnhancerByCGLIB$$75af66.getGraphData()
at com.cts.foodSafety.service.impl.UnitServiceImpl.getGraphData(UnitServiceImpl.java:108)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:51)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.aspectj.AspectJAfterAdvice.invoke(AspectJAfterAdvice.java:42)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:55)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy72.getGraphData(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
Der Client, den ich für die gleichzeitige Anfrage verwendet habe, ist wie folgt
Code: Select all
public class RestClient implements Runnable{
private String i;
public RestClient(String x) {
i=x;
}
public static void main(String[] args) {
for(int i =1;i
Ich entwickle eine Webanwendung mit AngularJs als Frontend und Spring+Hibernate als Serviceschicht. Service Layer verfügt über eine Reihe von REST-APIs, die von AngularJs genutzt werden. Das Frontend der Anwendung weist keine größeren Probleme auf. Aber auf der Serviceebene habe ich einige Probleme mit der Parallelität. In einigen Szenarien muss ich von derselben HTTP-Sitzung aus parallele asynchrone Aufrufe an dieselben REST-APIs durchführen. Wenn ich das mache, erhalte ich manchmal die obige Fehlermeldung. Tatsächlich ändert sich der Fehler jedes Mal. Manchmal erhalte ich auch eine NULLPointerException bei der Operation Query.List(). Manchmal erhalte ich die Ausnahme „TransactionResourceAlreadyClosed“. Nachfolgend finden Sie verschiedene Konfigurationen und Codeausschnitte.
Web.xml
[code]
contextConfigLocation
WEB-INF/config/fs-cxf-serverContext.xml,WEB-INF/config/fs-spring-jpa-config.xml,WEB-INF/config/security-beans.xml
org.springframework.web.context.request.RequestContextListener
org.springframework.web.context.ContextLoaderListener
CorsFilter
org.apache.catalina.filters.CorsFilter
cors.allowed.origins
*
cors.allowed.headers
Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers,Access-Control-Allow-Origin
cors.exposed.headers
Access-Control-Allow-Origin
cors.allowed.methods
GET, POST, PUT, DELETE, OPTIONS, HEAD
CorsFilter
/*
springSecurityFilterChain
org.springframework.web.filter.DelegatingFilterProxy
springSecurityFilterChain
/*
Servlet to Initialize and shutdown the Scheduler
QuartzInitializer
org.quartz.ee.servlet.QuartzInitializerServlet
config-file
quartz.properties
shutdown-on-unload
true
start-scheduler-on-load
true
2
CXFServlet
org.apache.cxf.transport.servlet.CXFServlet
1
CXFServlet
/services/*
jdbc/foodsafetyDS
javax.sql.DataSource
Container
Shareable
[/code]
JPA-Konfiguration
[code]
[/code]
Hibernate.cfg.xml
[code]
com.mysql.jdbc.Driver
org.hibernate.dialect.MySQLDialect
java:comp/env/jdbc/foodsafetyDS
update
false
[/code]
Ich habe mit CXF einen einfachen Rest-Controller erstellt. Der REST-Endpunkt ist wie folgt
[code]@Path("/units")
@Produces(MediaType.APPLICATION_JSON)
public interface UnitService extends Serializable {
@GET
@Path("/getGraphData/{type}")
@Produces(MediaType.APPLICATION_JSON)
public UnitServiceBean getGraphData(@PathParam("type") String type)
throws FoodSafetyException;
[/code]
}
Die Implementierung des Controllers erfolgt wie folgt
xxxServiceImpl.java
[code]@Service("unit")
@Transactional
public class xxxServiceImpl implements xxxService {
private static final long serialVersionUID = 1L;
@Autowired
xxxDelegate xxxDelegate;
@Override
public UnitServiceBean getGraphData(String type) throws FoodSafetyException {
UnitServiceBean bean = new UnitServiceBean();
List data = unitDelegate.getGraphData(type);
....
....
return bean;
}
[/code]
Delegate ruft das DAO auf. (Wir haben das Business-Objekt noch nicht eingeführt). Die Implementierung von DAO ist wie folgt
[code]@Component
public class UnitDAOImpl extends FoodSafetyDAO implements UnitDAO {
@Override
public List getGraphData(String type) {
List data = new ArrayList();
Map readings = new HashMap();
SimpleDateFormat df = CommonConstants.TIME_FORMATTER;
// Get all the Units
Query query = getSession().getNamedQuery(
QueryConstants.FIND_UNITS_BY_TYPE);
query.setParameter(QueryConstants.TYPE, type);
List units = (List) query.list();
if (units != null && units.size() != 0) {
.....
.....
for (UnitEntity unit : units) {
Calendar cal1 = Calendar.getInstance();
cal1.add(Calendar.DAY_OF_YEAR, -1);
query = getSession().getNamedQuery(
QueryConstants.FIND_READING_BY_UNIT_TIME).setLong(
QueryConstants.UNIT_ID, unit.getUnitId());
List rr = query.list();
...
...
}
}
return data;
}
[/code]
Wenn ich jetzt den REST-Dienst „getGraphData“ einmal mit POSTMAN usw. aufrufe, funktioniert es einwandfrei und ohne Probleme. Aber wenn ich einen gleichzeitigen Aufruf dieses Restdienstes mit simuliere, erhalte ich die folgende Fehlermeldung
[code]Caused by: org.hibernate.AssertionFailure: p o s s i b l e n o n - t h r e a d s a f e a c c e s s t o t h e s e s s i o n < b r / > a t o r g . h i b e r n a t e . e n g i n e . i n t e r n a l . T w o P h a s e L o a d . i n i t i a l i z e E n t i t y ( T w o P h a s e L o a d . j a v a : 1 3 0 ) < b r / > a t o r g . h i b e r n a t e . l o a d e r . L o a d e r . i n i t i a l i z e E n t i t i e s A n d C o l l e c t i o n s ( L o a d e r . j a v a : 1 1 0 8 ) < b r / > a t o r g . h i b e r n a t e . l o a d e r . L o a d e r . p r o c e s s R e s u l t S e t ( L o a d e r . j a v a : 9 6 4 ) < b r / > a t o r g . h i b e r n a t e . l o a d e r . L o a d e r . d o Q u e r y ( L o a d e r . j a v a : 9 1 1 ) < b r / > a t o r g . h i b e r n a t e . l o a d e r . L o a d e r . d o Q u e r y A n d I n i t i a l i z e N o n L a z y C o l l e c t i o n s ( L o a d e r . j a v a : 3 4 2 ) < b r / > a t o r g . h i b e r n a t e . l o a d e r . L o a d e r . d o L i s t ( L o a d e r . j a v a : 2 5 2 6 ) < b r / > a t o r g . h i b e r n a t e . l o a d e r . L o a d e r . d o L i s t ( L o a d e r . j a v a : 2 5 1 2 ) < b r / > a t o r g . h i b e r n a t e . l o a d e r . L o a d e r . l i s t I g n o r e Q u e r y C a c h e ( L o a d e r . j a v a : 2 3 4 2 ) < b r / > a t o r g . h i b e r n a t e . l o a d e r . L o a d e r . l i s t ( L o a d e r . j a v a : 2 3 3 7 ) < b r / > a t o r g . h i b e r n a t e . l o a d e r . h q l . Q u e r y L o a d e r . l i s t ( Q u e r y L o a d e r . j a v a : 4 9 5 ) < b r / > a t o r g . h i b e r n a t e . h q l . i n t e r n a l . a s t . Q u e r y T r a n s l a t o r I m p l . l i s t ( Q u e r y T r a n s l a t o r I m p l . j a v a : 3 5 6 ) < b r / > a t o r g . h i b e r n a t e . e n g i n e . q u e r y . s p i . H Q L Q u e r y P l a n . p e r f o r m L i s t ( H Q L Q u e r y P l a n . j a v a : 1 9 5 ) < b r / > a t o r g . h i b e r n a t e . i n t e r n a l . S e s s i o n I m p l . l i s t ( S e s s i o n I m p l . j a v a : 1 2 6 9 ) < b r / > a t o r g . h i b e r n a t e . i n t e r n a l . Q u e r y I m p l . l i s t ( Q u e r y I m p l . j a v a : 1 0 1 ) < b r / > a t c o m . c t s . f o o d S a f e t y . m o d e l . d a o . i m p l . U n i t D A O I m p l . g e t G r a p h D a t a ( U n i t D A O I m p l . j a v a : 2 5 5 ) < b r / > a t s u n . r e f l e c t . N a t i v e M e t h o d A c c e s s o r I m p l . i n v o k e 0 ( N a t i v e M e t h o d ) < b r / > a t s u n . r e f l e c t . N a t i v e M e t h o d A c c e s s o r I m p l . i n v o k e ( N a t i v e M e t h o d A c c e s s o r I m p l . j a v a : 3 9 ) < b r / > a t s u n . r e f l e c t . D e l e g a t i n g M e t h o d A c c e s s o r I m p l . i n v o k e ( D e l e g a t i n g M e t h o d A c c e s s o r I m p l . j a v a : 2 5 ) < b r / > a t j a v a . l a n g . r e f l e c t . M e t h o d . i n v o k e ( M e t h o d . j a v a : 5 9 7 ) < b r / > a t o r g . s p r i n g f r a m e w o r k . a o p . s u p p o r t . A o p U t i l s . i n v o k e J o i n p o i n t U s i n g R e f l e c t i o n ( A o p U t i l s . j a v a : 3 1 7 ) < b r / > a t o r g . s p r i n g f r a m e w o r k . a o p . f r a m e w o r k . R e f l e c t i v e M e t h o d I n v o c a t i o n . i n v o k e J o i n p o i n t ( R e f l e c t i v e M e t h o d I n v o c a t i o n . j a v a : 1 8 3 ) < b r / > a t o r g . s p r i n g f r a m e w o r k . a o p . f r a m e w o r k . R e f l e c t i v e M e t h o d I n v o c a t i o n . p r o c e e d ( R e f l e c t i v e M e t h o d I n v o c a t i o n . j a v a : 1 5 0 ) < b r / > a t o r g . s p r i n g f r a m e w o r k . a o p . f r a m e w o r k . a d a p t e r . M ethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:51)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.aspectj.AspectJAfterAdvice.invoke(AspectJAfterAdvice.java:42)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy51.getGraphData(Unknown Source)
at com.cts.foodSafety.delegate.UnitDelegate.getGraphData(UnitDelegate.java:39)
at com.cts.foodSafety.delegate.UnitDelegate$$FastClassByCGLIB$$aac35d0d.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:51)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.aspectj.AspectJAfterAdvice.invoke(AspectJAfterAdvice.java:42)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)
at com.cts.foodSafety.delegate.UnitDelegate$$EnhancerByCGLIB$$75af66.getGraphData()
at com.cts.foodSafety.service.impl.UnitServiceImpl.getGraphData(UnitServiceImpl.java:108)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:51)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.aspectj.AspectJAfterAdvice.invoke(AspectJAfterAdvice.java:42)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:55)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy72.getGraphData(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
[/code]
Der Client, den ich für die gleichzeitige Anfrage verwendet habe, ist wie folgt
[code]public class RestClient implements Runnable{
private String i;
public RestClient(String x) {
i=x;
}
public static void main(String[] args) {
for(int i =1;i