getting nullPointerException with commons-httpclient and EWSJavaAPI - web-services

i am using EWS Java API 1.1.5
and i am trying to bind the service to inbox folder as follows:
ExchangeService service = new ExchangeService();
ExchangeCredentials credentials = new WebCredentials(email, password);
service.setCredentials(credentials);
service.setUrl(new java.net.URI("https://" + host
+ "/EWS/Exchange.asmx"));
Folder inbox = Folder.bind(service, WellKnownFolderName.Inbox);
i call the above code from jsp page.
but i am getting NullPointerException:
java.lang.NullPointerException
at org.apache.commons.httpclient.HttpMethodBase.getStatusCode(HttpMethodBase.java:570)
at microsoft.exchange.webservices.data.HttpClientWebRequest.getResponseCode(Unknown Source)
at microsoft.exchange.webservices.data.ServiceRequestBase.validateAndEmitRequest(Unknown Source)
at microsoft.exchange.webservices.data.SimpleServiceRequestBase.internalExecute(Unknown Source)
at microsoft.exchange.webservices.data.MultiResponseServiceRequest.execute(Unknown Source)
at microsoft.exchange.webservices.data.ExchangeService.bindToFolder(Unknown Source)
at microsoft.exchange.webservices.data.ExchangeService.bindToFolder(Unknown Source)
at microsoft.exchange.webservices.data.Folder.bind(Unknown Source)
at microsoft.exchange.webservices.data.Folder.bind(Unknown Source)
at com.xeno.phonesuite.web.Mail.Mail.readInbox(Mail.java:49)
at org.apache.jsp.mail.inbox_jsp._jspService(inbox_jsp.java:79)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
i am using commons-httpclient 3.1.
this exception occurs when running the code from a web project that runs on tomcat 7, but when running the code from desktop application it works fine.
UPDATE:
1- httpclient debugs before exception:
2012-11-07/16:37:32.425 [http-bio-8080-exec-2] DEBUG Set parameter http.auth.scheme-priority = [NTLM, Basic, Digest]
2012-11-07/16:37:32.425 [http-bio-8080-exec-2] DEBUG enter HttpState.setCredentials(AuthScope, Credentials)
2012-11-07/16:37:32.425 [http-bio-8080-exec-2] DEBUG Set parameter http.socket.timeout = 100000
2012-11-07/16:37:32.425 [http-bio-8080-exec-2] DEBUG Set parameter http.connection.timeout = 100000
2012-11-07/16:37:32.425 [http-bio-8080-exec-2] DEBUG enter PostMethod.clearRequestBody()
2012-11-07/16:37:32.425 [http-bio-8080-exec-2] DEBUG enter EntityEnclosingMethod.clearRequestBody()
2- EWS trace before exception:
<Trace Tag="EwsRequestHttpHeaders" Tid="33" Time="2012-11-07 15:14:24Z">
POST /EWS/Exchange.asmx HTTP/1.1
Content-type : text/xml; charset=utf-8
Accept-Encoding : gzip,deflate
Keep-Alive : 300
User-Agent : ExchangeServicesClient/0.0.0.0
Connection : Keep-Alive
Accept : text/xml
</Trace>
and its supposed to send then the following request:
<Trace Tag="EwsRequest" Tid="1" Time="2012-11-07 15:18:19Z">
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"><soap:Header><t:RequestServerVersion Version="Exchange2010_SP1"></t:RequestServerVersion></soap:Header><soap:Body><m:FindItem Traversal="Shallow"><m:ItemShape><t:BaseShape>AllProperties</t:BaseShape></m:ItemShape><m:IndexedPageItemView MaxEntriesReturned="5" Offset="0" BasePoint="Beginning"></m:IndexedPageItemView><m:ParentFolderIds><t:DistinguishedFolderId Id="inbox"></t:DistinguishedFolderId></m:ParentFolderIds></m:FindItem></soap:Body></soap:Envelope>
</Trace>
but it doesn't, and it throws the exception instead.
UPDATE2: forgot to mention that i am using Cisco jtapi 6.1 library for dealing with IP phones, and after googling i found that the following issue is resolved in latest version of jtapi:
CSCtz31973 : Ews request printed is Null in case of StreamingSubscriptionRequest
what i understand is that the EWS requests is null (cannot send microsoft webservices requests), so i will update the jtapi library and give it a try.
please advise how to fix it.

Problem solved after upgrading the jars for jaxws-rt and saaj-api as follows:
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.2.7</version>
</dependency>
<dependency>
<groupId>javax.xml.soap</groupId>
<artifactId>saaj-api</artifactId>
<version>1.3.4</version>
</dependency>

Related

Indexing doc/pdf/docx file into solr using ContentStreamUpdateRequest

Hi I am here using Solr 4.7.2 for indexing the document.
Using ContentStreamUpdateRequest of solrj I am trying to index a file in Solr but while
I am sending a file path and unique id field as an input using UI
In action class while sending the object of ContentStreamUpdateRequest passing parameter to solrServer object
i.e
SolrServer solrServer = ..;
solrServer.request(contentStreamUpdateRequest);
I am getting following error
Exception:
org.apache.solr.client.solrj.SolrServerException
Exception message:
error reading streams
Exception trace:
at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:382)
at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:199)
at com.adastra.candidate.search.solr.action.SolrUpdateAction.aaaExecute(SolrUpdateAction.java:49)
at com.adastra.base.action.BaseAction.execute(BaseAction.java:181)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
at java.lang.Thread.run(Unknown Source)
Can please suggest me in fixing it.
I think that in version 4.7.2 streaming is disabled by default and you have to enable it in file solrconfig.xml
change
<requestParsers enableRemoteStreaming="false"
to
<requestParsers enableRemoteStreaming="true"
Also, have a look at the documentation
http://wiki.apache.org/solr/SolrSecurity#Streaming_Consideration
Let me know if this fixed the issue. Be aware of security when enabling remote streaming.

WSO2 : RAMPARTUTIL throwing null pointer execption

I have created a web services with RAMPART implementation.
Flow of the Service :
Sender -> Sign Message Using His private key -> Encrypt Message using Server public Key -> sends to Receiver
Receiver -> authenticate message using sender's Public key -> decrypts Message using his private key -> processes the information.
Issue:
Client is Signing & Encrypting Message & sent to server
Server is authenticating & decypting the message successfully.
Now,
post decrypting the message the server processes the values
& has to respond back to client the status.
on return, I am getting following error:
SEVERE: Servlet.service() for servlet [AxisServlet] in context with path [/webService] threw exception
java.lang.NullPointerException
org.apache.rampart.util.RampartUtil.setKeyIdentifierType(RampartUtil.java:1389)
org.apache.rampart.builder.BindingBuilder.getSignatureBuilder(BindingBuilder.java:266)
org.apache.rampart.builder.BindingBuilder.getSignatureBuilder(BindingBuilder.java:250)
org.apache.rampart.builder.AsymmetricBindingBuilder.doSignature(AsymmetricBindingBuilder.java:760)
org.apache.rampart.builder.AsymmetricBindingBuilder.doSignBeforeEncrypt(AsymmetricBindingBuilder.java:417)
org.apache.rampart.builder.AsymmetricBindingBuilder.build(AsymmetricBindingBuilder.java:88)
org.apache.rampart.MessageBuilder.build(MessageBuilder.java:147)
org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:65)
org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
org.apache.axis2.engine.Phase.invoke(Phase.java:313)
org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262)
org.apache.axis2.engine.AxisEngine.sendFault(AxisEngine.java:516)
org.apache.axis2.transport.http.AxisServlet.handleFault(AxisServlet.java:433)
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:216)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:550)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:380)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Also, i have implemented the service without RAMPART, in that case the response is successful.
Please advice, I am struggling with from past 2 days..
not able to understand what m i missing since Request decryption is successful, but response is throwing exception.
i added the below block and the error was resolve:
<sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:MustSupportRefKeyIdentifier/>
<sp:MustSupportRefIssuerSerial/>
</wsp:Policy>
</sp:Wss10>

P6SpyDriver cannot be cast to javax.sql.XADataSource exception while trying to configure P6Spy 2.0 with xa-datasource using Jboss AS 7 and potgres

P6spy v2 has a support for xa datasources - P6spy on github
In my jboss AS 7 standalone-full-ha.xml, i have the following datasource configurations.
<xa-datasource jndi-name="java:jboss/datasources/MyDS" pool-name="v" enabled="true" use-java-context="true" use-ccm="false">
<xa-datasource-property name="ServerName">
localhost
</xa-datasource-property>
<xa-datasource-property name="PortNumber">
5432
</xa-datasource-property>
<xa-datasource-property name="DatabaseName">
MyDB
</xa-datasource-property>
<driver>p6spy</driver>
<xa-pool>
<min-pool-size>50</min-pool-size>
<max-pool-size>150</max-pool-size>
<is-same-rm-override>false</is-same-rm-override>
<interleaving>false</interleaving>
<pad-xid>false</pad-xid>
<wrap-xa-resource>false</wrap-xa-resource>
</xa-pool>
<security>
<user-name>postgres</user-name>
<password>postgres</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</xa-datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="postgresql" module="org.postgresql">
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
</driver>
<driver name="p6spy" module="com.p6spy">
<xa-datasource-class>com.p6spy.engine.spy.P6SpyDriver</xa-datasource-class>
</driver>
</drivers>
After that, i put the p6spy-2.0.1.jar in jboss\modules\com\p6spy\main folder and also defined the module.xml file. Also, i put the spy.properties file alongwith the P6spy.jar and in that added the line to enable postgres driver
realdriver=org.postgresql.Driver
With all these settings, when i start my server, i get the following exception.
Throwable while attempting to get a new connection: null: javax.resource.ResourceException: Could not create connection
at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.getXAManagedConnection(XAManagedConnectionFactory.java:447)
at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:385)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:761)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:343)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:397)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:329)
at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)
at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:129)
at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:67) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcServicesImpl.java:253) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:119) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:71) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2270) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2266) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1735) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_40]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_40]
at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_40]
Caused by: java.lang.ClassCastException: com.p6spy.engine.spy.P6SpyDriver cannot be cast to javax.sql.XADataSource
at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.getXADataSource(XAManagedConnectionFactory.java:553)
at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.getXAManagedConnection(XAManagedConnectionFactory.java:430)
... 30 more
At this step i am clueless as to how should i make it work.
Edit:
As per quintonm's reply, i used com.p6spy.engine.spy.P6ConnectionPoolDataSource class which implements XADatasource. But now i am getting the following exception.
Caused by: javax.resource.ResourceException: Could not find accessor on XADataSource:
at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.getXADataSource(XAManagedConnectionFactory.java:629)
at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.getXAManagedConnection(XAManagedConnectionFactory.java:430)
... 30 more
Caused by: java.lang.NoSuchMethodException: com.p6spy.engine.spy.P6ConnectionPoolDataSource.setDatabaseName(java.lang.String)
at java.lang.Class.getMethod(Class.java:1655) [rt.jar:1.7.0_40]
at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.getXADataSource(XAManagedConnectionFactory.java:597)
Also, following the generic instructions stated in P6spy's documentation, i used the 'RealDataSource' property in xa-datasource-properties but it then says no such property exist.
The problem that you are currently facing is that JBoss is expecting you to use a class that implements the Datasource interface in xa-datasource-class. For the P6Spy driver definition, you are using P6SpyDriver which implements java.sql.Driver. Instead of using P6SpyDriver, you want to use com.p6spy.engine.spy.P6ConnectionPoolDataSource.
P6Spy's support for DataSource implementations in JNDI is a little different than using a Driver class. Instead of modifying the JDBC URL, you must setup a second JDNI DataSource. The one that the application connects to will be the P6Spy DataSource. That DataSource will be a proxy to the real data source. The instructions for setting this up are be found here.
Note: The instructions say that you should use P6DataSource. However, since you need XA support, you will need to use P6ConnectionPoolDataSource.
For a better understanding of how this works, you can take a look at the test for XADataSources - XADataSourceTest
If you have any problems getting this to work, just post a message to p6spy-users#googlegroups.com or enter an issue
well, after the update of the question, your config should look like this. Didn't give it a test try, but in general, you need to proxy your existing one (postgres one) via p6spy:
<xa-datasource jndi-name="java:jboss/datasources/MyDSReal" pool-name="v" enabled="true" use-java-context="true" use-ccm="false">
<xa-datasource-property name="ServerName">
localhost
</xa-datasource-property>
<xa-datasource-property name="PortNumber">
5432
</xa-datasource-property>
<xa-datasource-property name="DatabaseName">
MyDB
</xa-datasource-property>
<driver>postgresql</driver>
<xa-pool>
<min-pool-size>50</min-pool-size>
<max-pool-size>150</max-pool-size>
<is-same-rm-override>false</is-same-rm-override>
<interleaving>false</interleaving>
<pad-xid>false</pad-xid>
<wrap-xa-resource>false</wrap-xa-resource>
</xa-pool>
<security>
<user-name>postgres</user-name>
<password>postgres</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</xa-datasource>
<xa-datasource jndi-name="java:jboss/datasources/MyDS" pool-name="v" enabled="true" use-java-context="true" use-ccm="false">
<driver>p6spy</driver>
<xa-pool>
<min-pool-size>50</min-pool-size>
<max-pool-size>150</max-pool-size>
<is-same-rm-override>false</is-same-rm-override>
<interleaving>false</interleaving>
<pad-xid>false</pad-xid>
<wrap-xa-resource>false</wrap-xa-resource>
</xa-pool>
<security>
<user-name>postgres</user-name>
<password>postgres</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</xa-datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="postgresql" module="org.postgresql">
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
</driver>
<driver name="p6spy" module="com.p6spy">
<xa-datasource-class>com.p6spy.engine.spy.P6ConnectionPoolDataSource</xa-datasource-class>
</driver>
</drivers>
Moreover I think you don't need spy.properties file if you're OK with default config. As RealDriver property would be needed if going the driver way (not the datasource one as you do now).
UPDATE:
removed section reported as problematic:
<xa-datasource-property name="RealDataSource">
java:jboss/datasources/MyDSReal
</xa-datasource-property>
if that is a problem in the DS config => let's configure it in a different way, you can go for any of available:
System properties
Environment variables or
spy.properties
where you need to set:
realdatasource=java:jboss/datasources/MyDSReal
UPDATE 2:
I gave it a test try and it seems p6spy doesn't support the XA Datasources for the JBoss / Wildfly (yet). For more details, see the official docs: http://p6spy.github.io/p6spy/2.0/install.html

Error in getting the tenant status

I have an instance of Stratos 1.5.1 running. After stratos sits over night without having been interacted with I get the following message on login to Identity Server
And I have added the autoReconnect to true both in the url call and in the property tag of user-mgt.xml
If anybody has an idea why the autoReconnect is not working that would be great. Thanks.
[2012-04-09 07:48:04,801] ERROR {org.wso2.carbon.user.core.tenant.TenantManager} - Error in getting the tenant status with tenant id: 2.
[2012-04-09 07:48:04,802] ERROR {org.wso2.carbon.identity.sso.saml.processors.AuthnRequestProcessor} - Error processing the authentication request
org.wso2.carbon.user.core.UserStoreException: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 331,971,492 milliseconds ago. The last packet sent successfully to the server was 331,971,492 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
at org.wso2.carbon.user.core.tenant.JDBCTenantManager.isTenantActive(JDBCTenantManager.java:444)
at org.wso2.carbon.identity.sso.saml.processors.AuthnRequestProcessor.process(AuthnRequestProcessor.java:91)
at org.wso2.carbon.identity.sso.saml.SAMLSSOService.authenticate(SAMLSSOService.java:78)
at sun.reflect.GeneratedMethodAccessor55.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
at org.wso2.carbon.core.transports.CarbonServlet.doPost(CarbonServlet.java:199)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(ServletRegistration.java:90)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:111)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.wso2.carbon.bridge.BridgeServlet.service(BridgeServlet.java:155)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.wso2.carbon.server.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:154)
at org.wso2.carbon.server.TomcatServer$1.invoke(TomcatServer.java:245)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399)
at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:396)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:356)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1534)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
I followed instructions at
http://www.lahiru.org/2010/07/keep-live-connection-in-wso2-products.html
to correct this problem.
What this says to do is keep the mysql connection available. This required that i add these attributes
wait_timeout=259200
interactive_timeout=259200
and values to the /etc/my.conf file. I restarted and then waited 24 hours to verify and tried logging in again and this time it worked.

problem in using jersey client library in calling rest web services

i have a servlet which calls a rest web service using jersey client framework, here's the client code -
response.setContentType("application/json");
String adCategoryId = request.getParameter("adCategoryId");
String requirement = request.getParameter("requirement");
Client client = Client.create();
WebResource wr = client.resource("http://localhost:8080/com.pandora.services/service");
String adResult = wr.path("search-ad").path(requirement).path(adCategoryId).get(String.class);
the code on the service side is this -
#Path("/service")
public class Service {
#GET
#Path("/search-ad/{need}/{query}")
public String searchAd(#PathParam("need") String requirement,#PathParam("query") String id)
{
System.out.println("inside services");
String adResult = "";
AdServiceProvider ad = new AdServiceProviderImpl();
List<AdBean> adBean = ad.getAdById(Long.parseLong(id.trim()),requirement);
adResult = gson.toJson(adBean);
System.out.println(adResult);
return adResult;
}
}
however when i make the call.. i get the following error - Updated
Servlet.service() for servlet Resteasy threw exception
java.lang.NullPointerException
at org.jboss.resteasy.plugins.server.servlet.HttpServletInputMessage.(HttpServletInputMessage.java:60)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.createHttpRequest(HttpServletDispatcher.java:71)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.createResteasyHttpRequest(HttpServletDispatcher.java:60)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:197)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
Jan 14, 2011 9:58:05 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet test threw exception
com.sun.jersey.api.client.UniformInterfaceException: GET http://localhost:8080/com.pandora.services/service/hello returned a response status of 500
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:565)
at com.sun.jersey.api.client.WebResource.get(WebResource.java:182)
at com.pandora.client.servlets.test.doPost(test.java:45)
at com.pandora.client.servlets.test.doGet(test.java:33)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
Thanks...
Just two days ago the was a similar question regarding Apache Wink.
The root cause of your problem: media type in your request is incorrect. It should be */* and not just *. The exception is very clear about that.
In the latest version of Wink, it became more forgivable about the incorrect formats of the media type. I don't know what about Jersey. But IMO it's better to fix the root problem.
My guess that the incorrect header in your case it "Accept". You can verify it using any HTTP Sniffer (e.g. Fiddler). So if you set the correct Accept header on your request, it should fix the problem.