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 - jpa-2.0

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

Related

There was and error downloading 'https://$metadata'. The request failed with http status 403: Forbidden - XAMARIN WEB REFERENCE WITH HTTPS

I managed to create a web service with self signed SSL through IIS. It's settings at first are set to Client Certificate to none and none required SSL. It is accessible by that time threw web browser and mobile web reference.
Web Browser
Xamarin Web Reference
But when I set the SSL settings to required, it is now forbidden in both. What am I missing in settings for SSL Configuration?
SSL Settings Thru IIS
Web Browser Forbidden Access
Xamarin Web Reference Forbidden Access
WebConfig
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="constring" providerName="System.Data.SqlClient" connectionString="Data Source = source;Initial Catalog = dbname; User ID = user; Password = pw" />
</connectionStrings>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation targetFramework="4.5" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding maxReceivedMessageSize="10485760" name="SecureHttpBinding">
<readerQuotas maxStringContentLength="10485760"></readerQuotas>
<security mode="Transport">
<transport clientCredentialType="None"></transport>
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
To access web service via HTTPS in web browser, I followed this link for creating temporary client certificate but I changed the step #5 to this command
makecert -sk MyKeyName -iv RootCaClientTest.pvk -n "CN=tempClientcert" -ic RootCaClientTest.cer -sr localmachine -ss my -sky exchange -pe
I changed the currentuser to localmachine and signature to exchange so that it will be in personal certificate store. When you access the site again, it will ask for client certificate and you can choose it to proceed.
For the main problem to access the service in visual studio xamarin via web reference (which is forbidden somehow).
I found this link to solve the forbidden problem. You can see the second post of (c)MarkoOkram for the solution.
"I am solved problem by saving web browser .wsdl and .xsd files on file system, change reference in those files to matching files. Than i succesfully add reference in visual studio to that file system .wsdl file." -(c) MarkoOkram
I downloaded the file WSDL and XSDs written in WSDL then retarget the filepath to their respective directories and it's done.
update: I also tried to import singleWSDL and it works without editing for xsd's

How to create a postgresql xa datsource in wso2esb

how to manage the transactions in wso2esb or wso2dss
we have option to create a datasource in wso2esb.While i am creating external datasource with xadatasource but its unable to create its giving issue i created with below configuration
Data Source Type*=RDBMS
Name*=USCProduction
Data Source Provider*=External Data Source
Data Source Class Name*=org.postgresql.xa.PGXADataSource
Data Source Properties
====================
url=jdbc:postgresql://localhost:5432/USCProduction
user=admin
password=admin
bbut its unable to create giving error like this
ERROR: Error in creating external data source: org.postgresql.xa.PGXADataSource
ERROR - DataSourceRepository Error in creating external data source: org.postgresql.xa.PGXADataSource
org.wso2.carbon.ndatasource.common.DataSourceException: Error in creating external data source: org.postgresql.xa.PGXADataSource
at org.wso2.carbon.ndatasource.rdbms.utils.RDBMSDataSourceUtils.handleExternalDataSource(RDBMSDataSourceUtils.java:323)
at org.wso2.carbon.ndatasource.rdbms.utils.RDBMSDataSourceUtils.createPoolConfiguration(RDBMSDataSourceUtils.java:283)
at org.wso2.carbon.ndatasource.rdbms.RDBMSDataSource.<init>(RDBMSDataSource.java:42)
at org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader.createDataSource(RDBMSDataSourceReader.java:58)
at org.wso2.carbon.ndatasource.core.DataSourceRepository.createDataSourceObject(DataSourceRepository.java:202)
at org.wso2.carbon.ndatasource.core.DataSourceRepository.registerDataSource(DataSourceRepository.java:359)
at org.wso2.carbon.ndatasource.core.DataSourceRepository.addDataSource(DataSourceRepository.java:473)
at org.wso2.carbon.ndatasource.core.services.NDataSourceAdminService.addDataSource(NDataSourceAdminService.java:78)
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:616)
how we can do this and try with this also copied this into datasources file
<datasource>
<name>sample</name>
<xa-datasource jndi-name="java:jboss/PostgresXADS" pool-name="PostgresXADS">
<driver>postgresql</driver>
<xa-datasource-property name="ServerName">localhost</xa-datasource-property>
<xa-datasource-property name="PortNumber">5432</xa-datasource-property>
<xa-datasource-property name="DatabaseName">USCProduction</xa-datasource-property>
<security>
<user-name>admin</user-name>
<password>admin</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker">
</valid-connection-checker>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter">
</exception-sorter>
</validation>
</xa-datasource>
<drivers>
<driver name="postgresql" module="org.postgresql">
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasource>
how can i create xa datasource in wso2esb to use transaction mediator
You need to add the PostgreSQL JDBC Driver to ESB_HOME/repository/components/lib, and restart the server.

configuring a cxf web service in jboss as 7

I am developing a new web service. But I cannot seem to figure out the best way to set up the web service to deploy in jboss as 7.
As per the jboss documentation, here is the web.xml.
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<servlet>
<servlet-name>testService</servlet-name>
<servlet-class>com.sgb.testService.ws.web.TestService</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>testService</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
As per the jboss docs, it also needs a jboss-cxf.xml for all the configurations for cxf and spring.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cxf="http://cxf.apache.org/core"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:wsa="http://cxf.apache.org/ws/addressing"
xmlns:http="http://cxf.apache.org/transports/http/configuration"
xmlns:sec="http://cxf.apache.org/configuration/security"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd ">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<!-- import spring application context configurations -->
<import resource="classpath:META-INF/spring/applicationContext-ws.xml" />
<jaxws:endpoint id="testService"
implementor="com.sgb.testService.ws.web.TestService"
address="/testService" >
<!--
address="http://localhost:8080/testService">
-->
<jaxws:properties>
<entry key="schema-validation-enabled" value="true" />
</jaxws:properties>
<jaxws:invoker>
<bean class="org.jboss.wsf.stack.cxf.InvokerJSE" />
</jaxws:invoker>
</jaxws:endpoint>
And the spring configurations are defined in the ApplicationContext-ws.xml here.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<context:property-placeholder location="classpath*:META-INF/spring/*.properties" />
<!--
import the common configurations from core sub-module
which contains the declarations for Datasource, EntityManagerFactory & PersistanceUnit
-->
<import resource="applicationContext-core.xml" />
<import resource="applicationContext-jpa.xml" />
<!-- setting up multiple packages to scan for components -->
<context:component-scan base-package="com.sgb.testService.ws.service" />
<!-- Declare the Transaction Manager -->
<bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<!-- declare transactions as annotation driven -->
<tx:annotation-driven
transaction-manager="transactionManager" />
Does the above look right?
Am I missing anything?
Specific Question:
For deploying a cxf based web service in jboss AS 7, where does the spring beans configuration (ApplicationContext-ws.xml above) need to be defined?
Can someone point me to a recent (2012) example or tutorial. Most of the examples I find online seem to be old and I cannot seem to find a proper tutorial in the jboss or spring websites...
Thank you.
-SGB
EDIT TO ADD:
The error message seems to indicate that while deploying the war file, jboss is attempting to publish the wsdl to JBOSS_HOME/standalone/data/wsdl/TestService.war, but is failing as it cannot find the schema (xsd file). This is a bit strange as bot the schema and wsdl is inside WEB-INF/wsdl/ directory.
where
JBOSS_HOME = C:\Program Files (x86)\Apache Software Foundation\jboss-as-7.1.1.Final\
ERROR MESSAGE:
15:56:09,146 INFO [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-4) Creating Service {http://www.sgb.com/Slm/ES
/TestServiceIdentifier}TestServiceIdentifier from WSDL: WEB-INF/wsdl/TestService.wsdl
15:56:09,238 INFO [org.apache.cxf.endpoint.ServerImpl] (MSC service thread 1-4) Setting the server's publish address to be http://localhost:8080/eucl
id-ws
15:56:09,266 INFO [org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher] (MSC service thread 1-4) WSDL published to: JBOSS_HOME/standalone/data/wsdl/testService-ws.war /TestService.wsdl
15:56:09,270 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.unit."testService-ws.war".INSTA
LL: org.jboss.msc.service.StartException in service jboss.deployment.unit."testService-ws.war".INSTALL: Failed to process phase INSTALL of deployment "eucl
id-ws.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_33]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_33]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_33]
Caused by: java.lang.RuntimeException: Cannot publish wsdl to: JBOSS_HOME\standalone\data\
wsdl\testService-ws.war\TestService.wsdl
at org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher.publishWsdlFiles(WSDLFilePublisher.java:107)
at org.jboss.wsf.stack.cxf.deployment.EndpointImpl.publishContractToFilesystem(EndpointImpl.java:222)
at org.jboss.wsf.stack.cxf.deployment.EndpointImpl.doPublish(EndpointImpl.java:93)
at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:239)
at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:509)
at org.jboss.wsf.stack.cxf.configuration.NonSpringBusHolder.configure(NonSpringBusHolder.java:117)
at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.startDeploymentBus(BusDeploymentAspect.java:113)
at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.start(BusDeploymentAspect.java:66)
at org.jboss.as.webservices.deployers.AspectDeploymentProcessor.deploy(AspectDeploymentProcessor.java:74)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1
.Final]
... 5 more
Caused by: java.io.FileNotFoundException: JBOSS_HOME\standalone\data\wsdl\testService-ws.war\TestServiceIdentifier.xsd (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method) [rt.jar:1.6.0_33]
at java.io.FileInputStream.<init>(FileInputStream.java:120) [rt.jar:1.6.0_33]
at java.io.FileInputStream.<init>(FileInputStream.java:79) [rt.jar:1.6.0_33]
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70) [rt.jar:1.6.0_33]
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161) [rt.jar:1.6.0_33]
at java.net.URL.openStream(URL.java:1010) [rt.jar:1.6.0_33]
at org.jboss.ws.common.utils.AbstractWSDLFilePublisher.publishSchemaImports(AbstractWSDLFilePublisher.java:243)
at org.jboss.ws.common.utils.AbstractWSDLFilePublisher.publishSchemaImports(AbstractWSDLFilePublisher.java:250)
at org.jboss.ws.common.utils.AbstractWSDLFilePublisher.publishSchemaImports(AbstractWSDLFilePublisher.java:250)
at org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher.publishWsdlFiles(WSDLFilePublisher.java:94)
... 14 more
15:56:09,343 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "testService-ws.war" was rolled back with failure
message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"testService-ws.war\".INSTALL" => "org.jboss.msc.service.StartException in service jbos
s.deployment.unit.\"testService-ws.war\".INSTALL: Failed to process phase INSTALL of deployment \"testService-ws.war\""}}
15:56:09,413 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped deployment testService-ws.war in 70ms
15:56:09,414 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.deployment.unit."testService-ws.war".INSTALL: org.jboss.msc.service.StartException in serv
ice jboss.deployment.unit."testService-ws.war".INSTALL: Failed to process phase INSTALL of deployment "testService-ws.war"
15:56:09,421 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled ba
ck. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"testService-ws.war\".INSTALL" => "org.jboss.m
sc.service.StartException in service jboss.deployment.unit.\"testService-ws.war\".INSTALL: Failed to process phase INSTALL of deployment \"testService-ws.war\""
}}}}
From the above, the root cause seem to be this:
Caused by: java.io.FileNotFoundException: JBOSS_HOME\standalone\data\wsdl\testService-ws.war\TestServiceIdentifier.xsd (The system cannot find the file specified)
It seems like it is able to find the WSDL, but not the corresponding xsd which it uses which is available in the same directory as WSDL file.
As per this https://issues.jboss.org/browse/JBWS-3532, it might be due to the space in the path of JBOSS_HOME directory. As per a comment by a Richard Opalka in the link above, it looks like it was fixed in a newer build too.
I downloaded the latest nightly of jboss and installed in c:\jboss\ and the problem dis-appeared.

Default document not being processed when not included in URL

Running ColdFusion 9,0,1,274733 on JRun (J2EE install), Windows Server 2008 R2, Java 1.6.0_22
Has anyone else had a problem getting the default document, index.cfm, to work with ColdFusion? I'm assuming that this is only an issue because of our setup; different web server (IIS) and application server (ColdFusion). I can't imagine we are the only ones running this configuration. Are we?
So here is the issue.
If we request http://mysite.com/index.cfm it works.
If we request http://mysite.com/ it does not work and we get a 404.
I checked the web connector's log file on our IIS server and can see that it is sending the request to our ColdFusion server. The ColdFusion server is sending back the 404 error code but I can't figure out why. We have the default document set on our IIS server for index.cfm. We also have the <welcome-file-list> set to include index.cfm on our application server (web.xml).
From our web connector's log when we do NOT include index.cfm:
2012-11-01 13:37:22 jrISAPI[4544:3600] ***HttpExtensionProc for JRun ISAPI Extension: uri is "/test/"
2012-11-01 13:37:22 jrISAPI[4544:3600] HTTP_HOST: servername
2012-11-01 13:37:22 jrISAPI[4544:3600] filtering /test/ (/test/) HOST=servername
2012-11-01 13:37:22 jrISAPI[4544:3600] filterRequest: no match
2012-11-01 13:37:22 jrISAPI[4544:3600] ExecUrl: request received: URL=/test/
2012-11-01 13:37:22 jrISAPI[4544:3600] ExecUrl Completion: 404, ErrorCode=2, URL=/test/.
From our web connector's log when we do include index.cfm:
2012-11-01 13:49:02 jrISAPI[9936:3600] ***HttpExtensionProc for JRun ISAPI Extension: uri is "/test/index.cfm"
2012-11-01 13:49:02 jrISAPI[9936:3600] HTTP_HOST: servername
2012-11-01 13:49:02 jrISAPI[9936:3600] filtering /test/index.cfm (/test/index.cfm) HOST=servername
2012-11-01 13:49:02 jrISAPI[9936:3600] filterRequest: matched *.cfm
2012-11-01 13:49:02 jrISAPI[9936:3600] ***IISWorkerThreadProc for JRun ISAPI Extension: uri is "/test/index.cfm"
2012-11-01 13:49:02 jrISAPI[9936:3600] ALL_RAW: Connection: Keep-Alive
Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, application (553)
2012-11-01 13:49:02 jrISAPI[9936:3600] Headers and Values:
... and much more ...
We have gotten around this issue by using the URL Rewrite module in IIS to append index.cfm to the URL. It works but my gut keeps telling me that we should not need to do that for such basic functionality.
Is anyone else having this issue? How have you gotten around this?
EDIT adding some more info
Here is my site's web.config file contents from the IIS server:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="JWildCardHandler" path="*" verb="*" modules="IsapiModule" scriptProcessor="D:\JRun4\lib\wsconfig\1\jrun_iis6_wildcard.dll" resourceType="Unspecified" requireAccess="None" />
<add name="hbmxmlHandler" path="*.hbmxml" verb="*" modules="IsapiModule" scriptProcessor="D:\JRun4\lib\wsconfig\jrun_iis6.dll" resourceType="Either" responseBufferLimit="0" />
<add name="cfswfHandler" path="*.cfswf" verb="*" modules="IsapiModule" scriptProcessor="D:\JRun4\lib\wsconfig\jrun_iis6.dll" resourceType="Either" responseBufferLimit="0" />
<add name="cfrHandler" path="*.cfr" verb="*" modules="IsapiModule" scriptProcessor="D:\JRun4\lib\wsconfig\jrun_iis6.dll" resourceType="Either" responseBufferLimit="0" />
<add name="cfcHandler" path="*.cfc" verb="*" modules="IsapiModule" scriptProcessor="D:\JRun4\lib\wsconfig\jrun_iis6.dll" resourceType="Either" responseBufferLimit="0" />
<add name="cfmlHandler" path="*.cfml" verb="*" modules="IsapiModule" scriptProcessor="D:\JRun4\lib\wsconfig\jrun_iis6.dll" resourceType="Either" responseBufferLimit="0" />
<add name="cfmHandler" path="*.cfm" verb="*" modules="IsapiModule" scriptProcessor="D:\JRun4\lib\wsconfig\jrun_iis6.dll" resourceType="Either" responseBufferLimit="0" />
<add name="jwsHandler" path="*.jws" verb="*" modules="IsapiModule" scriptProcessor="D:\JRun4\lib\wsconfig\jrun_iis6.dll" resourceType="Either" responseBufferLimit="0" />
<add name="jspHandler" path="*.jsp" verb="*" modules="IsapiModule" scriptProcessor="D:\JRun4\lib\wsconfig\jrun_iis6.dll" resourceType="Either" responseBufferLimit="0" />
</handlers>
<defaultDocument>
<files>
<add value="index.cfm" />
</files>
</defaultDocument>
<staticContent>
<mimeMap fileExtension=".air" mimeType="application/vnd.adobe.air-application-installer-package zip" />
</staticContent>
</system.webServer>
</configuration>
Here is some of the file contents from the APP server web.xml:
<welcome-file-list id="WelcomeFileList_1034546870672">
<welcome-file>index.cfm</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
</welcome-file-list>
Within IIS Manager try adding a default document of "index.cfm" for your website.
I also posted this question on the Adobe forums and it has gained more traction over there. You can read all of the details here.
It seems like the main issue I was having is that IIS was not passing '/index.cfm' to the web connector once it had determined that ColdFusion had no mapping for '/'. This began working after I created a blank (empty) index.cfm file on the web server. I do not recall having to place the CFM files on the web server when using distributed mode in the past. Can anyone confirm or deny that the CFM files need to reside on both servers for this to work (without using rewrite rules anyway)?
I'm a bit late to the party on this one, but I've been working on a system where I need to switch between CF8 & CF10 on the same dev server pretty frequently so I've been working on a batch file to run wsconfig to save myself some effort and I ran into the same issue. CF working fine but never processing index.cfm for / - as above, all the mappings appeared to be set up correctly.
I found that wsconfig works much more reliably if you add each site my name rather than using "-site 0"
So, for example, to manually remove and reinstall the connectors for two sites running on IIS
set CFUSION_HOME=C:\ColdFusion10\cfusion
%CFUSION_HOME%\runtime\bin\wsconfig -uninstall
net start "ColdFusion 10 Application Server"
%CFUSION_HOME%\runtime\bin\wsconfig -ws IIS -site "Default Web Site"
%CFUSION_HOME%\runtime\bin\wsconfig -ws IIS -site "My Website Name"
I had the same problem after upgrading CF from 2016 to 2018 / 2021. The solution is this: open IIS Manager and go to Handler Mappings. Here, search for cfcHandler, cfmHandler, cfmlHandler entries and right click, edit them and you will probably see something like this: C:\ColdFusion2021\config\wsconfig\1\isapi_redirect.dll
Make sure the path is updated to the current version of the ColdFusion server. In my case it was still trying to access ColdFusion2016 folder even if I updated to 2021.
This solved the problem for me.

getting nullPointerException with commons-httpclient and EWSJavaAPI

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>