Spring / Jersey / Grizzly causing silent test failure in maven command-line, but succeeds in Eclipse? -


we have junit / jersey integration test failing "connection refused" when run command-line via maven. however, when run eclipse test passes. seems there error grizzly container not starting, cannot find error messages or log, fails silently. occurring while upgrading java 7 centos 6 environment java 8 centos 7 environment. below simple test reproduces error:

public class crobichagrizzlyintegrationtest extends jerseytest {     private webresource webresource;     private static final string package_name = "xxx";     byte[] bytes;     byte[] expectedresponses;      public crobichagrizzlyintegrationtest() {         super(                 new webappdescriptor.builder(package_name)                         .clientconfig(                                 new defaultclientconfig()).servletpath("/")                         .contextparam("contextconfiglocation", "classpath:app-config.xml")                         .servletclass(springservlet.class)                         .contextlistenerclass(contextloaderlistener.class)                         .build()         );     }      @before     public void setup() {         bytes = reputationhelper.createreputationrequest().tobytearray();         expectedresponses = reputationhelper.createreputationresponse().tobytearray();     }      // 1. valid post/get(e2e) request     @test     public void testpostrequestsuccess() throws exception {         webresource = resource().path("xyz").queryparam("query", "value");          final byte[] response =                 webresource.type(httputils.mime_application_protobuf).accept(httputils.mime_application_protobuf)                         .cookie(new cookie("cookie", "abcd")).post(byte[].class, bytes);          final responselist expectedresponselist = responselist.parsefrom(expectedresponses);         final responselist responselist = responselist.parsefrom(response);          assert.assertequals(expectedresponselist.getresponse(0), responselist.getresponse(0));     } } 

error report maven:

<?xml version="1.0" encoding="utf-8"?> <testsuite name="xxx.crobichagrizzlyintegrationtest" time="0" tests="1" errors="1" skipped="0" failures="0">   <properties>     <property name="java.runtime.name" value="java(tm) se runtime environment"/>     <property name="sun.boot.library.path" value="/usr/java/jdk1.8.0_45/jre/lib/amd64"/>     <property name="java.vm.version" value="25.45-b02"/>     <property name="java.vm.vendor" value="oracle corporation"/>     <property name="java.vendor.url" value="http://java.oracle.com/"/>     <property name="path.separator" value=":"/>     <property name="guice.disable.misplaced.annotation.check" value="true"/>     <property name="java.vm.name" value="java hotspot(tm) 64-bit server vm"/>     <property name="file.encoding.pkg" value="sun.io"/>     <property name="user.country" value="us"/>     <property name="sun.java.launcher" value="sun_standard"/>     <property name="sun.os.patch.level" value="unknown"/>     <property name="java.vm.specification.name" value="java virtual machine specification"/>     <property name="user.dir" value="---removed---"/>     <property name="java.runtime.version" value="1.8.0_45-b14"/>     <property name="java.awt.graphicsenv" value="sun.awt.x11graphicsenvironment"/>     <property name="java.endorsed.dirs" value="/usr/java/jdk1.8.0_45/jre/lib/endorsed"/>     <property name="os.arch" value="amd64"/>     <property name="java.io.tmpdir" value="/tmp"/>     <property name="line.separator" value="&#10;"/>     <property name="java.vm.specification.vendor" value="oracle corporation"/>     <property name="os.name" value="linux"/>     <property name="classworlds.conf" value="/usr/share/maven/bin/m2.conf"/>     <property name="sun.jnu.encoding" value="utf-8"/>     <property name="java.library.path" value="/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib"/>     <property name="java.specification.name" value="java platform api specification"/>     <property name="java.class.version" value="52.0"/>     <property name="sun.management.compiler" value="hotspot 64-bit tiered compilers"/>     <property name="os.version" value="3.10.0-229.4.2.el7.x86_64"/>     <property name="user.home" value="/home/chris_robichaud"/>     <property name="user.timezone" value="america/new_york"/>     <property name="java.awt.printerjob" value="sun.print.psprinterjob"/>     <property name="file.encoding" value="utf-8"/>     <property name="java.specification.version" value="1.8"/>     <property name="user.name" value="chris_robichaud"/>     <property name="java.class.path" value="/usr/share/maven/boot/plexus-classworlds.jar"/>     <property name="java.vm.specification.version" value="1.8"/>     <property name="sun.arch.data.model" value="64"/>     <property name="java.home" value="/usr/java/jdk1.8.0_45/jre"/>     <property name="sun.java.command" value="org.codehaus.plexus.classworlds.launcher.launcher integration-test -rf :project_name -x"/>     <property name="java.specification.vendor" value="oracle corporation"/>     <property name="user.language" value="en"/>     <property name="awt.toolkit" value="sun.awt.x11.xtoolkit"/>     <property name="java.vm.info" value="mixed mode"/>     <property name="java.version" value="1.8.0_45"/>     <property name="java.ext.dirs" value="/usr/java/jdk1.8.0_45/jre/lib/ext:/usr/java/packages/lib/ext"/>     <property name="sun.boot.class.path" value="/usr/java/jdk1.8.0_45/jre/lib/resources.jar:/usr/java/jdk1.8.0_45/jre/lib/rt.jar:/usr/java/jdk1.8.0_45/jre/lib/sunrsasign.jar:/usr/java/jdk1.8.0_45/jre/lib/jsse.jar:/usr/java/jdk1.8.0_45/jre/lib/jce.jar:/usr/java/jdk1.8.0_45/jre/lib/charsets.jar:/usr/java/jdk1.8.0_45/jre/lib/jfr.jar:/usr/java/jdk1.8.0_45/jre/classes"/>     <property name="java.vendor" value="oracle corporation"/>     <property name="maven.home" value="/usr/share/maven"/>     <property name="file.separator" value="/"/>     <property name="java.vendor.url.bug" value="http://bugreport.sun.com/bugreport/"/>     <property name="sun.cpu.endian" value="little"/>     <property name="sun.io.unicode.encoding" value="unicodelittle"/>     <property name="sun.desktop" value="gnome"/>     <property name="sun.cpu.isalist" value=""/>   </properties>   <testcase name="testpostrequestsuccess" classname="xxx.crobichagrizzlyintegrationtest" time="0">     <error message="java.net.connectexception: connection refused" type="com.sun.jersey.api.client.clienthandlerexception"><![cdata[com.sun.jersey.api.client.clienthandlerexception: java.net.connectexception: connection refused     @ java.net.plainsocketimpl.socketconnect(native method)     @ java.net.abstractplainsocketimpl.doconnect(abstractplainsocketimpl.java:345)     @ java.net.abstractplainsocketimpl.connecttoaddress(abstractplainsocketimpl.java:206)     @ java.net.abstractplainsocketimpl.connect(abstractplainsocketimpl.java:188)     @ java.net.sockssocketimpl.connect(sockssocketimpl.java:392)     @ java.net.socket.connect(socket.java:589)     @ java.net.socket.connect(socket.java:538)     @ sun.net.networkclient.doconnect(networkclient.java:180)     @ sun.net.www.http.httpclient.openserver(httpclient.java:432)     @ sun.net.www.http.httpclient.openserver(httpclient.java:527)     @ sun.net.www.http.httpclient.<init>(httpclient.java:211)     @ sun.net.www.http.httpclient.new(httpclient.java:308)     @ sun.net.www.http.httpclient.new(httpclient.java:326)     @ sun.net.www.protocol.http.httpurlconnection.getnewhttpclient(httpurlconnection.java:1168)     @ sun.net.www.protocol.http.httpurlconnection.plainconnect0(httpurlconnection.java:1104)     @ sun.net.www.protocol.http.httpurlconnection.plainconnect(httpurlconnection.java:998)     @ sun.net.www.protocol.http.httpurlconnection.connect(httpurlconnection.java:932)     @ sun.net.www.protocol.http.httpurlconnection.getoutputstream0(httpurlconnection.java:1282)     @ sun.net.www.protocol.http.httpurlconnection.getoutputstream(httpurlconnection.java:1257)     @ com.sun.jersey.client.urlconnection.urlconnectionclienthandler$1$1.getoutputstream(urlconnectionclienthandler.java:238)     @ com.sun.jersey.api.client.committingoutputstream.commitstream(committingoutputstream.java:117)     @ com.sun.jersey.api.client.committingoutputstream.write(committingoutputstream.java:83)     @ com.sun.jersey.core.impl.provider.entity.bytearrayprovider.writeto(bytearrayprovider.java:95)     @ com.sun.jersey.core.impl.provider.entity.bytearrayprovider.writeto(bytearrayprovider.java:59)     @ com.sun.jersey.api.client.requestwriter.writerequestentity(requestwriter.java:300)     @ com.sun.jersey.client.urlconnection.urlconnectionclienthandler._invoke(urlconnectionclienthandler.java:217)     @ com.sun.jersey.client.urlconnection.urlconnectionclienthandler.handle(urlconnectionclienthandler.java:153)     @ com.sun.jersey.api.client.client.handle(client.java:652)     @ com.sun.jersey.api.client.webresource.handle(webresource.java:682)     @ com.sun.jersey.api.client.webresource.access$200(webresource.java:74)     @ com.sun.jersey.api.client.webresource$builder.post(webresource.java:570)     @ xxx.crobichagrizzlyintegrationtest.testpostrequestsuccess(crobichagrizzlyintegrationtest.java:88) ]]></error>   </testcase> </testsuite> 

just wanted add answer in case else runs issue: spent time cleaning maven pom files , seems have fixed it. never did find root cause.


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -