I'm with a very strange problem and would like to understand it.
Well, the problem is that some of my JUnit tests crashed when I tried to run Maven Test, but in Ant or Eclipse's plugin it works perfectly.
Debugging one of the unit tests I discovered the problem: One boolean attibute into a mock class, setted as "false" explicitly, was always "true" when I ran it into Maven. This occurred only with one method annotated with #Test.
I guess that one of the others methods were changing the value of my attribute, like the class was executed in a different order or something like that... I don't know.
I solved it seeting the variable to "false" again into my method, ensuring the value that I wanted.
Somebody knows why this occurs??
Thanks!
Maven version: 3.0.4
#After
public void limpa() {
Mockit.restoreAllOriginalDefinitions();
}
#Test
public void testWithError() throws Exception {
Mockit.redefineMethods(MyObject.class, MyObjectMock.class);
MyOtherObject myOtherObject = createMyOtherObject();
MyObjectMock.hasRules = false;
try {
myService.executeServiceA(myOtherObject);
Assert.fail("Can't get here. Should throw as exception.");
} catch (Exception e) {
Assert.assertEquals("Exception ", "You can't do this beacause of ...", e.getMessage());
}
}
My mock:
public class MyObjectMock{
//Others attibutes
(...)
public static boolean hasRules = false;
//Setters and getters
(...)
}
My pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.myproject</groupId>
<artifactId>myProject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<jmockit.version>0.0.1</jmockit.version>
</properties>
<build>
<testSourceDirectory>src/test/java/junit</testSourceDirectory>
<resources>
<resource>
<directory>src/main/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/java/selenium</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
</testResources>
<pluginManagement>
<plugins>
<!-- Need Java 5, which is the default since v2.3 of the maven-compiler-plugin. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>
-javaagent:"${settings.localRepository}"/mockit/jmockit/${jmockit.version}/jmockit-${jmockit.version}.jar
</argLine>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>1.5.3</version>
</dependency>
<dependency>
<groupId>bouncycastle</groupId>
<artifactId>bcprov-jdk14</artifactId>
<version>140</version>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0-oracle-thin-extras</artifactId>
<version>0.9.0.2</version>
</dependency>
<dependency>
<groupId>commons-betwixt</groupId>
<artifactId>commons-betwixt</artifactId>
<version>0.7</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>2.4.2</version>
</dependency>
<dependency>
<groupId>com.googlecode.ehcache-spring-annotations</groupId>
<artifactId>ehcache-spring-annotations</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.4.0.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.4.0.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.3.2.GA</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>2.5.6.SEC03</version>
</dependency>
<dependency>
<groupId>net.fckeditor</groupId>
<artifactId>java-core</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>backport-util-concurrent</groupId>
<artifactId>backport-util-concurrent</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.1.0</version>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>3.8</version>
</dependency>
<dependency>
<groupId>mockit</groupId>
<artifactId>jmockit</artifactId>
<version>${jmockit.version}</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>atg.taglib.json</groupId>
<artifactId>json-taglib</artifactId>
<version>0.4.1</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>1.8.4</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.25.0</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.5.6.SEC03</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-agent</artifactId>
<version>2.5.6.SEC03</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>2.5.6.SEC03</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-config-browser-plugin</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-convention-plugin</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-jasperreports-plugin</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-jfreechart-plugin</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-json-plugin</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-tools</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>com.yahoo.platform.yui</groupId>
<artifactId>yuicompressor</artifactId>
<version>2.4.6</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>net.sf.jodreports</groupId>
<artifactId>jodreports</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-oxm</artifactId>
<version>1.5.9</version>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
<version>1.5.9</version>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-oxm-tiger</artifactId>
<version>1.5.9</version>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core-tiger</artifactId>
<version>1.5.9</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom
</groupId>
<artifactId>axiom-api</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom
</groupId>
<artifactId>axiom-impl</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium.client-drivers</groupId>
<artifactId>selenium-java-client-driver</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>org.acegisecurity</groupId>
<artifactId>acegi-security</artifactId>
<version>1.0.7</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
</dependency>
</dependencies>
</project>
You can't count on Ant and Maven to execute tests in the same order. If tests have interdependencies, it's also easy to get into situations where tests pass when run individually, but fail when run through Ant/Maven, or vice versa; or where they pass only if some other tests are run first, or similar.
The best thing to do is make sure tests aren't dependent on each other. If a test does have to modify static data for some reason, you should make sure it resets the static data after it runs, so each test starts fresh. For example:
public class NoRulesTest {
private static boolean oldRulesVal;
#BeforeClass
public static void NoRulesSetup() {
oldRulesVal = MyObjectMock.hasRules;
MyObjectMock.hasRules = false;
}
#AfterClass
public static void NoRulesTeardown() {
MyObjectMock.hasRules = oldRulesVal;
}
}
Related
Environment:
IntelliJ in debug
JBoss 7.2
Java 11
jaxws 2.3.0
I have created a client in a JUnit test and work well.
The problem comes when I try to execute the method normally.
I get the error 'Failed to create service' Caused by: javax.wsdl.WSDLException: WSDLException (at /soapenv:Reason): faultCode=INVALID_WSDL: Expected element '{http://schemas.xmlsoap.org/wsdl/}definitions'
I use the "base" service URL.
I've tried to use "base" service URL + ?wsdl in normal method and works well. Why is that?
Any idea what could it be?
Error
09:37:26,838 ERROR [es.caib.accfor.business.QueryService] (default task-4) Renova silcoiEmpleoClient: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
...
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
at org.apache.cxf.impl//org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:87)
at org.apache.cxf.impl//org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:218)
at org.apache.cxf.impl//org.apache.cxf.jaxws.ServiceImpl.initialize(ServiceImpl.java:161)
... 149 more
Caused by: javax.wsdl.WSDLException: WSDLException (at /soapenv:Reason): faultCode=INVALID_WSDL: Expected element '{http://schemas.xmlsoap.org/wsdl/}definitions'.
...
pom.xml
<dependencies>
<!-- Especificacions i llibreries proporcionades per JBoss -->
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-8.0</artifactId>
<type>pom</type>
<scope>provided</scope>
</dependency>
<!-- Anotacions de documentació de openapi -->
<dependency>
<groupId>org.eclipse.microprofile.openapi</groupId>
<artifactId>microprofile-openapi-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-core</artifactId>
<scope>provided</scope>
</dependency>
<!-- Altres mòduls del projecte -->
<dependency>
<groupId>es.caib.accfor</groupId>
<artifactId>accfor-commons</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>es.caib.accfor</groupId>
<artifactId>accfor-persistence</artifactId>
<scope>provided</scope>
</dependency>
<!-- Altres llibreries necessàries per aquest mòdul -->
<!-- Només necessària per la generació de codi -->
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.11</version>
<exclusions>
<exclusion>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--Dependencies per ws silcoi-->
<!-- JAXWS for Java 11 -->
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.0</version>
</dependency>
<!-- Dependències de test -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<!--<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<scope>test</scope>
</dependency>-->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<!--<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>-->
<!-- Per tests amb Arquillian -->
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<scope>test</scope>
</dependency>
<!--<dependency>
<groupId>pl.pragmatists</groupId>
<artifactId>JUnitParams</artifactId>
<scope>test</scope>
</dependency>-->
<!-- Per fer tests d'integració amb base de dades en memòria -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc10</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Caused by: javax.wsdl.WSDLException: WSDLException (at /soapenv:Reason): faultCode=INVALID_WSDL: Expected element '{http://schemas.xmlsoap.org/wsdl/}definitions'.
It seems that it doesn't recognize the root element: < wsdl:definitions >.
check that your wsdl is correct.
I am trying to put some objects into s3 and it throws error on aws socket not created by this factory Exception anyone having any clue of this?
Its failing on this function
public void uploadToS3(Object obj) {
try {
ByteArrayInputStream input = new ByteArrayInputStream(obj.toString().getBytes());
s3client.listBuckets();
s3client.putObject(bucketName,fileName,input,new ObjectMetadata());
}
catch(AmazonServiceException e) {
System.out.println(e.toString());
}
}
This is the error message
Socket not created by this factory at org.apache.http.util.Asserts.check(Asserts.java:34) at org.apache.http.conn.ssl.SSLSocketFactory.isSecure(SSLSocketFactory.java:435) at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:186) at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:326) at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445) at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:835) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56) at com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:749) at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:505) at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:317) at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3595) at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3548) at com.amazonaws.services.s3.AmazonS3Client.listBuckets(AmazonS3Client.java:697) at com.amazonaws.services.s3.AmazonS3Client.listBuckets(AmazonS3Client.java:703) at com.mobacar.service.DataModelService.uploadToS3(DataModelService.java:33) at com.mobacar.handler.UnconvertedRiDataModelMessageHandler.handle(UnconvertedRiDataModelMessageHandler.java:38) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Sour
and this is the config class:
#Configuration
public class S3Config {
#Value("${aws.accessKey}")
private String accessKey;
#Value("${aws.secretKey}")
private String secretKey;
#Value("${aws.region}")
private String region;
#Bean
public BasicAWSCredentials basicAWSCredentials() {
return new BasicAWSCredentials(accessKey, secretKey);
}
#Bean(name="amazonClient")
public AmazonS3Client amazonS3Client(AWSCredentials awsCredentials) {
AmazonS3Client amazonS3Client = new AmazonS3Client(awsCredentials);
amazonS3Client.setRegion(Region.getRegion(Regions.fromName(region)));
return amazonS3Client;
}
}
Here are the dependencies:
<dependencies>
<dependency>
<groupId>com.mobacar.searchmanager</groupId>
<artifactId>valueObject</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-hateoas</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Starter Dependecy S3 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.10.39</version>
</dependency>
<!-- -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-kafka</artifactId>
</dependency>
</dependencies>
I finally figured it out. Amazon java sdk needs a different version of htppclient which is not coming from spring managed httpclient. So just need to add this dependency.
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5</version>
</dependency>
I had the same issue when I migrating our project to Java 11 + Spring Boot 2.1.8.
What is the fix? Upgraded aws-java-sdk to the following version to fix this issue.
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.11.836</version>
</dependency>
I Faced the same issue with Java 8 + aws-java-sdk-s3 with version 1.9.32
I just updated my httpclient version to 4.5.1 and that resolved my issue
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.1</version>
<type>jar</type>
</dependency>
I implemented actors by extending AbstractLoggingActor. But somehow akka logs are only being written to console and not to log file, and no error is thrown.
I tried various configs in akka, using akka-slf4j of same version as actual akka version of but of no help. I am attaching original pom configs that I initially used.
logback.xml
<appender name="fileAppender" class="ch.qos.logback.core.FileAppender">
<file>/opt/Corp-Async-Job-Processor/logs/corp-job-akka-framework.log</file>
<append>true</append>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>info</level>
</filter>
<encoder>
<pattern>%date{ISO8601} - %logger -> %-5level[%thread] %logger{0} - %msg%n</pattern>
</encoder>
</appender>
<!--appender name="Sentry" class="io.sentry.logback.SentryAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
</appender-->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>debug</level>
</filter>
<encoder>
<pattern>%date{ISO8601} - %logger -> %-5level[%thread] %logger{0} - %msg%n</pattern>
</encoder>
</appender>
<logger name="akka" level="debug" />
<logger name="com.packt" level="debug"/>
<root level="TRACE">
<appender-ref ref="fileAppender"/>
<appender-ref ref="console"/>
</root>
application.conf:
akka {
loglevel = "DEBUG"
event-handlers = ["akka.event.slf4j.Slf4jEventHandler"]
}
dependencies in pom.xml of module:
<dependencies>
<dependency>
<groupId>com.github.davidmoten</groupId>
<artifactId>rxjava-jdbc</artifactId>
<version>0.7.6</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.davidmoten</groupId>
<artifactId>rxjava-jdbc</artifactId>
<version>0.7.6</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.11.RELEASE</version>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-http_${artifact.id.version}</artifactId>
<version>${akka.http.version}</version>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-http-jackson_${artifact.id.version}</artifactId>
<version>${akka.http.version}</version>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-stream_${artifact.id.version}</artifactId>
<version>${akka.version}</version>
</dependency>
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-pdf</artifactId>
<version>9.1.9</version>
</dependency>
<!--dependency>
<groupId>de.idyl</groupId>
<artifactId>winzipaes</artifactId>
<version>1.0.1</version>
</dependency-->
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-http-testkit_${artifact.id.version}
</artifactId>
<version>${akka.http.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.11.232</version>
</dependency>
<dependency>
<groupId>net.lingala.zip4j</groupId>
<artifactId>zip4j</artifactId>
<version>1.3.2</version>
</dependency>
</dependencies>
pom.xml of project:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<akka.version>2.5.4</akka.version>
<artifact.id.version>2.12</artifact.id.version>
<akka.http.version>10.0.10</akka.http.version>
<mysql.version>6.0.5</mysql.version>
<slf4j.version>1.6.6</slf4j.version>
<logback.version>1.0.7</logback.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.9.1</version>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-actor_${artifact.id.version}</artifactId>
<version>${akka.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.11.RELEASE</version>
</dependency>
</dependencies>
Logback's ThresholdFilter denies events whose levels are below the configured threshold. Your FileAppender has the following filter:
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>info</level>
</filter>
The above configuration means that TRACE and DEBUG events are denied. In contrast, your ConsoleAppender has a ThresholdFilter that is set to DEBUG, which denies only TRACE events. Because your Akka log level is set to DEBUG, Akka log messages make it to the console but never make it to the log file.
To output your Akka logs to both the console and the file, change the threshold of the filter in your FileAppender:
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>debug</level>
</filter>
So I trying to create a xlsx file (xlsx is needed as it goes over 70,000 rows) and I keep getting the following error when I deploy to the wso2 esb however when I run the tests (in netbeans and during the mvn build process) it works perfectly. I am specifically using SXSSF however the issue is from XSSF as it also occurs when I try without streaming.
Please help me get this working in the esb, I normally deploy through the .car file.
I am using ESB 4.8.1 just for clarification
ERROR:
TID[-1234] [ESB] [2014-10-10 19:11:43,968] ERROR
{org.apache.axis2.transport.base.threads.NativeWorkerPool} - Uncaught exception
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook$Factory.newInstance(Unknown
Source) org.apache.poi.xssf.usermodel.XSSFWorkbook.onWorkbookCreate(XSSFWorkbook.java:307)
org.apache.poi.xssf.usermodel.XSSFWorkbook.(XSSFWorkbook.java:167)
org.apache.poi.xssf.streaming.SXSSFWorkbook.(SXSSFWorkbook.java:172)
org.apache.poi.xssf.streaming.SXSSFWorkbook.(SXSSFWorkbook.java:143)
org.apache.poi.xssf.streaming.SXSSFWorkbook.(SXSSFWorkbook.java:205)
com.circleblack.mediator.data.PerformanceExtract.mediate(PerformanceExtract.java:30)
org.apache.synapse.mediators.ext.ClassMediator.mediate(ClassMediator.java:78)
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
org.apache.synapse.rest.Resource.process(Resource.java:297)
org.apache.synapse.rest.API.process(API.java:341)
org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:76)
org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:63)
org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:220)
org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:83)
org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:344)
org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:168)
org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
java.lang.Thread.run(Thread.java:745)
pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.circleblack.mediator</groupId>
<artifactId>cb-esb-mediator</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>cb-esb-mediator-data</artifactId>
<packaging>bundle</packaging>
<description>Mediators for processing data.</description>
<properties>
<CApp.type>lib/synapse/mediator</CApp.type>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.synapse</groupId>
<artifactId>synapse-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.axis2.wso2</groupId>
<artifactId>axis2</artifactId>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom.wso2</groupId>
<artifactId>axiom</artifactId>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.10.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.10.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.10.1</version>
<scope>compile</scope>
</dependency>
<!-- Tests -->
<dependency>
<groupId>com.circleblack.mediator</groupId>
<artifactId>cb-esb-mediator-test-mockito</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.6.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.poi.wso2</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9.0.wso2v2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
<version>1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
<version>1.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<type>zip</type>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Bundle-SymbolicName>cb-esb-mediator-data</Bundle-SymbolicName>
<Bundle-Name>cb-esb-mediator-data</Bundle-Name>
<Export-Package>com.circleblack.mediator.data</Export-Package>
<DynamicImport-Package>*</DynamicImport-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
java file
package com.circleblack.mediator.data;
import java.io.FileNotFoundException;
import org.apache.axiom.om.OMElement;
import org.apache.synapse.MessageContext;
import org.apache.synapse.mediators.AbstractMediator;
import java.util.Date;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
public class PerformanceExtract extends AbstractMediator {
#Override
public boolean mediate(MessageContext context) {
System.out.println("Performance Extract Started perfExtact:");
OMElement performanceExportElement = (OMElement) context.getProperty("performanceExtract");
System.out.println("Performance Extract perfFile:");
String performanceExportElementFile = (String) context.getProperty("performanceExtractFile");
System.out.println(performanceExportElementFile);
System.out.println("Performance Extract Data Gathered!");
SXSSFWorkbook wb = new SXSSFWorkbook(100);
for (Iterator<?> i = performanceExportElement.getChildElements(); i.hasNext();) {
OMElement sheetElm = (OMElement) i.next();
//Setup Sheet
Sheet sheet = wb.createSheet(sheetElm.getLocalName());
//Setup headers
OMElement RowHeaders=sheetElm.getFirstElement();
if(RowHeaders!=null){
Row row = sheet.createRow(sheet.getLastRowNum());
int columnNum=0;
for (Iterator<?> q = RowHeaders.getChildElements(); q.hasNext();) {
OMElement RowHeader = (OMElement) q.next();
row.createCell(columnNum).setCellValue(RowHeader.getLocalName());
columnNum++;
}
//Setup Data
for (Iterator<?> z = sheetElm.getChildElements(); z.hasNext();) {
OMElement rowElm = (OMElement) z.next();
row = sheet.createRow(sheet.getLastRowNum()+1);
columnNum=0;
for (Iterator<?> q = rowElm.getChildElements(); q.hasNext();) {
OMElement cellElm = (OMElement) q.next();
row.createCell(columnNum).setCellValue(cellElm.getText());
columnNum++;
}
}
}
}
try {
//FileOutputStream fileOut = new FileOutputStream("/CBdrive/extracts/"+performanceExportElementFile);
FileOutputStream fileOut = new FileOutputStream("C:\\"+performanceExportElementFile);
wb.write(fileOut);
fileOut.close();
} catch (FileNotFoundException ex) {
Logger.getLogger(PerformanceExtract.class.getName()).log(Level.SEVERE, "FileNotFoundException", ex);
} catch (IOException ex) {
Logger.getLogger(PerformanceExtract.class.getName()).log(Level.SEVERE, "IOException", ex);
}
wb.dispose();
return true;
}
}
EDITED:
More detailed error message:
[2014-10-12 19:56:34,235] ERROR - NativeWorkerPool Uncaught exception java.lang.ExceptionInInitializerError
at org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook$Factory.newInstance(Unknown Source) at org.apache.poi.xssf.usermodel.XSSFWorkbook.onWorkbookCreate(XSSFWorkbook.java:307)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:167)
at org.apache.poi.xssf.streaming.SXSSFWorkbook.<init>(SXSSFWorkbook.java:172)
at org.apache.poi.xssf.streaming.SXSSFWorkbook.<init>(SXSSFWorkbook.java:143)
at org.apache.poi.xssf.streaming.SXSSFWorkbook.<init>(SXSSFWorkbook.java:205)
at com.circleblack.mediator.data.PerformanceExtract.mediate(PerformanceExtract.java:30)
at org.apache.synapse.mediators.ext.ClassMediator.mediate(ClassMediator.java:78)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
at org.apache.synapse.rest.Resource.process(Resource.java:297)
at org.apache.synapse.rest.API.process(API.java:341)
at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:76)
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:63)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:220)
at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:83)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:344)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:168)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)Caused by: java.lang.RuntimeException: Cannot load SchemaTypeSystem. Unable to load class with name schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707.TypeSystemHolder. Make sure the generated binary files are on the classpath.
at org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(XmlBeans.java:783)
at org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook.<clinit>(Unknown Source)
... 24 more
Caused by: java.lang.ClassNotFoundException: schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707.TypeSystemHolder
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(XmlBeans.java:769)
... 25 more
below is my parent pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.circleblack</groupId>
<artifactId>cb-wso2</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>com.circleblack.mediator</groupId>
<artifactId>cb-esb-mediator</artifactId>
<packaging>pom</packaging>
<description>Custom mediators for ESB.</description>
<modules>
<module>cb-esb-mediator-data</module>
<module>cb-esb-mediator-rest</module>
<module>cb-esb-mediator-security</module>
<module>cb-esb-mediator-test-mockito</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<synapse.version>2.1.2-wso2v2</synapse.version>
<axis2.version>1.6.1.wso2v10</axis2.version>
<axiom.version>1.2.11.wso2v4</axiom.version>
<httpcomponents.version>4.1.0-wso2v1</httpcomponents.version>
<httpclient.version>3.1.0.wso2v2</httpclient.version>
<junit.version>4.11</junit.version>
<mockito.version>1.9.5</mockito.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.synapse</groupId>
<artifactId>synapse-core</artifactId>
<version>${synapse.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.axis2.wso2</groupId>
<artifactId>axis2</artifactId>
<version>${axis2.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom.wso2</groupId>
<artifactId>axiom</artifactId>
<version>${axiom.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.wso2</groupId>
<artifactId>httpcore</artifactId>
<version>${httpcomponents.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-httpclient.wso2</groupId>
<artifactId>commons-httpclient</artifactId>
<version>${httpclient.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.4</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
My top level wso2 pom
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.circleblack</groupId>
<artifactId>cb-wso2</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>cb-ds</module>
<module>cb-esb</module>
<module>cb-esb-mediator</module>
<module>cb-capp</module>
</modules>
<repositories>
<repository>
<releases>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<id>wso2-nexus</id>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<id>wso2-nexus</id>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
</pluginRepository>
</pluginRepositories>
<properties>
<wso2.plugin>2.0.4</wso2.plugin>
<artifact.types>service/rule=aar,lib/library/bundle=jar,synapse/message-processors=xml,synapse/proxy-service=xml,synapse/message-store=xml,carbon/application=car,registry/resource=zip,synapse/endpoint=xml,lib/dataservice/validator=jar,web/application=war,synapse/sequence=xml,synapse/configuration=xml,lib/registry/handlers=jar,synapse/task=xml,webapp/jaxws=war,synapse/api=xml,cep/bucket=xml,bpel/workflow=zip,lib/registry/filter=jar,service/dataservice=dbs,synapse/local-entry=xml,synapse/priority-executor=xml,synapse/template=xml,synapse/event-source=xml,lib/carbon/ui=jar,service/axis2=aar,wso2/gadget=dar,lib/synapse/mediator=jar</artifact.types>
</properties>
</project>
Do I need to specifically include the dependencies somewhere outside of the mediators pom? I also included them in the main carbon app pom but it didn't seem to make a difference.
With ESB 4.8.1, class
schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707.TypeSystemHolder
can be found in ESB_HOME/repository/components/plugins/poi_ooxml_3.9.0.wso2v1
I don't have your parent POM, so I've updated your POM (see below) to package your class mediator and have a try with ESB (4.8.1) and I don't have any error, I can see
Performance Extract Started perfExtact:
Performance Extract perfFile:
mytest.txt
Performance Extract Data Gathered!
in std output
Nota : with ESB 4.9.0 (SNAPSHOT) I've had the same error as yours and need to add poi-ooxml-3.9.0.wso2v1.jar in repository/components/lib : it works like that, but I don't know if it's a good idea because you can find poi-ooxml_3.9.0.wso2v2.jar by default in repository/components/plugins
POM :
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.circleblack.mediator</groupId>
<artifactId>cb-esb-mediator-data</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<description>Mediators for processing data.</description>
<properties>
<CApp.type>lib/synapse/mediator</CApp.type>
</properties>
<repositories>
<repository>
<id>wso2-maven2-repository</id>
<url>http://dist.wso2.org/maven2</url>
</repository>
<repository>
<id>apache-Incubating-repo</id>
<name>Maven Incubating Repository</name>
<url>http://people.apache.org/repo/m2-incubating-repository</url>
</repository>
<repository>
<id>apache-maven2-repo</id>
<name>Apache Maven2 Repository</name>
<url>http://repo1.maven.org/maven2/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.apache.synapse</groupId>
<artifactId>synapse-core</artifactId>
<version>2.1.2-wso2v1</version>
</dependency>
<dependency>
<groupId>org.apache.axis2.wso2</groupId>
<artifactId>axis2</artifactId>
<version>1.6.1.wso2v10</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom.wso2</groupId>
<artifactId>axiom</artifactId>
<version>1.2.11.wso2v4</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.10.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.10.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.10.1</version>
<scope>compile</scope>
</dependency>
<!-- Tests -->
<!--dependency>
<groupId>com.circleblack.mediator</groupId>
<artifactId>cb-esb-mediator-test-mockito</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency-->
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.6.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.poi.wso2</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9.0.wso2v2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
<version>1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
<version>1.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<type>zip</type>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>cb-esb-mediator-data</Bundle-SymbolicName>
<Bundle-Name>cb-esb-mediator-data</Bundle-Name>
<Export-Package>com.circleblack.mediator.data.*</Export-Package>
<DynamicImport-Package>*</DynamicImport-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
Put all required jar files into the repository/extensions folder into the ESB_HOME and restart the wso2 ESB.
dom4j-1.6.1.jar
poi-3.10-FINAL.jar
poi-ooxml-3.10-FINAL.jar
poi-ooxml-schemas-3.10-FINAL.jar
xmlbeans-2.3.0.jar
I have gone through many posts and blogs but couldn't generate reportng or testng-xslt reports via maven. Finally I have got this tutorial but no luck. I cant understand what am I missing.
Here's what I have tried : It successfully generates the surefire reports in the target folder but doesnt create(generate reports) a directory for reportng reports.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.testng.xslt</groupId>
<artifactId>testng-xslt-plugin</artifactId>
<packaging>maven-plugin</packaging>
<name>TestNG XSLT Maven Plugin</name>
<version>1.2</version>
<prerequisites>
<maven>2.0.4</maven>
</prerequisites>
<developers>
<developer>
<id>cosminaru</id>
<name>Cosmin Marginean</name>
<email>cosminaru#gmail.com</email>
</developer>
</developers>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>C:/Users/paul/Desktop/reporty-ng-1.2/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.reportyng</groupId>
<artifactId>reporty-ng</artifactId>
<version>1.2</version>
<configuration>
<surefireReportDirectory>C:/Users/paul/Desktop/reporty-ng-1.2/target/surefire-reports</surefireReportDirectory>
<!--Setting the output directory -->
<outputDir>C:/Users/paul/workspace/windowspc/target/site/testng-xslt-plugin</outputDir>
<!--Setting the testNgXslt.showRuntimeTotals flag -->
<showRuntimeTotals>true</showRuntimeTotals>
<!--Setting the testNgXslt.cssFile parameter. This should be relative
to the '${basedir}/target/site/testng-xslt' directory -->
<sortTestCaseLinks>true</sortTestCaseLinks>
<testDetailsFilter>FAIL,PASS,SKIP,CONF</testDetailsFilter>
</configuration>
</plugin>
</plugins>
</reporting>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0.4</version>
</dependency>
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-impl</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>saxon</artifactId>
<version>8.7</version>
</dependency>
<!-- selenium and testng -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.34.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.34.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
<version>2.34.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
<version>2.34.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.3.1</version>
<scope>test</scope>
</dependency>
<!-- selenium and testng -->
</dependencies>
<pluginRepositories>
<pluginRepository>
<id>reporty-ng</id>
<url>https://github.com/cosminaru/reporty-ng/raw/master/dist/maven</url>
</pluginRepository>
</pluginRepositories>
</project>
Take a look at:
http://maven.apache.org/surefire/maven-surefire-report-plugin/examples/report-custom-location.html
for maven-surefire-report-plugin, the configuration should include outputDirectory tag, e.g.:
<outputDirectory>${project.basedir}/test-output</outputDirectory>
Or when using maven-surefire-plugin, set reportsDirectory tag, e.g.:
<reportsDirectory>${project.basedir}/test-output</reportsDirectory>