Microsoft Graph Proxy and Bypass SSL - java-8

Im using the below :
Java 8
microsoft-graph : 2.10.0
microsoft-graph-auth : 0.2.0
okhttp : 3.14.9
I want to fetch data from Intune using Microsoft Graph API, want to use proxy and also bypass SSL (for testing). As per documentation, i have used the OKHttpClient. Used the OkHttpClient for configuring the proxy, sslSocketFactory and hostnameVerifier but it is no working.
final ClientCredentialProvider authProvider = new ClientCredentialProvider(this.clientId, this.scopes, this.clientSecret, this.tenantId, NationalCloud.Global);
final TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
#Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0] {};
}
#Override
public void checkServerTrusted(final X509Certificate[] arg0, final String arg1)
throws CertificateException {
}
#Override
public void checkClientTrusted(final X509Certificate[] arg0, final String arg1)
throws CertificateException {
}
} };
final SSLContext sslContext = SSLContext.getInstance("SSL");
sslContext.init(null, trustAllCerts, new java.security.SecureRandom());
// Create an ssl socket factory with our all-trusting manager
final SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
final OkHttpClient httpClient = HttpClients.createDefault(new ICoreAuthenticationProvider() {
#Override
public Request authenticateRequest(final Request request) {
return request;
}
}).newBuilder().proxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress(this.proxyHost, this.proxyPort)))
.sslSocketFactory(sslSocketFactory, (X509TrustManager) trustAllCerts[0]).hostnameVerifier(new HostnameVerifier() {
#Override
public boolean verify(final String arg0, final SSLSession arg1) {
return true;
}
}).build();
final IHttpProvider httpProvider = DefaultClientConfig.createWithAuthenticationProvider(authProvider)
.getHttpProvider(httpClient);
final IGraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider(authProvider)
.httpProvider(httpProvider).buildClient();
IUserCollectionPage page = graphClient.users().buildRequest().get();
I get the below errors:
org.apache.oltu.oauth2.common.exception.OAuthSystemException: java.net.UnknownHostException: login.microsoftonline.com
at org.apache.oltu.oauth2.client.URLConnectionClient.execute(URLConnectionClient.java:108)
at org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:65)
at org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:55)
at org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:71)
at com.microsoft.graph.auth.confidentialClient.ClientCredentialProvider.getAccessTokenNewRequest(ClientCredentialProvider.java:102)
at com.microsoft.graph.auth.confidentialClient.ClientCredentialProvider.getAcccessToken(ClientCredentialProvider.java:67)
at com.microsoft.graph.auth.confidentialClient.ClientCredentialProvider.authenticateRequest(ClientCredentialProvider.java:49)
at com.microsoft.graph.http.CoreHttpProvider.sendRequestInternal(CoreHttpProvider.java:395)
at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:220)
at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:200)
at com.microsoft.graph.http.BaseCollectionRequest.send(BaseCollectionRequest.java:92)
at com.microsoft.graph.requests.extensions.UserCollectionRequest.get(UserCollectionRequest.java:72)
at com.hsbc.gme.test.graph_test.App.main(App.java:114)
Caused by: java.net.UnknownHostException: login.microsoftonline.com
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1105)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:999)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1283)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1258)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)
at org.apache.oltu.oauth2.client.URLConnectionClient.setRequestBody(URLConnectionClient.java:124)
at org.apache.oltu.oauth2.client.URLConnectionClient.execute(URLConnectionClient.java:91)
... 12 more
Mar 14, 2021 11:30:17 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 220Graph service exception Error code: InvalidAuthenticationToken
Mar 14, 2021 11:30:17 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 220Error message: CompactToken parsing failed with error code: 80049217
Mar 14, 2021 11:30:17 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 220
Mar 14, 2021 11:30:17 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 220GET https://graph.microsoft.com/v1.0/users
Mar 14, 2021 11:30:17 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 220SdkVersion : graph-java/v2.10.0
Mar 14, 2021 11:30:17 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 220Authorization : [PII_REDACTED]
Mar 14, 2021 11:30:17 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 220
Mar 14, 2021 11:30:17 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 220
Mar 14, 2021 11:30:17 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 220401 : Unauthorized
Mar 14, 2021 11:30:17 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 220[...]
Mar 14, 2021 11:30:17 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 220
Mar 14, 2021 11:30:17 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 220[Some information was truncated for brevity, enable debug logging for more details]
Mar 14, 2021 11:30:17 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: Throwable detail: com.microsoft.graph.http.GraphServiceException: Error code: InvalidAuthenticationToken
Error message: CompactToken parsing failed with error code: 80049217
GET https://graph.microsoft.com/v1.0/users
SdkVersion : graph-java/v2.10.0
Authorization : [PII_REDACTED]
401 : Unauthorized
[...]
[Some information was truncated for brevity, enable debug logging for more details]
Exception in thread "main" com.microsoft.graph.http.GraphServiceException: Error code: InvalidAuthenticationToken
Error message: CompactToken parsing failed with error code: 80049217
GET https://graph.microsoft.com/v1.0/users
SdkVersion : graph-java/v2.10.0
Authorization : [PII_REDACTED]
401 : Unauthorized
[...]
[Some information was truncated for brevity, enable debug logging for more details]
at com.microsoft.graph.http.GraphServiceException.createFromConnection(GraphServiceException.java:496)
at com.microsoft.graph.http.CoreHttpProvider.handleErrorResponse(CoreHttpProvider.java:503)
at com.microsoft.graph.http.CoreHttpProvider.sendRequestInternal(CoreHttpProvider.java:423)
at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:220)
at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:200)
at com.microsoft.graph.http.BaseCollectionRequest.send(BaseCollectionRequest.java:92)
at com.microsoft.graph.requests.extensions.UserCollectionRequest.get(UserCollectionRequest.java:72)
at com.hsbc.gme.test.graph_test.App.main(App.java:114)
Note : If i use https.proxyHost and https.proxyPort then the proxy works, however how can i make it working with the OkHttpClient. Also need a way to bypass SSL

Related

XA Transaction broken in jBPM+jBoss during Oracle to SQL Server migration

Recently started a migration of a large Java EE application from Oracle 12c to MS SQL Server 2016. Most functionality has been smoke tested to work OK including the Quartz Scheduler, basic JMS functions, Hibernate and EJBs working ok, etc. One weird issue has stalled progress so hoping someone might have a suggestion.
The jBPM console works to be able to log in and start/suspend/stop tasks. There is an situation that always triggers an error. The jBPM task can be signaled from with the console and it starts perfectly, but once the first task is finished and the application code tries to signal the token to move to the next task, the code always crashes with an error.
This code was working of course connected to Oracle with the xa-datasource configured.
The error: (full stacktrace)
2017-10-13 16:03:31,463 [WorkManager(2)-19] DEBUG [org.hibernate.jdbc.ConnectionManager] opening JDBC connection
2017-10-13 16:03:31,464 [WorkManager(2)-19] DEBUG [org.hibernate.util.JDBCExceptionReporter] Cannot open connection [???]
org.jboss.util.NestedSQLException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -71740de1:d47b:59e10d94:f5 status: ActionStatus.ABORT_ONLY >; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -71740de1:d47b:59e10d94:f5 status: ActionStatus.ABORT_ONLY >)
at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:95)
at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
at org.hibernate.loader.Loader.doQuery(Loader.java:673)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1860)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3044)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:395)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:375)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:139)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:195)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)
at org.jbpm.db.GraphSession.getToken(GraphSession.java:338)
at org.jbpm.JbpmContext.getToken(JbpmContext.java:286)
at ca.gnb.medicare.process.handling.ProcessUtilBean.signal(ProcessUtilBean.java:47)
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.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
at ca.gnb.medicare.service.interceptors.PeristenceContextInterceptor.intercept(PeristenceContextInterceptor.java:41)
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.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
at org.jboss.aspects.tx.TxInterceptor$RequiresNew.invoke(TxInterceptor.java:253)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:240)
at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:210)
at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:84)
at com.sun.proxy.$Proxy155.signal(Unknown Source)
at ca.gnb.medicare.service.util.AbstractServiceActivator.onMessage(AbstractServiceActivator.java:143)
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.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
at ca.gnb.medicare.service.interceptors.PeristenceContextInterceptor.intercept(PeristenceContextInterceptor.java:41)
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.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.mdb.MessagingContainer.localInvoke(MessagingContainer.java:249)
at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.delivery(MessageInflowLocalProxy.java:268)
at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:138)
at com.sun.proxy.$Proxy169.onMessage(Unknown Source)
at org.jboss.resource.adapter.jms.inflow.JmsServerSession.onMessage(JmsServerSession.java:178)
at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:906)
at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:170)
at org.jboss.mq.SpySession.run(SpySession.java:323)
at org.jboss.resource.adapter.jms.inflow.JmsServerSession.run(JmsServerSession.java:237)
at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:204)
at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:275)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:756)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -71740de1:d47b:59e10d94:f5 status: ActionStatus.ABORT_ONLY >
at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:319)
I cannot think of how SQL Server affects the transaction.
We also get this error on SQL Server: (full sql dump)
2017-10-11 13:10:53.44 spid61 ***Stack Dump being sent to G:\MedSt\MSSQL13.MEDST\MSSQL\LOG\SQLDump0032.txt
2017-10-11 13:10:53.44 spid61 SqlDumpExceptionHandler: Process 61 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
2017-10-11 13:10:54.15 spid61 External dump process return code 0x20000001.
External dump process returned no errors.
2017-10-11 13:10:54.15 spid61 Error: 18002, Severity: 20, State: 1.
2017-10-11 13:10:54.15 spid61 Exception happened when running extended stored procedure 'xp_sqljdbc_xa_start' in the library 'SQLJDBC_XA.dll'. SQL Server is terminating process 61. Exception type: Win32 exception; Exception code: 0xc0000005.
Code that triggers the error:
#Stateless
public class ProcessUtilBean implements ProcessUtil{
private static Logger log = Logger.getLogger();
#EJB DecrementWorkCounter decrementWorkCounter;
#TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void signal(long tokenId){
JbpmContext context = null;
try {
context = getJbpmContext();
log.info("attempting to get token (" + tokenId + ")");
Token token;
token = context.getToken(tokenId);
token.signal(); // <-- triggers error
} catch (Exception e) {
e.printStackTrace();
log.severe("Error signalling process " + e.getMessage());
} finally {
context.close();
}
}
There are of course several tons of XML, but I've changed very little. Basically just the datasources have changed, SQL Dialect and copied over the mssql-jdbc2-service.xml from the jboss examples folder.
Here is the jms-ds.xml seeing as the errors somewhat indicate an issue here with JMS:
<?xml version="1.0" encoding="UTF-8"?>
<connection-factories>
<!-- The JMS provider loader -->
<mbean code="org.jboss.jms.jndi.JMSProviderLoader"
name="jboss.mq:service=JMSProviderLoader,name=JMSProvider">
<attribute name="ProviderName">DefaultJMSProvider</attribute>
<attribute name="ProviderAdapterClass">
org.jboss.jms.jndi.JNDIProviderAdapter
</attribute>
<!-- The combined connection factory -->
<attribute name="FactoryRef">java:/XAConnectionFactory</attribute>
<!-- The queue connection factory -->
<attribute name="QueueFactoryRef">java:/XAConnectionFactory</attribute>
<!-- The topic factory -->
<attribute name="TopicFactoryRef">java:/XAConnectionFactory</attribute>
</mbean>
<!-- The server session pool for Message Driven Beans -->
<mbean code="org.jboss.jms.asf.ServerSessionPoolLoader"
name="jboss.mq:service=ServerSessionPoolMBean,name=StdJMSPool">
<depends optional-attribute-name="XidFactory">jboss:service=XidFactory</depends>
<attribute name="PoolName">StdJMSPool</attribute>
<attribute name="PoolFactoryClass">
org.jboss.jms.asf.StdServerSessionPoolFactory
</attribute>
</mbean>
<!-- JMS XA Resource adapter, use this to get transacted JMS in beans -->
<tx-connection-factory>
<jndi-name>JmsXA</jndi-name>
<xa-transaction/>
<rar-name>jms-ra.rar</rar-name>
<connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
<config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
<config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>
<security-domain-and-application>JmsXARealm</security-domain-and-application>
<max-pool-size>20</max-pool-size>
</tx-connection-factory>
</connection-factories>
Versions:
Java 1.7
jboss 4.2.3.GA
jbpm 3.2.6.sp1
hibernate 3.2.4.sp1
(I know someone will comment, so yes, these are all schedule to be upgraded)
SQL drivers tried so far:
sqljdbc_4.0.2206.100_enu
mssql-jdbc-6.2.1.jre7
mssql-jdbc-6.2.2.jre7
mssql-jdbc-6.3.3.jre7-preview
We followed directions for XA Transactions as posted
If I've missed something important, I'll add it.
** edit **
Finally got some more information from sql driver.
2017-10-18 14:03:31,096 [JCA PoolFiller] ERROR [STDERR] Oct 18, 2017 2:03:31 PM com.microsoft.sqlserver.jdbc.TDSReader readBytes
FINEST: TDSReader#370 (ConnectionID:166 ClientConnectionId: a62ad6a5-19e4-4187-83f5-c60a6bb1aaad) Reading 44 bytes from offset 334
2017-10-18 14:03:31,098 [JCA PoolFiller] ERROR [STDERR] Oct 18, 2017 2:03:31 PM com.microsoft.sqlserver.jdbc.TDSParser parse
FINEST: TDSReader#370 (ConnectionID:166 ClientConnectionId: a62ad6a5-19e4-4187-83f5-c60a6bb1aaad): logon: Processing TDS_ENV_CHG (0xE3)
2017-10-18 14:03:31,098 [JCA PoolFiller] ERROR [STDERR] Oct 18, 2017 2:03:31 PM com.microsoft.sqlserver.jdbc.TDSReader mark
FINEST: TDSReader#370 (ConnectionID:166 ClientConnectionId: a62ad6a5-19e4-4187-83f5-c60a6bb1aaad): Buffering from: com.microsoft.sqlserver.jdbc.TDSReaderMark#6b6611f0
2017-10-18 14:03:31,098 [JCA PoolFiller] ERROR [STDERR] Oct 18, 2017 2:03:31 PM com.microsoft.sqlserver.jdbc.TDSReader readBytes
FINEST: TDSReader#370 (ConnectionID:166 ClientConnectionId: a62ad6a5-19e4-4187-83f5-c60a6bb1aaad) Reading 8 bytes from offset 387
2017-10-18 14:03:31,099 [JCA PoolFiller] ERROR [STDERR] Oct 18, 2017 2:03:31 PM com.microsoft.sqlserver.jdbc.SQLServerConnection processEnvChange
FINER: ConnectionID:166 ClientConnectionId: a62ad6a5-19e4-4187-83f5-c60a6bb1aaad Network packet size is 8000 bytes
2017-10-18 14:03:31,099 [JCA PoolFiller] ERROR [STDERR] Oct 18, 2017 2:03:31 PM com.microsoft.sqlserver.jdbc.TDSReader reset
FINEST: TDSReader#370 (ConnectionID:166 ClientConnectionId: a62ad6a5-19e4-4187-83f5-c60a6bb1aaad): Resetting to: com.microsoft.sqlserver.jdbc.TDSReaderMark#6b6611f0
2017-10-18 14:03:31,099 [JCA PoolFiller] ERROR [STDERR] Oct 18, 2017 2:03:31 PM com.microsoft.sqlserver.jdbc.TDSReader readBytes
FINEST: TDSReader#370 (ConnectionID:166 ClientConnectionId: a62ad6a5-19e4-4187-83f5-c60a6bb1aaad) Reading 19 bytes from offset 385
2017-10-18 14:03:31,099 [JCA PoolFiller] ERROR [STDERR] Oct 18, 2017 2:03:31 PM com.microsoft.sqlserver.jdbc.TDSParser parse
FINEST: TDSReader#370 (ConnectionID:166 ClientConnectionId: a62ad6a5-19e4-4187-83f5-c60a6bb1aaad): logon: Processing TDS_DONE (0xFD)
2017-10-18 14:03:31,099 [JCA PoolFiller] ERROR [STDERR] Oct 18, 2017 2:03:31 PM com.microsoft.sqlserver.jdbc.TDSParser parse
FINEST: TDSReader#370 (ConnectionID:166 ClientConnectionId: a62ad6a5-19e4-4187-83f5-c60a6bb1aaad): logon: Processing EOF
2017-10-18 14:03:31,100 [JCA PoolFiller] ERROR [STDERR] Oct 18, 2017 2:03:31 PM com.microsoft.sqlserver.jdbc.SQLServerConnection connectInternal
FINER: ConnectionID:166 ClientConnectionId: a62ad6a5-19e4-4187-83f5-c60a6bb1aaad End of connect
2017-10-18 14:03:31,100 [JCA PoolFiller] ERROR [STDERR] Oct 18, 2017 2:03:31 PM com.microsoft.sqlserver.jdbc.SQLServerXAConnection <init>
FINER: Created an internal control connectionConnectionID:166 ClientConnectionId: a62ad6a5-19e4-4187-83f5-c60a6bb1aaad for SQLServerXAConnection:81 Physical connection:ConnectionID:165 ClientConnectionId: 78fd8cb2-78ff-44d7-9cae-e20e6256b37e
2017-10-18 14:03:31,100 [JCA PoolFiller] ERROR [STDERR] Oct 18, 2017 2:03:31 PM com.microsoft.sqlserver.jdbc.SQLServerXAConnection <init>
FINER: SQLServerXADataSource:1 user:MEDST3
2017-10-18 14:03:31,100 [JCA PoolFiller] ERROR [STDERR] Oct 18, 2017 2:03:31 PM com.microsoft.sqlserver.jdbc.SQLServerXADataSource getXAConnection
FINER: SQLServerXADataSource:1 user:MEDST3SQLServerXAConnection:81
2017-10-18 14:03:31,100 [JCA PoolFiller] ERROR [STDERR] Oct 18, 2017 2:03:31 PM com.microsoft.sqlserver.jdbc.SQLServerXADataSource getXAConnection
FINER: SQLServerXADataSource:1 Start get physical connection.
2017-10-18 14:03:31,100 [JCA PoolFiller] ERROR [STDERR] Oct 18, 2017 2:03:31 PM com.microsoft.sqlserver.jdbc.SQLServerXADataSource getXAConnection
FINE: SQLServerXADataSource:1 End get physical connection, ConnectionID:165 ClientConnectionId: 78fd8cb2-78ff-44d7-9cae-e20e6256b37e
2017-10-18 14:03:31,100 [JCA PoolFiller] ERROR [STDERR] Oct 18, 2017 2:03:31 PM com.microsoft.sqlserver.jdbc.SQLServerXADataSource:1 getXAConnection
FINER: RETURN SQLServerXAConnection:81
2017-10-18 14:03:31,101 [JCA PoolFiller] ERROR [STDERR] Oct 18, 2017 2:03:31 PM com.microsoft.sqlserver.jdbc.SQLServerPooledConnection getConnection
FINER: SQLServerXAConnection:81 user:(default).
2017-10-18 14:03:31,101 [JCA PoolFiller] ERROR [STDERR] Oct 18, 2017 2:03:31 PM com.microsoft.sqlserver.jdbc.SQLServerPooledConnection getConnection
FINE: SQLServerXAConnection:81 Physical connection, ConnectionID:165 ClientConnectionId: 78fd8cb2-78ff-44d7-9cae-e20e6256b37e
2017-10-18 14:03:31,098 [main] TRACE [org.jboss.web.tomcat.service.WebAppClassLoader] filter name=ca.gnb.medicare.application.claim.manage.SelectServiceProvider$1, exclude=false
2017-10-18 14:03:31,101 [main] DEBUG [org.apache.catalina.loader.WebappClassLoader] Searching local repositories
2017-10-18 14:03:31,101 [JCA PoolFiller] ERROR [STDERR] Oct 18, 2017 2:03:31 PM com.microsoft.sqlserver.jdbc.SQLServerPooledConnection getConnection
FINE: SQLServerXAConnection:81 proxy ProxyConnectionID:81 is returned.
2017-10-18 14:03:31,101 [main] TRACE [org.jboss.web.tomcat.service.WebAppClassLoader] findClass(ca.gnb.medicare.application.claim.manage.SelectServiceProvider$1) called
2017-10-18 14:03:31,101 [main] DEBUG [org.apache.catalina.loader.WebappClassLoader] findClass(ca.gnb.medicare.application.claim.manage.SelectServiceProvider$1)
2017-10-18 14:03:31,101 [JCA PoolFiller] ERROR [STDERR] Oct 18, 2017 2:03:31 PM com.microsoft.sqlserver.jdbc.SQLServerConnection:165 getTransactionIsolation
FINER: ENTRY
2017-10-18 14:03:31,101 [main] TRACE [org.apache.catalina.loader.WebappClassLoader] findClassInternal(ca.gnb.medicare.application.claim.manage.SelectServiceProvider$1)
2017-10-18 14:03:31,101 [WorkManager(2)-19] INFO [org.hibernate.impl.SessionFactoryImpl] building session factory
2017-10-18 14:03:31,101 [JCA PoolFiller] ERROR [STDERR] Oct 18, 2017 2:03:31 PM com.microsoft.sqlserver.jdbc.SQLServerConnection:165 getTransactionIsolation
FINER: RETURN 2 (this is = TRANSACTION_READ_COMMITTED) https://docs.oracle.com/javase/7/docs/api/constant-values.html#java.sql
2017-10-18 14:03:31,101 [JCA PoolFiller] ERROR [STDERR] Oct 18, 2017 2:03:31 PM com.microsoft.sqlserver.jdbc.SQLServerConnection:165 isReadOnly
FINER: ENTRY
2017-10-18 14:03:31,101 [WorkManager(2)-19] DEBUG [org.hibernate.impl.SessionFactoryImpl] Session factory constructed with filter configurations : {}
2017-10-18 14:03:31,101 [JCA PoolFiller] ERROR [STDERR] Oct 18, 2017 2:03:31 PM com.microsoft.sqlserver.jdbc.SQLServerConnection:165 isReadOnly
FINER: RETURN false
**EDIT
Response from Microsoft:
Upon checking with my escalation we found that timeout value basically range a integer value which is basically a unsigned short.
So the maximum XA Timeout value is 65,535.
** /EDIT
So the issue to this specific issue turns out to be an overly high timeout value.
Either the original devs thought 333.33 hours was needed for batch processing or they just picked the number 1,200,000 seconds by random. Oracle didn't care. SQL Server SQLJDBC_XA.DLL does. I haven't found a documented maximum yet, but lowering the value solves the issue.
I've reposted the complete example code from here for completeness, but it's the 1,200,000 value here that is the culprit:
#PoolClass(value=org.jboss.ejb3.StrictMaxPool.class, maxSize=20, timeout=1200000)
#MessageDriven(
mappedName=ClaimsBatchInstigatorBean.QUEUE_NAME,
activationConfig={
#ActivationConfigProperty(
propertyName="destination",
propertyValue=ClaimsBatchInstigatorBean.QUEUE_NAME
),
#ActivationConfigProperty(
propertyName="destinationType",
propertyValue="javax.jms.Queue"
),
#ActivationConfigProperty(
propertyName = "transactionTimeout",
propertyValue = "1200000"
),
#ActivationConfigProperty(
propertyName="maxSession",
propertyValue="15"
)
}
)
Minimal code to reproduce:
package com.******.test;
import java.net.Inet4Address;
import java.sql.*;
import java.util.Random;
import javax.transaction.xa.*;
import javax.sql.*;
import com.microsoft.sqlserver.jdbc.*;
public class testXA {
public static void main(String[] args) throws Exception {
// Create variables for the connection string.
String prefix = "jdbc:sqlserver://";
String serverName = "******";
int portNumber = ******;
String databaseName = "******";
String user = "******";
String password = "******";
String connectionUrl = prefix + serverName + ":" + portNumber
+ ";databaseName=" + databaseName + ";user=" + user + ";password=" + password;
try {
// Establish the connection.
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection con = DriverManager.getConnection(connectionUrl);
// Create a test table.
Statement stmt = con.createStatement();
try {
stmt.executeUpdate("DROP TABLE XAMin");
}
catch (Exception e) {
}
stmt.executeUpdate("CREATE TABLE XAMin (f1 int, f2 varchar(max))");
stmt.close();
con.close();
// Create the XA data source and XA ready connection.
SQLServerXADataSource ds = new SQLServerXADataSource();
ds.setUser(user);
ds.setPassword(password);
ds.setServerName(serverName);
ds.setPortNumber(portNumber);
ds.setDatabaseName(databaseName);
XAConnection xaCon = ds.getXAConnection();
con = xaCon.getConnection();
con.setAutoCommit(false);
// Get a unique Xid object for testing.
XAResource xaRes = null;
Xid xid = null;
xid = XidImpl.getUniqueXid(1);
// Get the XAResource object and set the timeout value.
xaRes = xaCon.getXAResource();
// xaRes.setTransactionTimeout(0); <-- no error
// xaRes.setTransactionTimeout(30000); <-- no error
xaRes.setTransactionTimeout(1200000); //<--- error!
// Perform the XA transaction.
System.out.println("Write -> xid = " + xid.toString());
xaRes.start(xid,XAResource.TMNOFLAGS);
PreparedStatement pstmt =
con.prepareStatement("INSERT INTO XAMin (f1,f2) VALUES (?, ?)");
pstmt.setInt(1,1);
pstmt.setString(2,xid.toString());
pstmt.executeUpdate();
// Commit the transaction.
xaRes.end(xid,XAResource.TMSUCCESS);
xaRes.commit(xid,true);
// Cleanup.
con.close();
xaCon.close();
// Open a new connection and read back the record to verify that it worked.
con = DriverManager.getConnection(connectionUrl);
ResultSet rs = con.createStatement().executeQuery("SELECT * FROM XAMin");
rs.next();
System.out.println("Read -> xid = " + rs.getString(2));
rs.close();
con.close();
}
// Handle any errors that may have occurred.
catch (Exception e) {
e.printStackTrace();
}
}
}
class XidImpl implements Xid {
public int formatId;
public byte[] gtrid;
public byte[] bqual;
public byte[] getGlobalTransactionId() {return gtrid;}
public byte[] getBranchQualifier() {return bqual;}
public int getFormatId() {return formatId;}
XidImpl(int formatId, byte[] gtrid, byte[] bqual) {
this.formatId = formatId;
this.gtrid = gtrid;
this.bqual = bqual;
}
public String toString() {
int hexVal;
StringBuffer sb = new StringBuffer(512);
sb.append("formatId=" + formatId);
sb.append(" gtrid(" + gtrid.length + ")={0x");
for (int i=0; i<gtrid.length; i++) {
hexVal = gtrid[i]&0xFF;
if ( hexVal < 0x10 )
sb.append("0" + Integer.toHexString(gtrid[i]&0xFF));
else
sb.append(Integer.toHexString(gtrid[i]&0xFF));
}
sb.append("} bqual(" + bqual.length + ")={0x");
for (int i=0; i<bqual.length; i++) {
hexVal = bqual[i]&0xFF;
if ( hexVal < 0x10 )
sb.append("0" + Integer.toHexString(bqual[i]&0xFF));
else
sb.append(Integer.toHexString(bqual[i]&0xFF));
}
sb.append("}");
return sb.toString();
}
// Returns a globally unique transaction id.
static byte [] localIP = null;
static int txnUniqueID = 0;
static Xid getUniqueXid(int tid) {
Random rnd = new Random(System.currentTimeMillis());
txnUniqueID++;
int txnUID = txnUniqueID;
int tidID = tid;
int randID = rnd.nextInt();
byte[] gtrid = new byte[64];
byte[] bqual = new byte[64];
if ( null == localIP) {
try {
localIP = Inet4Address.getLocalHost().getAddress();
}
catch ( Exception ex ) {
localIP = new byte[] { 0x01,0x02,0x03,0x04 };
}
}
System.arraycopy(localIP,0,gtrid,0,4);
System.arraycopy(localIP,0,bqual,0,4);
// Bytes 4 -> 7 - unique transaction id.
// Bytes 8 ->11 - thread id.
// Bytes 12->15 - random number generated by using seed from current time in milliseconds.
for (int i=0; i<=3; i++) {
gtrid[i+4] = (byte)(txnUID%0x100);
bqual[i+4] = (byte)(txnUID%0x100);
txnUID >>= 8;
gtrid[i+8] = (byte)(tidID%0x100);
bqual[i+8] = (byte)(tidID%0x100);
tidID >>= 8;
gtrid[i+12] = (byte)(randID%0x100);
bqual[i+12] = (byte)(randID%0x100);
randID >>= 8;
}
return new XidImpl(0x20003, gtrid, bqual);
}
}

i am getting issue while start tomcat server

I am new to jersey multi part. While i am starting the tomcat server getting issue.
#POST
#Path("/uploadImagesUsingJersey")
#Consumes(MediaType.MULTIPART_FORM_DATA)
#Produces("text/plain")
public Response uploadImages(#FormDataParam("file") InputStream uploadedInputStream,
#FormDataParam("file") FormDataContentDisposition fileDetail) throws IOException{
String uploadedFileLocation = (String) session.getServletContext().getAttribute("ProfilePhotoPath");
uploadedFileLocation=uploadedFileLocation+236+"/"+fileDetail.getName();
writeToFile(uploadedInputStream, uploadedFileLocation);
String output = "File uploaded to : " + uploadedFileLocation;
employeeVO=new EmployeeInformationVO();
employeeVO=(EmployeeInformationVO) CacheAction.getById(EmployeeInformationVO.class,236);
employeeVO.setPhotoPath(236+"/"+fileDetail.getFileName());
int result=CacheAction.commonAddOrUpdate(employeeVO);
return Response.status(200).entity(result).build();
}
I am using this kind Of jar:
1)jersey-multipart-1.8-ea03.jar
2)mimepull-1.8-sources.jar
3)jersey-server-1.8.jar
4)jersey-bundle-1.8.jar
And i am getting this kind of issue:
INFO: Provider classes found:
class com.owlike.genson.ext.jaxrs.GensonJsonConverter
Nov 13, 2016 10:45:15 PM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.8 06/24/2011 12:39 PM'
Nov 13, 2016 10:45:17 PM com.sun.jersey.spi.inject.Errors processErrorMessages
SEVERE: The following errors and warnings have been detected with resource and/or provider classes:
SEVERE: Missing dependency for method public javax.ws.rs.core.Response com.hrm.jersey.action.MyServiceAction.uploadImages(java.io.InputStream,com.sun.jersey.core.header.FormDataContentDisposition) throws java.io.IOException at parameter at index 0
SEVERE: Missing dependency for method public javax.ws.rs.core.Response com.hrm.jersey.action.MyServiceAction.uploadImages(java.io.InputStream,com.sun.jersey.core.header.FormDataContentDisposition) throws java.io.IOException at parameter at index 1
SEVERE: Method, public javax.ws.rs.core.Response com.hrm.jersey.action.MyServiceAction.uploadImages(java.io.InputStream,com.sun.jersey.core.header.FormDataContentDisposition) throws java.io.IOException, annotated with POST of resource, class com.hrm.jersey.action.MyServiceAction, is not recognized as valid resource method.
Nov 13, 2016 10:45:17 PM org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
com.sun.jersey.spi.inject.Errors$ErrorMessagesException

Creating PrimeFaces metergauge chart without #PostConstruct annotation

I need to retrieve data from spring jpa data to an managed bean class, which creates an MeterGaugeChartView. When I call the values from injected Spring bean within an #PostConstruct method I get java.lang.NullPonterException. When I remove the annotation, then I get the error below.
java.lang.NullPointerException
org.primefaces.component.chart.renderer.MeterGaugeRenderer.encodeData(MeterGaugeRenderer.java:33)
Below is my code and the full stack...
package ch.business.quickline.controller;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.ViewScoped;
import org.primefaces.model.chart.MeterGaugeChartModel;
import org.springframework.stereotype.Component;
import ch.business.quickline.viewservice.MitarbeiterGlobalService;
#ManagedBean
#Component
#ViewScoped
public class MeterGaugeChartView implements Serializable {
private MeterGaugeChartModel masterBewertungenIndividual;
private MeterGaugeChartModel selbstBewertungenIndividual;
private MeterGaugeChartModel masterBewertungenGlobal;
private MeterGaugeChartModel selbstBewertungenGlobal;
#ManagedProperty("#{mitarbeiterGlobalService}")
private MitarbeiterGlobalService mitarbeiterGlobalService;
public void init() {
createMeterGaugeModels();
}
public MeterGaugeChartModel getMasterBewertungenIndividual() {
return masterBewertungenIndividual;
}
public MeterGaugeChartModel getSelbstBewertungenIndividual() {
return selbstBewertungenIndividual;
}
public MeterGaugeChartModel getMasterBewertungenGlobal() {
return masterBewertungenGlobal;
}
public MeterGaugeChartModel getSelbstBewertungenGlobal() {
return selbstBewertungenGlobal;
}
private MeterGaugeChartModel initMeterGaugeModel() {
List<Number> intervals = new ArrayList<Number>() {{
add(1);
add(2);
add(3);
add(4);
add(5);
}
};
return new MeterGaugeChartModel(5, intervals);
}
public void createMeterGaugeModels() {
masterBewertungenIndividual = initMeterGaugeModel();
//masterBewertungenIndividual.setTitle("Masterbewertungen");
masterBewertungenIndividual.setGaugeLabel("Skill");
masterBewertungenIndividual.setValue(mitarbeiterGlobalService.getMasterBewertungIndividualAverage());
selbstBewertungenIndividual = initMeterGaugeModel();
//selbstBewertungenIndividual.setTitle("Selbstbewertungen");
selbstBewertungenIndividual.setGaugeLabel("Interesse");
selbstBewertungenIndividual.setValue(mitarbeiterGlobalService.getSelbstBewertungIndividualAverage());
masterBewertungenGlobal = initMeterGaugeModel();
//masterBewertungenGlobal.setTitle("Masterbewertungen");
masterBewertungenGlobal.setGaugeLabel("Skill");
masterBewertungenGlobal.setValue(mitarbeiterGlobalService.getMasterBewertungGlobalAverage());
selbstBewertungenGlobal = initMeterGaugeModel();
//selbstBewertungenGlobal.setTitle("Selbstbewertungen");
selbstBewertungenGlobal.setGaugeLabel("Interesse");
selbstBewertungenGlobal.setValue(mitarbeiterGlobalService.getSelbstBewertungGlobalAverage());
}
}
package ch.business.quickline.viewservice;
import java.math.BigDecimal;
import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ch.business.quickline.domain.MitarbeiterSkill;
import ch.business.quickline.service.MitarbeiterService;
import ch.business.quickline.service.MitarbeiterSkillService;
#ManagedBean(name = "mitarbeiterGlobalService")
#Component
#ApplicationScoped
public class MitarbeiterGlobalService {
#Autowired
private MitarbeiterService mitarbeiterService;
#Autowired
private MitarbeiterSkillService mitarbeiterSkillService;
private BigDecimal masterBewertungIndividualAverage;
private BigDecimal selbstBewertungIndividualAverage;
private Double masterBewertungGlobalAverage;
private Double selbstBewertungGlobalAverage;
public void init() {
masterBewertungIndividualAverage = mitarbeiterService.findByMitarbeiterId(1).getMitarbeiterMasterBewertungDurchschnitt();
selbstBewertungIndividualAverage = mitarbeiterService.findByMitarbeiterId(1).getMitarbeiterSelbstBewertungDurchschnitt();
masterBewertungGlobalAverage = retrieveMasterBewertungGlobalAverage();
selbstBewertungGlobalAverage = retrieveSelbstBewertungGlobalAverage();
}
public BigDecimal getMasterBewertungIndividualAverage() {
return masterBewertungIndividualAverage;
}
public void setMasterBewertungIndividualAverage(BigDecimal masterBewertungIndividualAverage) {
this.masterBewertungIndividualAverage = masterBewertungIndividualAverage;
}
public BigDecimal getSelbstBewertungIndividualAverage() {
return selbstBewertungIndividualAverage;
}
public void setSelbstBewertungIndividualAverage(
BigDecimal selbstBewertungIndividualAverage) {
this.selbstBewertungIndividualAverage = selbstBewertungIndividualAverage;
}
public Double getMasterBewertungGlobalAverage() {
return masterBewertungGlobalAverage;
}
public void setMasterBewertungGlobalAverage(Double masterBewertungGlobalAverage) {
this.masterBewertungGlobalAverage = masterBewertungGlobalAverage;
}
public Double getSelbstBewertungGlobalAverage() {
return selbstBewertungGlobalAverage;
}
public void setSelbstBewertungGlobalAverage(Double selbstBewertungGlobalAverage) {
this.selbstBewertungGlobalAverage = selbstBewertungGlobalAverage;
}
public Double retrieveMasterBewertungGlobalAverage() {
Double sum = 0.0;
for (MitarbeiterSkill skill : mitarbeiterSkillService.findAll()) {
sum = sum + skill.getMasterBewertung();
}
return sum / mitarbeiterSkillService.findAll().size();
}
public Double retrieveSelbstBewertungGlobalAverage() {
Double sum = 0.0;
for (MitarbeiterSkill interest : mitarbeiterSkillService.findAll()) {
sum = sum + interest.getSelbstBewertung();
}
return sum / mitarbeiterSkillService.findAll().size();
}
}
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<ui:composition template="/templates/default/template.xhtml">
<ui:define name="content">
<ui:insert>
<div class="ui-grid">
<div class="ui-grid-row">
<div class="ui-grid-col-6">
<p:chart type="metergauge" model="#{meterGaugeChartView.masterBewertungenGlobal}" style="width:400px;height:250px" />
</div>
<div class="ui-grid-col-6">
<p:chart type="metergauge" model="#{meterGaugeChartView.selbstBewertungenGlobal}" style="width:400px;height:250px" />
</div>
</div>
</div>
<div class="ui-grid ui-grid-responsive">
<div class="ui-grid-row">
<div class="ui-grid-col-6">
<p:dataList value="#{rankingDataList.mitarbeiterMasterBewertungRangliste}" var="mitarbeiter" type="ordered">
<f:facet name="header">
Top Mitarbeiter nach Masterbewertung
</f:facet>
#{mitarbeiter.mitarbeiterVorname}
#{mitarbeiter.mitarbeiterNachname}:
#{mitarbeiter.mitarbeiterMasterBewertungDurchschnitt}
</p:dataList>
</div>
<div class="ui-grid-col-6">
<p:dataList value="#{rankingDataList.mitarbeiterSelbstBewertungRangliste}" var="mitarbeiter" type="ordered">
<f:facet name="header">
Top Mitarbeiter nach Selbstbewertung
</f:facet>
#{mitarbeiter.mitarbeiterVorname}
#{mitarbeiter.mitarbeiterNachname}:
#{mitarbeiter.mitarbeiterSelbstBewertungDurchschnitt}
</p:dataList>
</div>
</div>
</div>
</ui:insert>
</ui:define>
</ui:composition>
</html>
Apr 25, 2015 12:10:21 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNUNG: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:skillmanager' did not find a matching property.
Apr 25, 2015 12:10:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: Server version: Apache Tomcat/7.0.59
Apr 25, 2015 12:10:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: Server built: Jan 28 2015 15:51:10 UTC
Apr 25, 2015 12:10:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: Server number: 7.0.59.0
Apr 25, 2015 12:10:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: OS Name: Linux
Apr 25, 2015 12:10:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: OS Version: 3.13.0-24-generic
Apr 25, 2015 12:10:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: Architecture: amd64
Apr 25, 2015 12:10:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: Java Home: /usr/lib/jvm/java-8-oracle/jre
Apr 25, 2015 12:10:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: JVM Version: 1.8.0_40-b25
Apr 25, 2015 12:10:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: JVM Vendor: Oracle Corporation
Apr 25, 2015 12:10:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: CATALINA_BASE: /home/fanatik/Documents/workspace-sts-3.6.3.SR1/.metadata/.plugins/org.eclipse.wst.server.core/tmp0
Apr 25, 2015 12:10:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: CATALINA_HOME: /home/fanatik/apache-tomcat-7.0.59
Apr 25, 2015 12:10:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: Command line argument: -Dcatalina.base=/home/fanatik/Documents/workspace-sts-3.6.3.SR1/.metadata/.plugins/org.eclipse.wst.server.core/tmp0
Apr 25, 2015 12:10:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: Command line argument: -Dcatalina.home=/home/fanatik/apache-tomcat-7.0.59
Apr 25, 2015 12:10:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: Command line argument: -Dwtp.deploy=/home/fanatik/Documents/workspace-sts-3.6.3.SR1/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps
Apr 25, 2015 12:10:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: Command line argument: -Djava.endorsed.dirs=/home/fanatik/apache-tomcat-7.0.59/endorsed
Apr 25, 2015 12:10:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: Command line argument: -Dfile.encoding=UTF-8
Apr 25, 2015 12:10:21 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFORMATION: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
Apr 25, 2015 12:10:21 AM org.apache.coyote.AbstractProtocol init
INFORMATION: Initializing ProtocolHandler ["http-bio-8080"]
Apr 25, 2015 12:10:21 AM org.apache.coyote.AbstractProtocol init
INFORMATION: Initializing ProtocolHandler ["ajp-bio-8009"]
Apr 25, 2015 12:10:21 AM org.apache.catalina.startup.Catalina load
INFORMATION: Initialization processed in 706 ms
Apr 25, 2015 12:10:21 AM org.apache.catalina.core.StandardService startInternal
INFORMATION: Starting service Catalina
Apr 25, 2015 12:10:21 AM org.apache.catalina.core.StandardEngine startInternal
INFORMATION: Starting Servlet Engine: Apache Tomcat/7.0.59
Apr 25, 2015 12:10:22 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFORMATION: validateJarFile(/home/fanatik/Documents/workspace-sts-3.6.3.SR1/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/skillmanager/WEB-INF/lib/el-api-2.2.1-b04.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
Apr 25, 2015 12:10:25 AM org.apache.catalina.startup.TaglibUriRule body
INFORMATION: TLD skipped. URI: http://mojarra.dev.java.net/mojarra_ext is already defined
Apr 25, 2015 12:10:25 AM org.apache.catalina.startup.TaglibUriRule body
INFORMATION: TLD skipped. URI: http://java.sun.com/jsf/core is already defined
Apr 25, 2015 12:10:25 AM org.apache.catalina.startup.TaglibUriRule body
INFORMATION: TLD skipped. URI:
http://java.sun.com/jsf/html
is already defined
Apr 25, 2015 12:10:25 AM org.apache.catalina.core.StandardContext addApplicationListener
INFORMATION: The listener "com.sun.faces.config.ConfigureListener" is already configured for this context. The duplicate definition has been ignored.
Apr 25, 2015 12:10:25 AM org.apache.catalina.core.ApplicationContext log
INFORMATION: Spring WebApplicationInitializers detected on classpath: [ch.business.quickline.config.WebAppInitializer#12297d72]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/fanatik/Documents/workspace-sts-3.6.3.SR1/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/skillmanager/WEB-INF/lib/slf4j-log4j12-1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/fanatik/Documents/workspace-sts-3.6.3.SR1/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/skillmanager/WEB-INF/lib/slf4j-simple-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
Apr 25, 2015 12:10:25 AM com.sun.faces.config.ConfigureListener contextInitialized
INFORMATION: Mojarra 2.2.0 ( 20130502-2118 https://svn.java.net/svn/mojarra~svn/tags/2.2.0#11930) für Kontext '/skillmanager' wird initialisiert.
Apr 25, 2015 12:10:25 AM com.sun.faces.spi.InjectionProviderFactory createInstance
INFORMATION: JSF1048: PostConstruct/PreDestroy-Annotationen vorhanden. Verwaltete Bean-Methoden, die mit diesen Annotationen markiert sind, lassen die entsprechenden Annotationen verarbeiten.
Apr 25, 2015 12:10:26 AM net.bootsfaces.listeners.AddResourcesListener <clinit>
INFORMATION: net.bootsfaces.listeners.AddResourcesListener ready for use.
Apr 25, 2015 12:10:27 AM org.primefaces.webapp.PostConstructApplicationEventListener processEvent
INFORMATION: Running on PrimeFaces 5.1
Apr 25, 2015 12:10:27 AM org.apache.catalina.core.ApplicationContext log
INFORMATION: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Apr 25, 2015 12:10:31 AM org.apache.coyote.AbstractProtocol start
INFORMATION: Starting ProtocolHandler ["http-bio-8080"]
Apr 25, 2015 12:10:31 AM org.apache.coyote.AbstractProtocol start
INFORMATION: Starting ProtocolHandler ["ajp-bio-8009"]
Apr 25, 2015 12:10:31 AM org.apache.catalina.startup.Catalina start
INFORMATION: Server startup in 9849 ms
Apr 25, 2015 12:10:34 AM com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException
SCHWERWIEGEND: Error Rendering View[/index.xhtml]
java.lang.NullPointerException
at org.primefaces.component.chart.renderer.MeterGaugeRenderer.encodeData(MeterGaugeRenderer.java:33)
at org.primefaces.component.chart.renderer.BasePlotRenderer.render(BasePlotRenderer.java:29)
at org.primefaces.component.chart.ChartRenderer.encodeScript(ChartRenderer.java:95)
at org.primefaces.component.chart.ChartRenderer.encodeEnd(ChartRenderer.java:67)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:924)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:176)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:894)
at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:79)
at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:66)
at org.primefaces.component.layout.LayoutUnitRenderer.encodeEnd(LayoutUnitRenderer.java:49)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:924)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:443)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Apr 25, 2015 12:10:34 AM org.apache.catalina.core.StandardWrapperValve invoke
SCHWERWIEGEND: Servlet.service() for servlet [Faces Servlet] in context with path [/skillmanager] threw exception [null] with root cause
java.lang.NullPointerException
at org.primefaces.component.chart.renderer.MeterGaugeRenderer.encodeData(MeterGaugeRenderer.java:33)
at org.primefaces.component.chart.renderer.BasePlotRenderer.render(BasePlotRenderer.java:29)
at org.primefaces.component.chart.ChartRenderer.encodeScript(ChartRenderer.java:95)
at org.primefaces.component.chart.ChartRenderer.encodeEnd(ChartRenderer.java:67)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:924)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:176)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:894)
at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:79)
at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:66)
at org.primefaces.component.layout.LayoutUnitRenderer.encodeEnd(LayoutUnitRenderer.java:49)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:924)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:443)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)

Spring, JPA,JSF - null pointer exception on the access to data

I write web application with spring, jpa and jsf support. In my xhtml web page is table(primefaces) and button, which refresh database. When I try click the button i get this:
gru 23, 2014 10:01:10 PM org.apache.catalina.core.AprLifecycleListenerinit INFO: The APR based Apache Tomcat Native library which allowsoptimal performance in production environments was not found on thejava.library.path: C:\ProgramFiles\Java\jdk1.7.0_45\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\oraclexe\app\oracle\product\11.2.0\server\bin;;C:\ProgramFiles (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLSClient\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\ProgramFiles (x86)\Windows Live\Shared;C:\Program Files\Intel\Intel(R)Management Engine Components\DAL;C:\Program Files\Intel\Intel(R)Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R)Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R)Management Engine Components\IPT;C:\Program Files (x86)\Intel\OpenCLSDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCLSDK\2.0\bin\x64;D:\maven\bin;.
gru 23, 2014 10:01:10 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING:[SetPropertiesRule]{Server/Service/Engine/Host/Context} Settingproperty 'source' to 'org.eclipse.jst.jee.server:SJM' did not find amatching property.
gru 23, 2014 10:01:11 PM org.apache.coyote.AbstractProtocol init INFO: InitializingProtocolHandler ["http-bio-8081"]
gru 23, 2014 10:01:11 PM org.apache.coyote.AbstractProtocol init INFO: InitializingProtocolHandler ["ajp-bio-8010"]
gru 23, 2014 10:01:11 PM org.apache.catalina.startup.Catalina load INFO: Initializationprocessed in 1193 ms
gru 23, 2014 10:01:11 PM org.apache.catalina.core.StandardService startInternal INFO: Startingservice Catalina
gru 23, 2014 10:01:11 PM org.apache.catalina.core.StandardEngine startInternal INFO: StartingServlet Engine: Apache Tomcat/7.0.56
gru 23, 2014 10:01:16 PM org.apache.catalina.core.ApplicationContext log INFO: No SpringWebApplicationInitializer types detected on classpath
gru 23, 2014 10:01:16 PM org.apache.catalina.core.ApplicationContext log INFO:Initializing Spring root WebApplicationContext
22:01:21,254 DEBUG FlowDefinitionRegistryImpl:100 - Registering flow definition'ServletContext resource [/WEB-INF/flows/main/main-flow.xml]' under id'main'
22:01:21,280 DEBUG ConditionalFlowExecutionListenerLoader:59 -Adding flow execution listenerorg.springframework.webflow.persistence.JpaFlowExecutionListener#16495871with criteria *
22:01:21,282 DEBUGConditionalFlowExecutionListenerLoader:59 - Adding flow executionlistenerorg.springframework.faces.webflow.FlowFacesContextLifecycleListener#294d6e25with criteria *
gru 23, 2014 10:01:21 PM com.sun.faces.config.ConfigureListener contextInitialized INFO:Initializing Mojarra 2.1.10 (-SNAPSHOT 20120625-1354) for context'/SJM'
gru 23, 2014 10:01:22 PM com.sun.faces.spi.InjectionProviderFactory createInstance INFO:JSF1048: PostConstruct/PreDestroy annotations present. ManagedBeansmethods marked with these annotations will have said annotationsprocessed.
gru 23, 2014 10:01:24 PM org.primefaces.webapp.PostConstructApplicationEventListenerprocessEvent INFO: Running on PrimeFaces 3.4
gru 23, 2014 10:01:24 PM org.apache.catalina.core.ApplicationContext log INFO: InitializingSpring FrameworkServlet 'Spring MVC Dispatcher Servlet'
gru 23, 2014 10:01:24 PM org.apache.coyote.AbstractProtocol start INFO: StartingProtocolHandler ["http-bio-8081"]
gru 23, 2014 10:01:24 PM org.apache.coyote.AbstractProtocol start INFO: StartingProtocolHandler ["ajp-bio-8010"]
gru 23, 2014 10:01:24 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 13692 ms
22:01:25,527 DEBUG FlowHandlerMapping:108 - Mapping requestwith URI '/SJM/app/main' to flow with id 'main'
22:01:25,539 DEBUGFlowExecutorImpl:135 - Launching new execution of flow 'main' withinput null
22:01:25,539 DEBUG FlowDefinitionRegistryImpl:59 - GettingFlowDefinition with id 'main'
22:01:25,555 DEBUG DefaultFlowHolder:83- Assembling the flow for the first time
22:01:25,664 DEBUG FlowExecutionImplFactory:78 - Creating new execution of 'main'
22:01:25,680 DEBUG ConditionalFlowExecutionListenerLoader:87 - Loaded[2] of possible 2 listeners for this execution request for flow'main', the listeners to attach are list[org.springframework.webflow.persistence.JpaFlowExecutionListener#16495871,org.springframework.faces.webflow.FlowFacesContextLifecycleListener#294d6e25]
22:01:25,680 DEBUG FlowExecutionImpl:215 - Starting in org.springframework.webflow.mvc.servlet.MvcExternalContext#6f98bf1with input null
22:01:25,758 DEBUG ViewState:189 - Entering state'welcome' of flow 'main' 22:01:25,774 DEBUGSessionBindingConversationManager:78 - Putting conversation attribute'name' with value main
22:01:25,774 DEBUG SessionBindingConversationManager:78 - Putting conversation attribute'caption' with value null
22:01:25,774 DEBUG SessionBindingConversationManager:78 - Putting conversation attribute'description' with value null
22:01:25,774 DEBUG SessionBindingConversationManager:78 - Putting conversation attribute'flowExecutionSnapshotGroup' with value org.springframework.webflow.execution.repository.impl.SimpleFlowExecutionSnapshotGroup#67079bb1
22:01:25,774 DEBUG FlowExecutionImpl:419 - Assigned key e1s1
22:01:25,774 DEBUG SessionBindingConversationManager:67 - Lockingconversation 1
22:01:25,774 DEBUG DefaultFlowExecutionRepository:121 -Putting flow execution '[FlowExecutionImpl#277b5201 flow = 'main',flowSessions = list[[FlowSessionImpl#1144d3e7 flow = 'main', state ='welcome', scope = map['viewScope' -map[[empty]]]]]]' intorepository
22:01:25,789 DEBUG DefaultFlowExecutionRepository:128 -Adding snapshot to group with id 1
22:01:25,789 DEBUG SessionBindingConversationManager:78 - Putting conversation attribute'scope' with value map['flashScope' -map['messagesMemento' ->map[[null] -list[[empty]]]]]
22:01:25,789 DEBUG SessionBindingConversationManager:99 - Unlocking conversation 1
22:01:25,789 DEBUG FlowHandlerAdapter:367 - Sending flow executionredirect to '/SJM/app/main?execution=e1s1'
22:01:25,961 DEBUG FlowHandlerMapping:108 - Mapping request with URI '/SJM/app/main' toflow with id 'main'
22:01:25,961 DEBUG FlowExecutorImpl:161 - Resumingflow execution with key 'e1s1 22:01:25,961 DEBUGSessionBindingConversationManager:67 - Locking conversation 1
22:01:25,961 DEBUG DefaultFlowExecutionRepository:106 - Getting flowexecution with key 'e1s1'
22:01:25,961 DEBUG FlowDefinitionRegistryImpl:59 - Getting FlowDefinition with id 'main'
22:01:25,961 DEBUG ConditionalFlowExecutionListenerLoader:87 - Loaded[2] of possible 2 listeners for this execution request for flow'main', the listeners to attach arelist[org.springframework.webflow.persistence.JpaFlowExecutionListener#16495871,org.springframework.faces.webflow.FlowFacesContextLifecycleListener#294d6e25]
22:01:25,961 DEBUG FlowExecutionImpl:249 - Resuming inorg.springframework.webflow.mvc.servlet.MvcExternalContext#21d18342
22:01:26,519 DEBUG ViewState:289 - Rendering + [JSFView ='/WEB-INF/flows/main/welcome.xhtml']
22:01:26,519 DEBUG ViewState:290- Flash scope = map[[empty]]
22:01:26,520 DEBUG ViewState:291 - Messages = [DefaultMessageContext#60573326 sourceMessages = map[[null]-list[[empty]]]]
22:01:26,631 DEBUG DefaultFlowExecutionRepository:121 - Putting flow execution'[FlowExecutionImpl#3fcc8fc7 flow = 'main', flowSessions =list[[FlowSessionImpl#ef3728a flow = 'main', state = 'welcome', scope= map['viewScope' -map['flowSerializedViewState' -[FlowSerializedView#10e4c9b1 viewId ='/WEB-INF/flows/main/welcome.xhtml']]]]]]' into repository
22:01:26,636 DEBUG DefaultFlowExecutionRepository:128 - Addingsnapshot to group with id 1
22:01:26,636 DEBUG SessionBindingConversationManager:78 - Putting conversation attribute'scope' with value map['flashScope' -map['messagesMemento' ->map[[empty]]]] 22:01:26,637 DEBUG SessionBindingConversationManager:99- Unlocking conversation 1
22:01:28,327 DEBUG FlowHandlerMapping:108 - Mapping request with URI '/SJM/app/main' to flow with id 'main'
22:01:28,327 DEBUG FlowExecutorImpl:161 - Resuming flow execution withkey 'e1s1
22:01:28,327 DEBUG SessionBindingConversationManager:67 -Locking conversation 1
22:01:28,343 DEBUG DefaultFlowExecutionRepository:106 - Getting flow execution with key'e1s1'
22:01:28,343 DEBUG FlowDefinitionRegistryImpl:59 - GettingFlowDefinition with id 'main'
22:01:28,345 DEBUG ConditionalFlowExecutionListenerLoader:87 - Loaded [2] of possible 2listeners for this execution request for flow 'main', the listeners to attach are list [org.springframework.webflow.persistence.JpaFlowExecutionListener#16495871,org.springframework.faces.webflow.FlowFacesContextLifecycleListener#294d6e25]
22:01:28,345 DEBUG FlowExecutionImpl:249 - Resuming inorg.springframework.webflow.mvc.servlet.MvcExternalContext#19f6d704
22:01:28,360 DEBUG FlowExecutionImpl:590 - Attempting to handle[org.springframework.webflow.execution.FlowExecutionException:Exception thrown in state 'welcome' of flow 'main'] with root cause[java.lang.NullPointerException]
22:01:28,360 DEBUGFlowExecutionImpl:611 - Rethrowing unhandled flow execution exception22:01:28,360 DEBUG SessionBindingConversationManager:99 - Unlockingconversation 1
gru 23, 2014 10:01:28 PMorg.apache.catalina.core.StandardWrapperValve invoke SEVERE:Servlet.service() for servlet [Spring MVC Dispatcher Servlet] incontext with path [/SJM] threw exception [Request processing failed;nested exception isorg.springframework.webflow.execution.FlowExecutionException:Exception thrown in state 'welcome' of flow 'main'] with root causejava.lang.NullPointerException
at com.sjm.dao.ModelDao.findByStartTime(ModelDao.java: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.apache.el.parser.AstValue.invoke(AstValue.java:278)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:273)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
at org.springframework.faces.webflow.FlowActionListener.processAction(FlowActionListener.java:81)
at org.springframework.faces.model.SelectionTrackingActionListener.processAction(SelectionTrackingActionListener.java:55)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
at org.springframework.faces.webflow.FlowLifecycle.invokePhase(FlowLifecycle.java:127)
at org.springframework.faces.webflow.FlowLifecycle.execute(FlowLifecycle.java:70)
at org.springframework.faces.webflow.JsfView.processUserEvent(JsfView.java:120)
at org.springframework.webflow.engine.ViewState.handleEvent(ViewState.java:226)
at org.springframework.webflow.engine.ViewState.resume(ViewState.java:196)
at org.springframework.webflow.engine.Flow.resume(Flow.java:545)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:258)
at org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:169)
at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:183)
at org.springframework.faces.webflow.JsfFlowHandlerAdapter.handle(JsfFlowHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$Wrappingrunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:744)
NawNeHier.java
package com.sjm.model;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
#Entity
#Table(name="NAW_NE_HIER")
public class NawNeHier implements Serializable {
private static final long serialVersionUID = 1L;
#Id
private int hierId;
private int parentHierId;
private String type;
private String name;
private String display_name;
public NawNeHier() {
}
public int getHierId() {
return hierId;
}
public void setHierId(int hierId) {
this.hierId = hierId;
}
public int getParentHierId() {
return parentHierId;
}
public void setParentHierId(int parentHierId) {
this.parentHierId = parentHierId;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDisplay_name() {
return display_name;
}
public void setDisplay_name(String display_name) {
this.display_name = display_name;
}
}
ModelDao.java
package com.sjm.dao;
import javax.faces.bean.ManagedBean;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import com.sjm.model.NawNeHier;
#ManagedBean(name="modelDao")
public class ModelDao {
#PersistenceContext
private EntityManager entityManager;
private NawNeHier nawNeHier;
public ModelDao () {}
public NawNeHier getNawNeHier() {
return nawNeHier;
}
public void setNawNeHier(NawNeHier nawNeHier) {
this.nawNeHier = nawNeHier;
}
public EntityManager getEntityManager() {
return entityManager;
}
public void setEntityManager(EntityManager entityManager) {
this.entityManager = entityManager;
}
public void findByStartTime() {
String jpql = "SELECT n FROM NAW_NE_HIER n";
this.nawNeHier = entityManager.createQuery(jpql, NawNeHier.class).getSingleResult();
}
}
index.xhtml
<h:form id="myform">
<p:commandButton value="Count" action="#{modelDao.findByStartTime}" update="dataTable"/>
<p:dataTable id="dataTable" var="nawNeHier" value="#{modelDao.nawNeHier}">
<p:column headerText="hierId">
<h:outputText value="#{nawNeHier.hierId}" />
</p:column>
<p:column headerText="parentHierId">
<h:outputText value="#{nawNeHier.parentHierId}" />
</p:column>
<p:column headerText="type">
<h:outputText value="#{nawNeHier.type}" />
</p:column>
<p:column headerText="name">
<h:outputText value="#{nawNeHier.name}" />
</p:column>
<p:column headerText="display_name">
<h:outputText value="#{nawNeHier.display_name}" />
</p:column>
</p:dataTable>
</h:form>

Using Grizzly as the test container for dropwizard resources

I am trying to get this GrizzlyResourceTest.javaworking with dropwizard v0.6.1. The reason I want to use grizzly as the test container is because InMemoryTestContainer does not support Resource with injectable constructor, see this issue in details InMemoryTestContainer does not support Resource with injectable constructor
Since com.yammer.dropwizard.json.Json and com.yammer.dropwizard.bundles.JavaBundle are not in v0.6.1 anymore, I simply just comment out the lines related to these class.
#Before
public void setUpJersey() throws Exception {
setUpResources();
this.test = new JerseyTest(new GrizzlyWebTestContainerFactory()) {
#Override
protected AppDescriptor configure() {
ClientConfig config = new DefaultClientConfig();
// taken from DropwizardResourceConfig
config.getFeatures().put(ResourceConfig.FEATURE_DISABLE_WADL, Boolean.TRUE);
config.getSingletons().add(new LoggingExceptionMapper<Throwable>() { }); // create a subclass to pin it to Throwable
config.getClasses().add(InstrumentedResourceMethodDispatchAdapter.class);
config.getClasses().add(CacheControlledResourceMethodDispatchAdapter.class);
for (Class<?> provider : providers) {
config.getClasses().add(provider);
}
config.getSingletons().addAll(singletons);
return new WebAppDescriptor.Builder("com.example.helloworld.resources").clientConfig(config).build();
}
};
test.setUp();
}
My case is more complex since I have HttpServletRequest injected to my resource class like myMethod(#Context HttpServletRequest request). So here I just use PersonResource under dropwizard-example.
QuickTest.java looks like:
public class QuickTest extends GrizzlyResourceTest{
#Test
public void testGrizzly() throws Exception {
ClientResponse rsp = client()
.resource("http://localhost:9998/people").get(ClientResponse.class);
Assert.assertEquals(200, rsp.getStatus());
}
#Override
protected void setUpResources() throws Exception {
}
}
When I run QuickTest, The error I am getting from Console is this:
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
Mar 14, 2013 7:14:11 PM com.sun.jersey.test.framework.spi.container.grizzly2.web.GrizzlyWebTestContainerFactory$GrizzlyWebTestContainer <init>
INFO: Creating Grizzly2 Web Container configured at the base URI http://localhost:9998/
Mar 14, 2013 7:14:11 PM org.glassfish.grizzly.http.server.NetworkListener start
INFO: Started listener bound to [localhost:9998]
Mar 14, 2013 7:14:11 PM org.glassfish.grizzly.http.server.HttpServer start
INFO: [HttpServer] Started.
Mar 14, 2013 7:14:11 PM org.glassfish.grizzly.servlet.WebappContext deploy
INFO: Starting application [TestContext] ...
Mar 14, 2013 7:14:11 PM org.glassfish.grizzly.servlet.WebappContext initServlets
INFO: [TestContext] Servlet [com.sun.jersey.spi.container.servlet.ServletContainer] registered for url pattern(s) [[/*]].
Mar 14, 2013 7:14:11 PM org.glassfish.grizzly.servlet.WebappContext deploy
INFO: Application [TestContext] is ready to service requests. Root: [].
Mar 14, 2013 7:14:11 PM com.sun.jersey.spi.inject.Errors processErrorMessages
SEVERE: The following errors and warnings have been detected with resource and/or provider classes:
SEVERE: Missing dependency for field: private javax.servlet.http.HttpServletRequest com.yammer.dropwizard.jersey.LoggingExceptionMapper.request
Any ideas?

Resources