Caused by: org.springframework.ws.soap.SoapMessageCreationException: Could not create SAAJ MessageFactory: Unable to create SAAJ meta-factorycom.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl cannot be cast to javax.xml.soap.SAAJMetaFactory; nested exception is javax.xml.soap.SOAPException: Unable to create SAAJ meta-factorycom.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl cannot be cast to javax.xml.soap.SAAJMetaFactory
at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.afterPropertiesSet(SaajSoapMessageFactory.java:163)
at org.springframework.ws.support.DefaultStrategiesHelper.instantiateBean(DefaultStrategiesHelper.java:185)
... 17 more
Caused by: javax.xml.soap.SOAPException: Unable to create SAAJ meta-factorycom.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl cannot be cast to javax.xml.soap.SAAJMetaFactory
at javax.xml.soap.SAAJMetaFactory.getInstance(SAAJMetaFactory.java:94)
at javax.xml.soap.MessageFactory.newInstance(MessageFactory.java:157)
at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.afterPropertiesSet(SaajSoapMessageFactory.java:141)
... 18 more
Kinda stuck on both issues. The logger issue it seems I might have to deploy the log4j.properties as a fragment bundle, at least that is what I am reading from my google searches. The other option I am hearing is to switch to PAXLogger, but then I would have to figure out how to tell gradle not to embed the commons logging jar as well.
The SAAJMetaFactory thing is most likely that it has 2 different versions of the class on the classpath, not sure how to resolve that either. I seem to run into this issue whenever I have to add anything from the javax packages. If I try to deploy my own I get this sort of error, but if I try to use the one on the dotCMS classpath, it fails because it is repackaged.
My buid.gradle:
apply plugin: 'osgi'
apply plugin: 'eclipse'
apply plugin: 'propdeps'
apply plugin: 'propdeps-maven'
apply plugin: 'propdeps-eclipse'
sourceCompatibility = '1.8'
dependencies {
// dotCMS Dependencies
compile('com.dotcms:dotcms:3.2') { transitive = true }
provided('javax.servlet:servlet-api:2.5')
// Our Dependencies
compile('com.google.api-client:google-api-client:1.20.0')
compile('com.google.code.gson:gson:2.3.1')
compile('com.google.guava:guava:18.0')
compile('com.google.http-client:google-http-client:1.20.0')
compile('com.google.http-client:google-http-client-jackson:1.20.0')
compile('commons-fileupload:commons-fileupload:1.3.1')
compile('commons-httpclient:commons-httpclient:3.1')
compile('commons-io:commons-io:2.4')
compile('commons-lang:commons-lang:2.6')
compile('commons-logging:commons-logging:1.1.3')
compile('javax.xml.soap:saaj-api:1.3.4')
compile('log4j:log4j:1.2.17')
compile('org.apache.commons:commons-csv:1.1')
compile('org.apache.httpcomponents:httpclient:4.3.6')
compile('org.apache.httpcomponents:httpcore:4.3.3')
compile('org.apache.httpcomponents:httpmime:4.3.6')
compile('org.apache.solr:solr-common:1.3.0')
compile('org.apache.solr:solr-solrj:4.10.4')
compile('org.springframework.ws:spring-ws-core:2.2.1.RELEASE')
compile('xml-apis:xml-apis:1.0.b2')
}
repositories {
mavenCentral()
}
buildscript {
repositories {
}
dependencies {
classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.7'
}
}
jar {
exclude('org/json/*')
manifest {
name = 'Aquent Main'
symbolicName = 'com.aquent.dotcms.osgi'
instruction 'Bundle-Description', 'Main Aquent OSGI Plugin'
instruction 'Bundle-Activator', 'com.aquent.osgi.AquentActivator'
instruction 'DynamicImport-Package', '*'
instruction 'Import-Package',
'!org.springframework.*',
'!org.apache.commons.*',
'!org.apache.http.*',
'!org.apache.solr.*',
'!com.google.api.*',
'!com.google.common.*',
'!com.google.gson.*',
'!javax.xml.*',
'!org.springframework.ws.*',
'!org.w3c.*',
'!org.xml.*',
'*;version=0'
instruction 'Embed-Dependency',
'commons-csv',
'commons-fileupload',
'commons-httpclient',
'commons-io',
'commons-lang',
'commons-logging',
'google-api-client',
'google-http-client-jackson',
'gson',
'guava',
'httpclient',
'httpcore',
'httpmime',
'log4j',
'saaj-api',
'solr-common',
'solr-solrj',
'spring-ws-core',
'xml-apis'
instruction 'Embed-Transitive', 'true'
}
}
/*
* reads the OSGI instruction "Embed-Dependency" and "Embed-Transitive"
* and sets the "Bundle-ClassPath" instruction as well as copy instruction for
* the related artifacts accordingly
*/
task processEmbedded << {
ext.embedInstruction = jar.manifest.instructions.get("Embed-Dependency")
ext.transitive = jar.manifest.instructions.get("Embed-Transitive");
if(embedInstruction != null){
def includedArtifacts = [] as Set
getDependencies(embedInstruction,transitive).each { dependency ->
dependency.moduleArtifacts.each { artifact ->
includedArtifacts.add(artifact.file)
}
}
jar.manifest.instruction("Bundle-ClassPath",'.') //add the default classpath
includedArtifacts.each { artifact ->
jar.from(artifact)
}
}
}
/**
* Gets the list of ResolvedDependencies for the list of embeded dependency names
* @param embededList the list with the dependencies to embed
* @param recursive The embed transitive state
* @return the list of dependencies. An empty Set if none
*/
def getDependencies(embededList, recursive){
def dependencies = [] as Set //resolved Dependencies
def dependencyMap = [:];
// This only considers top level resolved dependencies, but other should
// not be embeded anyway.
project.configurations.runtime.resolvedConfiguration.firstLevelModuleDependencies.each { dependency ->
dependencyMap.put(dependency.moduleName,dependency)
}
embededList.each { embeded ->
ext.dependency = dependencyMap.get(embeded)
if(dependency != null){
dependencies.add(dependency)
if(recursive){
dependency.children.each { child ->
println " child "+child.name+" Parents: "+child.parents dependencies.add(child)
}
}
} else {
println "WARNING: dependency "+embeded+" not found"
}
}
return dependencies
}
compileJava.dependsOn processEmbedded
Here is what is ending up in my bundle:
[MANIFEST dotcms-osgi-1.11.0-SNAPSHOT.jar]
Bnd-LastModified 1436303107000
Bundle-Activator com.aquent.osgi.AquentActivator
Bundle-ClassPath .,commons-csv-1.1.jar,commons-fileupload-1.3.1.jar,commons-io-2.4.jar,commons-httpclient-3.1.jar,commons-logging-1.1.3.jar,commons-codec-1.6.jar,commons-lang-2.6.jar,google-api-client-1.20.0.jar,google-oauth-client-1.20.0.jar,google-http-client-jackson2-1.20.0.jar,guava-jdk5-13.0.jar,google-http-client-jackson-1.20.0.jar,google-http-client-1.20.0.jar,jackson-core-asl-1.9.11.jar,gson-2.3.1.jar,guava-18.0.jar,httpclient-4.3.6.jar,httpcore-4.3.3.jar,httpmime-4.3.6.jar,log4j-1.2.17.jar,saaj-api-1.3.4.jar,activation-1.1.jar,solr-common-1.3.0.jar,solr-solrj-4.10.4.jar,zookeeper-3.4.6.jar,wstx-asl-3.2.7.jar,noggit-0.5.jar,slf4j-api-1.7.6.jar,spring-ws-core-2.2.1.RELEASE.jar,spring-xml-2.2.1.RELEASE.jar,spring-aop-4.0.9.RELEASE.jar,spring-oxm-4.0.9.RELEASE.jar,spring-beans-4.0.9.RELEASE.jar,spring-core-4.0.9.RELEASE.jar,spring-web-4.0.9.RELEASE.jar,spring-webmvc-4.0.9.RELEASE.jar,xml-apis-1.0.b2.jar
Bundle-Description Main Aquent OSGI Plugin
Bundle-ManifestVersion 2
Bundle-Name Aquent Main
Bundle-SymbolicName com.aquent.dotcms.osgi
Bundle-Version 1.11.0.SNAPSHOT
Created-By 1.8.0_45 (Oracle Corporation)
DynamicImport-Package *
Embed-Dependency commons-csv,commons-fileupload,commons-httpclient,commons-io,commons-lang,commons-logging,google-api-client,google-http-client-jackson,gson,guava,httpclient,httpcore,httpmime,log4j,saaj-api,solr-common,solr-solrj,spring-ws-core,xml-apis
Embed-Transitive true
Export-Package com.aquent;version="1.11.0.SNAPSHOT";uses:="com.dotcms.repackage.org.tuckey.web.filters.urlrewrite,com.dotmarketing.beans,com.dotmarketing.portlets.categories.model,com.dotmarketing.portlets.contentlet.business,com.dotmarketing.portlets.contentlet.model,com.dotmarketing.portlets.structure.model,com.liferay.portal.model,javax.servlet.http,org.apache.velocity.tools.view.servlet,org.apache.velocity.tools.view.tools",com.aquent.agenttool;version="1.11.0.SNAPSHOT";uses:="javax.servlet,javax.servlet.http",com.aquent.aquentcareers;version="1.11.0.SNAPSHOT";uses:="javax.servlet,javax.servlet.http,org.quartz",com.aquent.auth;version="1.11.0.SNAPSHOT";uses:="javax.servlet,javax.servlet.http",com.aquent.jobs;version="1.11.0.SNAPSHOT";uses:="com.dotmarketing.beans,com.dotmarketing.portlets.categories.model,com.dotmarketing.portlets.contentlet.business,com.dotmarketing.portlets.contentlet.model,com.dotmarketing.portlets.structure.model,com.liferay.portal.model,javax.servlet,javax.servlet.http,org.quartz",com.aquent.leadform;version="1.11.0.SNAPSHOT";uses:="javax.servlet.http",com.aquent.osgi;version="1.11.0.SNAPSHOT";uses:="com.dotcms.repackage.org.osgi.framework,com.dotmarketing.osgi",com.aquent.osgi.job;version="1.11.0.SNAPSHOT";uses:="org.quartz",com.aquent.solr;version="1.11.0.SNAPSHOT";uses:="org.apache.velocity.tools.view.servlet,org.apache.velocity.tools.view.tools",com.aquent.talentcalendar;version="1.11.0.SNAPSHOT";uses:="com.dotmarketing.beans,com.dotmarketing.portlets.categories.model,com.dotmarketing.portlets.contentlet.business,com.dotmarketing.portlets.contentlet.model,com.dotmarketing.portlets.structure.model,com.liferay.portal.model,javax.servlet.http",com.aquent.votes;version="1.11.0.SNAPSHOT";uses:="com.dotmarketing.portlets.contentlet.model,javax.servlet,javax.servlet.http",com.aquent.ws;version="1.11.0.SNAPSHOT" Import-Package com.dotcms.publisher.bundle.bean;version=0,com.dotcms.publisher.bundle.business;version=0,com.dotcms.publisher.business;version=0,com.dotcms.publisher.environment.bean;version=0,com.dotcms.publisher.environment.business;version=0,com.dotcms.repackage.org.apache.felix.http.api;version=0,com.dotcms.repackage.org.osgi.framework;version=0,com.dotcms.repackage.org.osgi.service.http;version=0,com.dotcms.repackage.org.osgi.util.tracker;version=0,com.dotcms.repackage.org.tuckey.web.filters.urlrewrite;version=0,com.dotmarketing.beans;version=0,com.dotmarketing.business;version=0,com.dotmarketing.business.web;version=0,com.dotmarketing.cache;version=0,com.dotmarketing.common.db;version=0,com.dotmarketing.db;version=0,com.dotmarketing.filters;version=0,com.dotmarketing.osgi;version=0,com.dotmarketing.portlets.categories.business;version=0,com.dotmarketing.portlets.categories.model;version=0,com.dotmarketing.portlets.contentlet.business;version=0,com.dotmarketing.portlets.contentlet.model;version=0,com.dotmarketing.portlets.fileassets.business;version=0,com.dotmarketing.portlets.folders.business;version=0,com.dotmarketing.portlets.folders.model;version=0,com.dotmarketing.portlets.structure.factories;version=0,com.dotmarketing.portlets.structure.model;version=0,com.dotmarketing.quartz;version=0,com.dotmarketing.util;version=0,com.dotmarketing.viewtools;version=0,com.liferay.portal.model;version=0,com.liferay.util;version=0,javax.servlet;version=0,javax.servlet.http;version=0,org.apache.velocity.tools.view.context;version=0,org.apache.velocity.tools.view.servlet;version=0,org.apache.velocity.tools.view.tools;version=0,org.quartz;version=0
Manifest-Version 1.0
Tool Bnd-2.1.0.20130426-122213
[LIST]
activation-1.1.jar
commons-codec-1.6.jar
commons-csv-1.1.jar
commons-fileupload-1.3.1.jar
commons-httpclient-3.1.jar
commons-io-2.4.jar
commons-lang-2.6.jar
commons-logging-1.1.3.jar
google-api-client-1.20.0.jar
google-http-client-1.20.0.jar
google-http-client-jackson-1.20.0.jar
google-http-client-jackson2-1.20.0.jar
google-oauth-client-1.20.0.jar
gson-2.3.1.jar
guava-18.0.jar
guava-jdk5-13.0.jar
httpclient-4.3.6.jar
httpcore-4.3.3.jar
httpmime-4.3.6.jar
jackson-core-asl-1.9.11.jar
log4j-1.2.17.jar
log4j.properties
noggit-0.5.jar
saaj-api-1.3.4.jar
slf4j-api-1.7.6.jar
solr-common-1.3.0.jar
solr-solrj-4.10.4.jar
spring-aop-4.0.9.RELEASE.jar
spring-beans-4.0.9.RELEASE.jar
spring-core-4.0.9.RELEASE.jar
spring-oxm-4.0.9.RELEASE.jar
spring-web-4.0.9.RELEASE.jar
spring-webmvc-4.0.9.RELEASE.jar
spring-ws-core-2.2.1.RELEASE.jar
spring-xml-2.2.1.RELEASE.jar
wstx-asl-3.2.7.jar
xml-apis-1.0.b2.jar
zookeeper-3.4.6.jar