I have junit test with testcontainer in my project.
#Testcontainers(disabledWithoutDocker = true)
public class AutoHedgeDaoTest {
#Container
GenericContainer<?> mongoContainer = new GenericContainer<>("mongo:3.6.9").withExposedPorts(27017);
MongoTemplate mongoTemplate;
...
}
I use azure devops pipeline to build my project
- task: Maven#3
displayName: maven build
inputs:
mavenPomFile: 'fixByPassWeb/pom.xml'
goals: 'clean install'
options: ' -DbuildNumber=$(Build.BuildNumber)'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
javaHomeOption: 'JDKVersion'
jdkVersionOption: 1.11
mavenVersionOption: 'Default'
mavenAuthenticateFeed: false
effectivePomSkip: false
sonarQubeRunAnalysis: false
On November azure devops uses ubuntu 18 and all was good.
This is part of log
14:58:14.857 [main] DEBUG org.testcontainers.utility.TestcontainersConfiguration - Testcontainers configuration overrides will be loaded from file:/home/vsts/.testcontainers.properties
14:58:15.309 [ducttape-0] DEBUG org.testcontainers.dockerclient.DockerClientProviderStrategy - Pinging docker daemon...
14:58:15.332 [ducttape-0] DEBUG com.github.dockerjava.core.command.AbstrDockerCmd - Cmd:
14:58:15.433 [main] INFO org.testcontainers.dockerclient.EnvironmentAndSystemPropertyClientProviderStrategy - Found docker client settings from environment
14:58:15.434 [main] INFO org.testcontainers.dockerclient.DockerClientProviderStrategy - Found Docker environment with Environment variables, system properties and defaults. Resolved dockerHost=unix:///var/run/docker.sock
14:58:15.434 [main] DEBUG org.testcontainers.dockerclient.DockerClientProviderStrategy - Checking Docker OS type for Environment variables, system properties and defaults. Resolved dockerHost=unix:///var/run/docker.sock
14:58:15.436 [main] DEBUG com.github.dockerjava.core.command.AbstrDockerCmd - Cmd:
14:58:15.623 [main] INFO org.testcontainers.DockerClientFactory - Docker host IP address is localhost
14:58:15.624 [main] DEBUG com.github.dockerjava.core.command.AbstrDockerCmd - Cmd:
14:58:15.643 [main] DEBUG com.github.dockerjava.core.command.AbstrDockerCmd - Cmd:
14:58:15.662 [main] INFO org.testcontainers.DockerClientFactory - Connected to docker:
Server Version: 19.03.13+azure
API Version: 1.40
Operating System: Ubuntu 18.04.5 LTS
Total Memory: 6927 MB
14:58:15.662 [main] DEBUG org.testcontainers.DockerClientFactory - Ryuk is enabled
14:58:15.670 [main] DEBUG com.github.dockerjava.core.command.AbstrDockerCmd - Cmd: ListImagesCmdImpl[imageNameFilter=testcontainersofficial/ryuk:0.3.0,showAll=false,filters=com.github.dockerjava.core.util.FiltersBuilder#0]
14:58:15.726 [main] DEBUG org.testcontainers.utility.RegistryAuthLocator - Looking up auth config for image: testcontainersofficial/ryuk:0.3.0 at registry: index.docker.io
14:58:15.728 [main] DEBUG org.testcontainers.utility.RegistryAuthLocator - RegistryAuthLocator has configFile: /home/vsts/.docker/config.json (exists) and commandPathPrefix:
14:58:15.737 [main] DEBUG org.testcontainers.utility.RegistryAuthLocator - registryName [index.docker.io] for dockerImageName [testcontainersofficial/ryuk:0.3.0]
14:58:15.748 [main] DEBUG org.testcontainers.utility.RegistryAuthLocator - found existing auth config [AuthConfig{username=githubactions, password=hidden non-blank value, auth=hidden non-blank value, email=null, registryAddress=https://index.docker.io/v1/, registryToken=blank}]
14:58:15.750 [main] DEBUG org.testcontainers.utility.RegistryAuthLocator - Cached auth found: [AuthConfig{username=githubactions, password=hidden non-blank value, auth=hidden non-blank value, email=null, registryAddress=https://index.docker.io/v1/, registryToken=blank}]
14:58:15.751 [main] DEBUG org.testcontainers.dockerclient.auth.AuthDelegatingDockerClientConfig - Effective auth config [AuthConfig{username=githubactions, password=hidden non-blank value, auth=hidden non-blank value, email=null, registryAddress=https://index.docker.io/v1/, registryToken=blank}]
14:58:16.929 [tc-okhttp-stream-559050604] INFO org.testcontainers.DockerClientFactory - Starting to pull image
14:58:16.942 [tc-okhttp-stream-559050604] DEBUG com.github.dockerjava.core.command.PullImageResultCallback - ResponseItem(stream=null, status=Pulling from testcontainersofficial/ryuk, progressDetail=null, progress=null, id=0.3.0, from=null, time=null, errorDetail=null, error=null, aux=null)
14:58:16.950 [tc-okhttp-stream-559050604] INFO org.testcontainers.DockerClientFactory - Pulling image layers: 0 pending, 0 downloaded, 0 extracted, (0 bytes/0 bytes)
…………….
[INFO] Running com.AutoHedgeDaoTest
………………
14:58:32.725 [main] INFO com.rencap.fo.fixbypass.web.AutoHedgeDaoTest - Connecting to mongodb://localhost:32769
……………………..
14:58:33.592 [main] DEBUG org.testcontainers.utility.ResourceReaper - Removed container and associated volume(s): mongo:3.6.9
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 15.047 s - in com.AutoHedgeDaoTest
But now azure devops uses ubuntu 20. And currently test skipped.
18:16:28.143 [main] DEBUG com.github.dockerjava.core.command.AbstrDockerCmd - Cmd:
18:16:28.295 [main] INFO org.testcontainers.DockerClientFactory - Docker host IP address is localhost
18:16:28.297 [main] DEBUG com.github.dockerjava.core.command.AbstrDockerCmd - Cmd:
18:16:28.315 [main] DEBUG com.github.dockerjava.core.command.AbstrDockerCmd - Cmd:
18:16:28.333 [main] INFO org.testcontainers.DockerClientFactory - Connected to docker:
Server Version: 20.10.2+azure
API Version: 1.41
Operating System: Ubuntu 20.04.2 LTS
Total Memory: 6954 MB
18:16:28.334 [main] DEBUG org.testcontainers.DockerClientFactory - Ryuk is enabled
18:16:28.338 [main] DEBUG com.github.dockerjava.core.command.AbstrDockerCmd - Cmd: ListImagesCmdImpl[imageNameFilter=testcontainersofficial/ryuk:0.3.0,showAll=false,filters=com.github.dockerjava.core.util.FiltersBuilder#0]
18:16:28.374 [main] DEBUG org.testcontainers.utility.RegistryAuthLocator - Looking up auth config for image: testcontainersofficial/ryuk:0.3.0 at registry: index.docker.io
18:16:28.376 [main] DEBUG org.testcontainers.utility.RegistryAuthLocator - RegistryAuthLocator has configFile: /home/vsts/.docker/config.json (exists) and commandPathPrefix:
18:16:28.381 [main] DEBUG org.testcontainers.utility.RegistryAuthLocator - registryName [index.docker.io] for dockerImageName [testcontainersofficial/ryuk:0.3.0]
18:16:28.392 [main] DEBUG org.testcontainers.utility.RegistryAuthLocator - found existing auth config [AuthConfig{username=githubactions, password=hidden non-blank value, auth=hidden non-blank value, email=null, registryAddress=https://index.docker.io/v1/, registryToken=blank}]
18:16:28.392 [main] DEBUG org.testcontainers.utility.RegistryAuthLocator - Cached auth found: [AuthConfig{username=githubactions, password=hidden non-blank value, auth=hidden non-blank value, email=null, registryAddress=https://index.docker.io/v1/, registryToken=blank}]
18:16:28.392 [main] DEBUG org.testcontainers.dockerclient.auth.AuthDelegatingDockerClientConfig - Effective auth config [AuthConfig{username=githubactions, password=hidden non-blank value, auth=hidden non-blank value, email=null, registryAddress=https://index.docker.io/v1/, registryToken=blank}]
18:16:28.419 [main] DEBUG com.github.dockerjava.core.command.AbstrDockerCmd - Cmd:
com.github.dockerjava.core.command.CreateContainerCmdImpl#70925b45[name=testcontainers-ryuk-0dd3967c-ded1-45bb-9174-5710ca968be4,hostName=,domainName=,user=,attachStdin=,attachStdout=,attachStderr=,portSpecs=,tty=,stdinOpen=,stdInOnce=,env=,cmd=,healthcheck=,argsEscaped=,entrypoint=,image=testcontainersofficial/ryuk:0.3.0,volumes=com.github.dockerjava.api.model.Volumes#4263b080,workingDir=,macAddress=,onBuild=,networkDisabled=,exposedPorts=com.github.dockerjava.api.model.ExposedPorts#2af616d3,stopSignal=,stopTimeout=,hostConfig=HostConfig(binds=[//var/run/docker.sock:/var/run/docker.sock:rw], blkioWeight=null, blkioWeightDevice=null, blkioDeviceReadBps=null, blkioDeviceWriteBps=null, blkioDeviceReadIOps=null, blkioDeviceWriteIOps=null, memorySwappiness=null, nanoCPUs=null, capAdd=null, capDrop=null, containerIDFile=null, cpuPeriod=null, cpuRealtimePeriod=null, cpuRealtimeRuntime=null, cpuShares=null, cpuQuota=null, cpusetCpus=null, cpusetMems=null, devices=null, deviceCgroupRules=null, deviceRequests=null, diskQuota=null, dns=null, dnsOptions=null, dnsSearch=null, extraHosts=null, groupAdd=null, ipcMode=null, cgroup=null, links=[], logConfig=com.github.dockerjava.api.model.LogConfig#5910de75, lxcConf=null, memory=null, memorySwap=null, memoryReservation=null, kernelMemory=null, networkMode=null, oomKillDisable=null, init=null, autoRemove=true, oomScoreAdj=null, portBindings=null, privileged=false, publishAllPorts=true, readonlyRootfs=null, restartPolicy=null, ulimits=null, cpuCount=null, cpuPercent=null, ioMaximumIOps=null, ioMaximumBandwidth=null, volumesFrom=null, mounts=null, pidMode=null, isolation=null, securityOpts=null, storageOpt=null, cgroupParent=null, volumeDriver=null, shmSize=null, pidsLimit=null, runtime=null, tmpFs=null, utSMode=null, usernsMode=null, sysctls=null, consoleSize=null),labels={org.testcontainers=true},shell=,networkingConfig=,ipv4Address=,ipv6Address=,aliases=,authConfig=AuthConfig(username=githubactions, password=3d6472b9-3d49-4d17-9fc9-90d24258043b, email=null, registryAddress=https://index.docker.io/v1/, auth=Z2l0aHViYWN0aW9uczozZDY0NzJiOS0zZDQ5LTRkMTctOWZjOS05MGQyNDI1ODA0M2I=, registrytoken=null, identitytoken=null, stackOrchestrator=null)]
[INFO] Running com.AutoHedgeDaoTest
[WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.006 s - in com.AutoHedgeDaoTest
From above error log, an old version of testcontainers was in use.
Upgrading the testcontainers dependency to the latest version 1.15.2 fixed above issue.
I'm using Intellij with jdk 14 to build a seleninum test. I just want the console output as test report, result or error. I've tried many ways found on google or stackoverflow such as setting the loglevel, grep console but these messages still appear. Is there any way to resolve this issue? Here is the output:
16:44:14.551 [main] DEBUG io.netty.buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedByteBuffersPerChunk: 1023
16:44:14.559 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.allocator.type: pooled
16:44:14.560 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.threadLocalDirectBufferSize: 0
16:44:14.560 [main] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.maxThreadLocalCharBufferSize: 16384
Starting ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103#{#416}) on port 7431
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
16:44:15.681 [Forwarding newSession on session null to remote] DEBUG io.netty.channel.DefaultChannelId - -Dio.netty.processId: 17484 (auto-detected)
16:44:15.683 [Forwarding newSession on session null to remote] DEBUG io.netty.util.NetUtil - -Djava.net.preferIPv4Stack: false
16:44:15.683 [Forwarding newSession on session null to remote] DEBUG io.netty.util.NetUtil - -Djava.net.preferIPv6Addresses: false
16:44:15.689 [Forwarding newSession on session null to remote] DEBUG io.netty.util.NetUtil - Loopback interface: lo (Software Loopback Interface 1, 127.0.0.1)
16:44:15.689 [Forwarding newSession on session null to remote] DEBUG io.netty.util.NetUtil - Failed to get SOMAXCONN from sysctl and file \proc\sys\net\core\somaxconn. Default: 200
16:44:15.696 [Forwarding newSession on session null to remote] DEBUG io.netty.channel.DefaultChannelId - -Dio.netty.machineId: fc:aa:14:ff:fe:e6:1d:11 (auto-detected)
16:44:15.758 [AsyncHttpClient-3-1] DEBUG io.netty.buffer.AbstractByteBuf - -Dio.netty.buffer.checkAccessible: true
16:44:15.758 [AsyncHttpClient-3-1] DEBUG io.netty.buffer.AbstractByteBuf - -Dio.netty.buffer.checkBounds: true
16:44:15.759 [AsyncHttpClient-3-1] DEBUG io.netty.util.ResourceLeakDetectorFactory - Loaded default ResourceLeakDetector: io.netty.util.ResourceLeakDetector#3d005e97
16:44:15.777 [AsyncHttpClient-3-1] DEBUG org.asynchttpclient.netty.channel.NettyConnectListener - Using new Channel '[id: 0x09b55496, L:/127.0.0.1:54163 - R:localhost/127.0.0.1:7431]' for 'POST' to '/session'
16:44:15.829 [AsyncHttpClient-3-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.maxCapacityPerThread: 4096
16:44:15.829 [AsyncHttpClient-3-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.maxSharedCapacityFactor: 2
16:44:15.829 [AsyncHttpClient-3-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.linkCapacity: 16
16:44:15.830 [AsyncHttpClient-3-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.ratio: 8
16:44:20.511 [AsyncHttpClient-3-1] DEBUG org.asynchttpclient.netty.handler.HttpHandler -
Request DefaultHttpRequest(decodeResult: success, version: HTTP/1.1)
POST /session HTTP/1.1
User-Agent: selenium/4.0.0-alpha-6 (java windows)
Content-Length: 365
Content-Type: application/json; charset=utf-8
host: localhost:7431
accept: */*
What you really need to do is to set the log level on the console log handler (which is responsible for printing all log messages to the console). However doing this whilst using BasicConfigurator will be quite tricky to do, you are better off moving to having your logging configuration specified in a properties file (which is much more flexible).
I would advise working through the log4j logging configuration tutorial - this will help you put together exactly the configuration you want, and should prove a worthwhile investment of your time. However, if you want to get this done quickly, try adding the content below to the file log4j.properties (example taken from here):
# Root logger option
log4j.rootLogger=INFO, stdout
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
And then changing your code to do the following:
Properties props = new Properties();
props.load(new FileInputStream("/my/path/to/log4j.properties"));
PropertyConfigurator.configure(props);
For anyone with a similar request but using log4j, you could also use code to set up logging. The following removes the verbose netty debug messages:
BasicConfigurator.resetConfiguration();
Logger.getRootLogger().setLevel(Level.INFO);
String pattern = "%p: %m %n";
BasicConfigurator.configure(new ConsoleAppender(new PatternLayout(pattern)));
Hello I'm trying to implement this library in AWS lambda.
But I got stuck in
wordMLPackage = WordprocessingMLPackage.createPackage();
And the lambda would timeout.
I can execute the function in my local environment.
Anyone can help me here?
I'm Using Java JDK 8 for my local environment.
The lambda function has execution basic role and s3 full permission with 1024MB of memory and 10 seconds of execution limit. The function is not in any VPC.
EDIT:
Here's my full log after adding log4j
`START RequestId: ab3cc460-ddfd-11e7-bb93-43bcee7d169c Version: $LATEST
Dec 10, 2017 10:58:42 PM pp.generator.docx.RequestFunctionHandler
handleRequest
INFO: Handling request
Dec 10, 2017 10:58:43 PM pp.generator.docx.RequestFunctionHandler
handleRequest
INFO: Creating Word processingMLPackage
DEBUG org.docx4j.utils.ResourceUtils .getResource line 70 - Attempting to load: docx4j.properties
0 [main] DEBUG org.docx4j.utils.ResourceUtils - Attempting to load: docx4j.properties
DEBUG org.docx4j.utils.ResourceUtils .getResource line 87 - Trying Thread.currentThread().getContextClassLoader()
10 [main] DEBUG org.docx4j.utils.ResourceUtils - Trying Thread.currentThread().getContextClassLoader()
WARN org.docx4j.utils.ResourceUtils .getResource line 96 - Couldn't get resource: docx4j.properties
11 [main] WARN org.docx4j.utils.ResourceUtils - Couldn't get resource: docx4j.properties
WARN org.docx4j.Docx4jProperties .init line 22 - Couldn't find/read docx4j.properties; docx4j.properties not found via classloader.
12 [main] WARN org.docx4j.Docx4jProperties - Couldn't find/read docx4j.properties; docx4j.properties not found via classloader.
INFO org.docx4j.jaxb.Context .<clinit> line 86 - java.vendor=Oracle Corporation
76 [main] INFO org.docx4j.jaxb.Context - java.vendor=Oracle Corporation
INFO org.docx4j.jaxb.Context .<clinit> line 87 - java.version=1.8.0_141
76 [main] INFO org.docx4j.jaxb.Context - java.version=1.8.0_141
DEBUG org.docx4j.utils.ResourceUtils .getResource line 70 - Attempting to load: org/docx4j/wml/jaxb.properties
172 [main] DEBUG org.docx4j.utils.ResourceUtils - Attempting to load: org/docx4j/wml/jaxb.properties
DEBUG org.docx4j.utils.ResourceUtils .getResource line 87 - Trying Thread.currentThread().getContextClassLoader()
172 [main] DEBUG org.docx4j.utils.ResourceUtils - Trying Thread.currentThread().getContextClassLoader()
DEBUG org.docx4j.utils.ResourceUtils .getResource line 94 - Not using MOXy, since no resource: org/docx4j/wml/jaxb.properties
189 [main] DEBUG org.docx4j.utils.ResourceUtils - Not using MOXy, since no resource: org/docx4j/wml/jaxb.properties
INFO org.docx4j.jaxb.NamespacePrefixMapperUtils .getPrefixMapper line 75 -
Using NamespacePrefixMapperSunInternal, which is suitable for Java 6
432 [main] INFO org.docx4j.jaxb.NamespacePrefixMapperUtils - Using NamespacePrefixMapperSunInternal, which is suitable for Java 6
END RequestId: ab3cc460-ddfd-11e7-bb93-43bcee7d169c
REPORT RequestId: ab3cc460-ddfd-11e7-bb93-43bcee7d169c Duration: 10003.62 ms Billed Duration: 10000 ms Memory Size: 1024 MB Max Memory Used: 127 MB
2017-12-10T22:58:52.783Z ab3cc460-ddfd-11e7-bb93-43bcee7d169c Task timed out after 10.00 seconds`
Posting this self-answered so when I break it again in a few months an answer will actually come up in google.
Simple Java project where Flyway API is used to migrate database schema. A resource directory of sql scripts following the V1__init.sql, V2__updateCustomerTable.sql convention is used to check against the schema_version metadata table and migrate if needed.
Everything works fine until the jar is proguarded. The sql scripts are definitely packed into the jar file, but they are not found:
2017-04-10 17:17:13,612 [main] DEBUG (?:?) - Validating migrations ...
2017-04-10 17:17:13,884 [main] DEBUG (?:?) - Scanning for classpath resources at 'classpath:db/migration/postgres' (Prefix: '', Suffix: '.sql')
2017-04-10 17:17:13,885 [main] DEBUG (?:?) - Determining location urls for classpath:db/migration/postgres using ClassLoader sun.misc.Launcher$AppClassLoader#8b819f ...
2017-04-10 17:17:13,885 [main] WARN (?:?) - Unable to resolve location classpath:db/migration/postgres
2017-04-10 17:17:13,899 [main] DEBUG (?:?) - Scanning for classpath resources at 'classpath:db/migration/postgres' (Prefix: 'V', Suffix: '.sql')
2017-04-10 17:17:13,900 [main] DEBUG (?:?) - Scanning for classpath resources at 'classpath:db/migration/postgres' (Prefix: 'R', Suffix: '.sql')
An un-proguarded jar finds them with the following log messages (note that it looks in the jar file now):
2017-04-10 17:07:16,612 [main] DEBUG (?:?) - Validating migrations ...
2017-04-10 17:07:16,613 [main] DEBUG (?:?) - Scanning for classpath resources at 'classpath:db/migration/postgres' (Prefix: 'V', Suffix: '.sql')
2017-04-10 17:07:16,614 [main] DEBUG (?:?) - Scanning URL: jar:file:/C:/Dev/Sanbox/myjar.jar!/db/migration/postgres
2017-04-10 17:07:16,614 [main] DEBUG (?:?) - JBoss VFS v2 available: false
2017-04-10 17:07:16,615 [main] DEBUG (?:?) - Filtering out resource: db/migration/postgres/ (filename: )
2017-04-10 17:07:16,615 [main] DEBUG (?:?) - Found resource: db/migration/postgres/V1__init.sql
2017-04-10 17:07:16,616 [main] DEBUG (?:?) - Found resource: db/migration/postgres/V2__updateCustomerTable.sql
The culprit was that you need to tell proguard to leave your db/migrations directory alone (or wherever you put your migration scripts) in your config file, else flyway will not be able to find your scripts even if they seem to be in the right place in the jar. This is the line I needed in my proguard config:
-keepdirectories db/migration/**
If you change where you put your sql scripts down the road, this config will also need to be updated.
I am following the example from here.
I also have the Eureka server running on localhost:8080.
As a next step I attempt to run the sample service, like this:
./gradlew :eureka-examples:runExampleService
Here is the output that I get:
$ ./gradlew :eureka-examples:runExampleService --stacktrace
Inferred project: eureka, version: 1.4.6-SNAPSHOT
Publication mavenNebula not found in project :.
[buildinfo] Properties file path was not found! (Relevant only for builds running on a CI Server)
Publication named 'mavenNebula' does not exist for project ':' in task ':artifactoryPublish'.
None of the specified publications matched for project ':' - nothing to publish.
:eureka-client:compileJava UP-TO-DATE
:eureka-client:processResources UP-TO-DATE
:eureka-client:classes UP-TO-DATE
:eureka-client:writeManifestProperties UP-TO-DATE
:eureka-client:jar
:eureka-examples:compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.7
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 warning
:eureka-examples:processResources UP-TO-DATE
:eureka-examples:classes
:eureka-examples:runExampleService
[main] WARN com.netflix.config.sources.URLConfigurationSource - No URLs will be polled as dynamic configuration sources.
[main] INFO com.netflix.config.sources.URLConfigurationSource - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
[main] INFO com.netflix.config.DynamicPropertyFactory - DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration#46ee7fe8
[main] INFO com.netflix.config.util.ConfigurationUtils - Loaded properties file file:/Users/lenok/Documents/Programming/Github/eureka/eureka-examples/conf/sample-eureka-service.properties
[main] WARN com.netflix.config.util.ConfigurationUtils - file:/Users/lenok/Documents/Programming/Github/eureka/eureka-examples/conf/sample-eureka-service.properties is already loaded
[main] INFO com.netflix.appinfo.providers.EurekaConfigBasedInstanceInfoProvider - Setting initial instance status as: STARTING
[main] INFO com.netflix.discovery.provider.DiscoveryJerseyProvider - Using JSON encoding codec LegacyJacksonJson
[main] INFO com.netflix.discovery.provider.DiscoveryJerseyProvider - Using JSON decoding codec LegacyJacksonJson
[main] INFO com.netflix.discovery.provider.DiscoveryJerseyProvider - Using XML encoding codec XStreamXml
[main] INFO com.netflix.discovery.provider.DiscoveryJerseyProvider - Using XML decoding codec XStreamXml
[main] INFO com.netflix.discovery.shared.resolver.aws.ConfigClusterResolver - Resolving eureka endpoints via configuration
[main] INFO com.netflix.discovery.DiscoveryClient - Disable delta property : false
[main] INFO com.netflix.discovery.DiscoveryClient - Single vip registry refresh property : null
[main] INFO com.netflix.discovery.DiscoveryClient - Force full registry fetch : false
[main] INFO com.netflix.discovery.DiscoveryClient - Application is null : false
[main] INFO com.netflix.discovery.DiscoveryClient - Registered Applications size is zero : true
[main] INFO com.netflix.discovery.DiscoveryClient - Application version is -1: true
[main] INFO com.netflix.discovery.DiscoveryClient - Getting all instance registry info from the eureka server
[main] INFO com.netflix.discovery.DiscoveryClient - The response status is 200
[main] INFO com.netflix.discovery.DiscoveryClient - Starting heartbeat executor: renew interval is: 30
[main] INFO com.netflix.discovery.InstanceInfoReplicator - InstanceInfoReplicator onDemand update allowed rate per min is 4
Registering service to eureka with STARTING status
Simulating service initialization by sleeping for 2 seconds...
Done sleeping, now changing status to UP
[main] INFO com.netflix.discovery.DiscoveryClient - Saw local status change event StatusChangeEvent [timestamp=1458260744041, current=UP, previous=STARTING]
Waiting ... verifying service registration with eureka ...
[DiscoveryClient-InstanceInfoReplicator-0] INFO com.netflix.discovery.DiscoveryClient - DiscoveryClient_SAMPLEREGISTERINGSERVICE/Alenas-MacBook-Pro.local: registering service...
[DiscoveryClient-InstanceInfoReplicator-0] INFO com.netflix.discovery.DiscoveryClient - DiscoveryClient_SAMPLEREGISTERINGSERVICE/Alenas-MacBook-Pro.local - registration status: 204
Waiting ... verifying service registration with eureka ...
Waiting ... verifying service registration with eureka ...
Service started and ready to process requests..
> Building 88% > :eureka-examples:runExampleService
After I start the client, like this:
$ ./gradlew :eureka-examples:runExampleClient
Inferred project: eureka, version: 1.4.6-SNAPSHOT
Publication mavenNebula not found in project :.
[buildinfo] Properties file path was not found! (Relevant only for builds running on a CI Server)
Publication named 'mavenNebula' does not exist for project ':' in task ':artifactoryPublish'.
None of the specified publications matched for project ':' - nothing to publish.
:eureka-client:compileJava UP-TO-DATE
:eureka-client:processResources UP-TO-DATE
:eureka-client:classes UP-TO-DATE
:eureka-client:writeManifestProperties UP-TO-DATE
:eureka-client:jar
:eureka-examples:compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.7
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 warning
:eureka-examples:processResources UP-TO-DATE
:eureka-examples:classes
:eureka-examples:runExampleClient
[main] WARN com.netflix.config.sources.URLConfigurationSource - No URLs will be polled as dynamic configuration sources.
[main] INFO com.netflix.config.sources.URLConfigurationSource - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
[main] INFO com.netflix.config.DynamicPropertyFactory - DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration#46ee7fe8
[main] INFO com.netflix.config.util.ConfigurationUtils - Loaded properties file file:/Users/lenok/Documents/Programming/Github/eureka/eureka-examples/conf/sample-eureka-client.properties
[main] WARN com.netflix.config.util.ConfigurationUtils - file:/Users/lenok/Documents/Programming/Github/eureka/eureka-examples/conf/sample-eureka-client.properties is already loaded
[main] INFO com.netflix.appinfo.providers.EurekaConfigBasedInstanceInfoProvider - Setting initial instance status as: STARTING
[main] INFO com.netflix.discovery.provider.DiscoveryJerseyProvider - Using JSON encoding codec LegacyJacksonJson
[main] INFO com.netflix.discovery.provider.DiscoveryJerseyProvider - Using JSON decoding codec JacksonJson
[main] INFO com.netflix.discovery.provider.DiscoveryJerseyProvider - Using XML encoding codec XStreamXml
[main] INFO com.netflix.discovery.provider.DiscoveryJerseyProvider - Using XML decoding codec XStreamXml
[main] INFO com.netflix.discovery.shared.resolver.aws.ConfigClusterResolver - Resolving eureka endpoints via configuration
[main] INFO com.netflix.discovery.DiscoveryClient - Disable delta property : false
[main] INFO com.netflix.discovery.DiscoveryClient - Single vip registry refresh property : null
[main] INFO com.netflix.discovery.DiscoveryClient - Force full registry fetch : false
[main] INFO com.netflix.discovery.DiscoveryClient - Application is null : false
[main] INFO com.netflix.discovery.DiscoveryClient - Registered Applications size is zero : true
[main] INFO com.netflix.discovery.DiscoveryClient - Application version is -1: true
[main] INFO com.netflix.discovery.DiscoveryClient - Getting all instance registry info from the eureka server
[main] INFO com.netflix.discovery.DiscoveryClient - The response status is 200
[main] INFO com.netflix.discovery.DiscoveryClient - Not registering with Eureka server per configuration
Found an instance of example service to talk to from eureka: sampleservice.mydomain.net:8001
healthCheckUrl: http://Alenas-MacBook-Pro.local:8001/healthcheck
override: UNKNOWN
Connected to server. Sending a sample request: FOO Thu Mar 17 17:11:33 PDT 2016
Waiting for server response..
Received response from server: BAR Thu Mar 17 17:11:33 PDT 2016
Exiting the client. Demo over..
BUILD SUCCESSFUL
Total time: 9.497 secs
It basically connects to the server and waits for response, etc.
At the same time on the service terminal I see the following happening. Sometimes when I do these actions I see the successful response on the eureka service:
Client got connected... processing request from the client
Received a request from the example client: FOO Thu Mar 17 17:30:16 PDT 2016
Sending the response to the client: BAR Thu Mar 17 17:30:16 PDT 2016
Simulating service doing work by sleeping for 10 seconds...
Removing registration from eureka
[main] INFO com.netflix.discovery.DiscoveryClient - DiscoveryClient_SAMPLEREGISTERINGSERVICE/Alenas-MacBook-Pro.local - deregister status: 200
Shutting down server. Demo over.
BUILD SUCCESSFUL
Total time: 4 mins 53.331 secs
And sometimes it gives errors, like here:
Client got connected... processing request from the client
Received a request from the example client: FOO Thu Mar 17 17:33:30 PDT 2016
Sending the response to the client: BAR Thu Mar 17 17:33:30 PDT 2016
Simulating service doing work by sleeping for 10 seconds...
Removing registration from eureka
Exception in thread "main" java.lang.NoClassDefFoundError: com/netflix/discovery/shared/transport/decorator/EurekaHttpClientDecorator$2
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.cancel(EurekaHttpClientDecorator.java:71)
at com.netflix.discovery.DiscoveryClient.unregister(DiscoveryClient.java:886)
at com.netflix.discovery.DiscoveryClient.shutdown(DiscoveryClient.java:869)
at com.netflix.eureka.ExampleServiceBase.stop(ExampleServiceBase.java:89)
at com.netflix.eureka.ExampleServiceBase.start(ExampleServiceBase.java:80)
at com.netflix.eureka.ExampleEurekaService.main(ExampleEurekaService.java:45)
Caused by: java.lang.ClassNotFoundException: com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$2
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 6 more
:eureka-examples:runExampleService FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':eureka-examples:runExampleService'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':eureka-examples:runExampleService'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:305)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:88)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:68)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:55)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:80)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:36)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:56)
Caused by: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:365)
at org.gradle.process.internal.DefaultJavaExecAction.execute(DefaultJavaExecAction.java:31)
at org.gradle.api.tasks.JavaExec.exec(JavaExec.java:60)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:218)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:211)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:200)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:579)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:562)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 47 more
BUILD FAILED
Total time: 1 mins 1.267 secs
Please, help me get the example properly running. What might be the problem?