Maven compilation TimeOut error - java

I need to compile with a prod maven profile, so I execute the command:
mvnw package -Pprod -Dmaven.test.skip=true
But it gives me a Connection TimeOut error:
C:\Users\UserX\Desktop\Workspace\mecenz>mvnw package -Pprod -Dmaven.test.skip=tru
Downloading https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip
Exception in thread "main" java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1105)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:999)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1513)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at org.apache.maven.wrapper.DefaultDownloader.downloadInternal(DefaultDownloader.java:73)
at org.apache.maven.wrapper.DefaultDownloader.download(DefaultDownloader.java:60)
at org.apache.maven.wrapper.Installer.createDist(Installer.java:64)
at org.apache.maven.wrapper.WrapperExecutor.execute(WrapperExecutor.java:121)
at org.apache.maven.wrapper.MavenWrapperMain.main(MavenWrapperMain.java:50)
Here I have configured the proxy as it should be in the settings.xml of maven:
<proxies>
<proxy>
<id>the_id</id>
<active>true</active>
<protocol>http</protocol>
<!-- <username>proxyuser</username>
<password>proxypass</password>-->
<host>my proxy adresse</host>
<port>8080</port>
<nonProxyHosts>localhost</nonProxyHosts>
</proxy>
</proxies>
I really don't know what should I do more!
I have changed this URL in maven-wrraper.properties into:
https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip and yet gives me the same error.
How would you troubleshoot this?

You could simply set your HTTP_PROXY/HTTPS_PROXY environment variables to the same value as the one set in your settings.xml, and download maven yourself, without having to rely on an mvnw maven wrapper (presented in this article)
Simply fo to the Downloading Apache Maven 3.5.0 page, and get the Binary zip archive that you can uncompress anywhere you want. Add that folder to your PATH and you are set to use a regular mvn command.

Related

How to use Flink Metrics

I have an Apache Flink cluster with the standalone mode, I want to config Flink Metrics.
config in flink-conf.yaml
metrics.reporters: my_jmx_reporter,my_other_reporter
metrics.reporter.my_jmx_reporter.class: org.apache.flink.metrics.jmx.JMXReporter
metrics.reporter.my_jmx_reporter.port: 9020-9040
metrics.reporter.my_other_reporter.class: org.apache.flink.metrics.graphite.GraphiteReporter
metrics.reporter.my_other_reporter.host: 10.0.0.203
metrics.reporter.my_other_reporter.port: 10000
exception
2019-01-17 20:54:25.758 [Flink-MetricRegistry-thread-1] WARN com.codahale.metrics.graphite.GraphiteReporter - Unable to report to Graphite
java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at java.net.Socket.<init>(Socket.java:434)
at java.net.Socket.<init>(Socket.java:244)
at javax.net.DefaultSocketFactory.createSocket(SocketFactory.java:277)
at com.codahale.metrics.graphite.Graphite.connect(Graphite.java:128)
at com.codahale.metrics.graphite.GraphiteReporter.report(GraphiteReporter.java:166)
at org.apache.flink.dropwizard.ScheduledDropwizardReporter.report(ScheduledDropwizardReporter.java:231)
at org.apache.flink.runtime.metrics.MetricRegistryImpl$ReporterTask.run(MetricRegistryImpl.java:427)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
what do I need to do
use a program listen 10000 port on 10.0.0.203 or other something
Yes, you are reporting to host 10.0.0.203:10000, so you need a program listening port 10000 on 10.0.0.203. Otherwise flink is unable to send message to it. In this case, you need to start Graphite on this host. See the doc.
Which service does your company use as the metric service?Then you should implement flink metric reporter to report that service。
For example open falcon, opentsdb and so on.

Jenkins connection refused

I have this weird problem. Jenkins on the machine suddenly stopped working. Though another jenkins server works file (Which is a slave). But for this jenkins instance (Standalone) it gives connection refused error.
It is a windows machine.
java -jar agent.jar -jnlpUrl http://<MachineName>:8080/computer/<MachineName>/slave-agent.jnlp -secret ce4
1f56fdf579e393a74cb5d0b539353628d6d524c4f0d518bd3cfc523f2292b -workDir "C:\Users
\<UserName>\Jenkins-slave"
Picked up _JAVA_OPTIONS: -Xmx1024M
Sep 26, 2018 11:52:40 AM org.jenkinsci.remoting.engine.WorkDirManager initialize
WorkDir
INFO: Using C:\Users\<UserName>\Jenkins-slave\remoting as a remoting work dir
ectory
Both error and output logs will be printed to C:\Users\<UserName>\Jenkins-sla
ve\remoting
Failing to obtain http://<MachineName>:8080/computer/<MachineName>/slave-agent.jnlp?
encrypt=true
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketI
mpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.ja
va:345)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocket
Impl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java
:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
at sun.net.www.http.HttpClient.New(HttpClient.java:308)
at sun.net.www.http.HttpClient.New(HttpClient.java:326)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLC
onnection.java:1168)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConn
ection.java:1104)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConne
ction.java:998)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection
.java:932)
at hudson.remoting.Launcher.parseJnlpArguments(Launcher.java:490)
at hudson.remoting.Launcher.run(Launcher.java:322)
at hudson.remoting.Launcher.main(Launcher.java:283)

Eclipse fails to update Maven index while behind company proxy

Eclipse Mars m2e plugin fails to download repository index updates on startup. I run Eclipse behind a company firewall but the proxy settings work fine for "check for updates", "eclipse marketplace", and eclipse's built-in browser.
I have tried the following:
Deleting the cache directory \eclipse\p2\org.eclipse.equinox.p2.repository\cache and then refreshing the repositories. Preferences -> Install Update -> Available Software Sites => select the entry and click "Reload"
Adding -Djava.net.preferIPv4Stack=true to -vmargs in eclipse.ini
Edit: Proxy configurations are correctly set in $HOME/.m2/settings.xml
Edit: Seems like a bug. So I raised a bug request with eclipse.org. You can view it here
Due to this issue, eclipse fails to search and add dependency from maven repositories.
Here is the error in .metadata/.log
eclipse.buildId=4.5.0.I20150603-2000
java.version=1.8.0_60
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_IN
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product
!ENTRY org.eclipse.m2e.logback.appender 4 0 2015-09-30 14:39:59.820
!MESSAGE Unable to update index for central|https://repo.maven.apache.org/maven2
!STACK 0
java.net.ConnectException: Connection timed out: connect
at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at com.squareup.okhttp.internal.Platform.connectSocket(Platform.java:107)
at com.squareup.okhttp.Connection.connect(Connection.java:156)
at com.squareup.okhttp.Connection.connectAndSetOwner(Connection.java:175)
at com.squareup.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:120)
at com.squareup.okhttp.internal.http.HttpEngine.nextConnection(HttpEngine.java:330)
at com.squareup.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:319)
at com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:241)
at com.squareup.okhttp.Call.getResponse(Call.java:271)
at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:228)
at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:199)
at com.squareup.okhttp.Call.execute(Call.java:79)
at io.takari.aether.okhttp.OkHttpAetherClient.execute(OkHttpAetherClient.java:154)
at io.takari.aether.okhttp.OkHttpAetherClient.get(OkHttpAetherClient.java:100)
at org.eclipse.m2e.core.internal.index.nexus.AetherClientResourceFetcher.retrieve(AetherClientResourceFetcher.java:79)
at org.apache.maven.index.updater.AbstractResourceFetcher.retrieve(AbstractResourceFetcher.java:35)
at org.apache.maven.index.updater.DefaultIndexUpdater.downloadIndexProperties(DefaultIndexUpdater.java:452)
at org.apache.maven.index.updater.DefaultIndexUpdater.access$100(DefaultIndexUpdater.java:75)
at org.apache.maven.index.updater.DefaultIndexUpdater$IndexAdaptor.setProperties(DefaultIndexUpdater.java:607)
at org.apache.maven.index.updater.DefaultIndexUpdater.fetchAndUpdateIndex(DefaultIndexUpdater.java:788)
at org.apache.maven.index.updater.DefaultIndexUpdater.fetchAndUpdateIndex(DefaultIndexUpdater.java:135)
at org.eclipse.m2e.core.internal.index.nexus.NexusIndexManager.updateRemoteIndex(NexusIndexManager.java:1127)
at org.eclipse.m2e.core.internal.index.nexus.NexusIndexManager.updateIndex(NexusIndexManager.java:1084)
at org.eclipse.m2e.core.internal.index.nexus.NexusIndexManager$1.run(NexusIndexManager.java:656)
at org.eclipse.m2e.core.internal.index.nexus.IndexUpdaterJob.run(IndexUpdaterJob.java:72)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
I've found solution. It's quite simple. After some code investigation I've found following thing:
https://github.com/eclipse/m2e-core/blob/releases/1.6/1.6.2.20150902-0002/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/embedder/MavenImpl.java#L1226
So m2e scans proxy list and trying to find correct by protocol. If you look at central url: https://repo.maven.apache.org/maven2. It's starts from "https".
Your proxy settings should looks like that (one proxy for http and second for https):
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>myproxy.company.com</host>
<port>8080</port>
</proxy>
<proxy>
<active>true</active>
<protocol>https</protocol>
<host>myproxy.company.com</host>
<port>8080</port>
</proxy>
</proxies>
Although you have configured proxy in eclispe, you have to do the same config for maven, into settinggs.xml file. Here you have my proxy configuration section:
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>myproxy.company.com</host>
<port>8080</port>
</proxy>
</proxies>
Then you have to ensure in eclipse that you are using the configured settings.xml file, in window->preferences-maven->user settings.
Hope it helps.
Maven uses its own proxy settings, defined in .m2/settings.xml. You can find the settings used my m2e plugin in Eclipse's menu: Windows / Preferences / Maven / User Settings. Remember to hit the Update Settings -button after editing:
<!-- proxies
| This is a list of proxies which can be used on this machine to connect to the network.
| Unless otherwise specified (by system property or command-line switch), the first proxy
| specification in this list marked as active will be used.
|-->
<proxies>
<!-- proxy
| Specification for one proxy, to be used in connecting to the network.
|
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>proxyuser</username>
<password>proxypass</password>
<host>proxy.host.net</host>
<port>80</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
-->
</proxies>

maven-shade-plugin ConnectException: Connection refused for getting java.sun.com DTD (processed by XMLAppendingTransformer for building Apache CXF)

I have tried to build an old version of Apache CXF, because in our legacy project we are using version Apache CXF 2.2.2, but I get this error when building the full library (with Maven 3.2.5):
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:1.2:shade (default)
on project cxf-bundle: Error creating shaded jar. Connection refused: connect
By looking in the stack-trace, I've noticed this:
org.apache.maven.plugins.shade.resource.XmlAppendingTransformer.processResource(XmlAppendingTransformer.java:61)
and also:
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1282)
Here is the full stack-trace:
mvn -e -Pfastinstall,everything
................................................
................................................
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:1.2:shade (default) on project cxf-bundle: Error creating shaded jar. Connection refused: connect -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:1.2:shade (default) on project cxf-bundle: Error creating shaded jar.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error creating shaded jar.
at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:403)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
at sun.net.www.http.HttpClient.New(HttpClient.java:306)
at sun.net.www.http.HttpClient.New(HttpClient.java:323)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:852)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:793)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:718)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1041)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:677)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1315)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1282)
at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:283)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1193)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1090)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1003)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:453)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:770)
at org.apache.maven.plugins.shade.resource.XmlAppendingTransformer.processResource(XmlAppendingTransformer.java:61)
at org.apache.maven.plugins.shade.DefaultShader.resourceTransformed(DefaultShader.java:249)
at org.apache.maven.plugins.shade.DefaultShader.shade(DefaultShader.java:109)
at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:361)
... 21 more
Because it is mentioning an XmlAppendingTransformer and XMLEntityManager.startDTDEntity, then I imagine that it's related to some DTD reference which is no longer valid, such as the one which appears in META-INF/cxf/extensions.xml:
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
But how can I fix this?
I am running Maven behind a corporate http proxy, and I already configured the proxy in my settings.xml but I still get the "Cannot connect" error.
I have also tried with:
mvn -Dhttp.proxyHost=myproxy -Dhttp.proxyPort=myport -Dhttp.proxyUser=myuser -Dhttp.proxyPassword=mypassword -Pfastinstall,everything
but then I get this error:
java.io.IOException: Server returned HTTP response code: 407 for URL: http://java.sun.com/dtd/properties.dtd
How can I skip the checking of the DTD by the XMLAppendingTransformer ?
After some more digging around, I have found that maven-shade-plugin has an option to ignoreDtd (which is actually even enabled by default), but it was only introduced in version 1.3.1, whereas Apache CXF 2.2.2 is using maven-shade-plugin version 1.2:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.2</version>
</plugin>
So my solution was to upgrade the maven-shade-plugin to version 1.3.1 inside the main pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.3.1</version>
</plugin>
But then I started getting another error, which is of a very different nature, so I documented it here:
An API incompatibility was encountered while executing org.apache.maven.plugins:maven-shade-plugin:1.3.1:shade: java.lang.AbstractMethodError: null

Eclipse equivalent of mvn tomcat6:run?

I have created tomcat project by Eclipse means. I selected tomcat archetype at archetype selection stage. It crated 6 directories for a project, including "-api", "-api-impl" and etc.
Now how can I run something?
At the command line I can issue
mvn tomcat6:run
or
mvn tomcat7:run
and it will run.
How to do the same from within eclipse?
UPDATE
Probably this command is equivalent to ->Debug As... and entering "tomcat6:run" into "goals". But in this case I get errors like
Downloading: http://repo.maven.apache.org/maven2/org/apache/tomcat/maven/tomcat6-maven-plugin/2.1/tomcat6-maven-plugin-2.1.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.tomcat.maven:tomcat6-maven-plugin:2.1: Plugin org.apache.tomcat.maven:tomcat6-maven-plugin:2.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.tomcat.maven:tomcat6-maven-plugin:jar:2.1
UPDATE 2
If I set debug output, I get "connection refused" exceptions:
[DEBUG] Resolving plugin prefix tomcat6 from [org.apache.maven.plugins, org.codehaus.mojo]
[DEBUG] Using connector WagonRepositoryConnector with priority 0 for http://repo.maven.apache.org/maven2
Downloading: http://repo.maven.apache.org/maven2/org/apache/tomcat/maven/tomcat6-maven-plugin/2.1/tomcat6-maven-plugin-2.1.pom
[DEBUG] Writing resolution tracking file D:\Users\Dims\Design\!Lib\!m2\repository\org\apache\tomcat\maven\tomcat6-maven-plugin\2.1\tomcat6-maven-plugin-2.1.pom.lastUpdated
[WARNING] Failed to retrieve plugin descriptor for org.apache.tomcat.maven:tomcat6-maven-plugin:2.1: Plugin org.apache.tomcat.maven:tomcat6-maven-plugin:2.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.tomcat.maven:tomcat6-maven-plugin:jar:2.1
org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.tomcat.maven:tomcat6-maven-plugin:2.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.tomcat.maven:tomcat6-maven-plugin:jar:2.1
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:129)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:142)
at org.apache.maven.plugin.DefaultBuildPluginManager.loadPlugin(DefaultBuildPluginManager.java:59)
at org.apache.maven.plugin.prefix.internal.DefaultPluginPrefixResolver.resolveFromProject(DefaultPluginPrefixResolver.java:139)
at org.apache.maven.plugin.prefix.internal.DefaultPluginPrefixResolver.resolveFromProject(DefaultPluginPrefixResolver.java:122)
at org.apache.maven.plugin.prefix.internal.DefaultPluginPrefixResolver.resolve(DefaultPluginPrefixResolver.java:86)
at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.findPluginForPrefix(MojoDescriptorCreator.java:262)
at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.getMojoDescriptor(MojoDescriptorCreator.java:222)
at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments(DefaultLifecycleTaskSegmentCalculator.java:106)
at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments(DefaultLifecycleTaskSegmentCalculator.java:86)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:98)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.tomcat.maven:tomcat6-maven-plugin:jar:2.1
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:296)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186)
at org.sonatype.aether.impl.internal.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:279)
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:115)
... 23 more
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.apache.tomcat.maven:tomcat6-maven-plugin:pom:2.1 from/to central (http://repo.maven.apache.org/maven2): Connection to http://repo.maven.apache.org refused
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:281)
... 26 more
Caused by: org.sonatype.aether.transfer.ArtifactTransferException: Could not transfer artifact org.apache.tomcat.maven:tomcat6-maven-plugin:pom:2.1 from/to central (http://repo.maven.apache.org/maven2): Connection to http://repo.maven.apache.org refused
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:951)
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:941)
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:669)
at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.apache.maven.wagon.TransferFailedException: Connection to http://repo.maven.apache.org refused
at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:799)
at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:601)
... 4 more
Caused by: org.apache.maven.wagon.providers.http.httpclient.conn.HttpHostConnectException: Connection to http://repo.maven.apache.org refused
at org.apache.maven.wagon.providers.http.httpclient.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:158)
at org.apache.maven.wagon.providers.http.httpclient.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)
at org.apache.maven.wagon.providers.http.httpclient.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:121)
at org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:573)
at org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:425)
at org.apache.maven.wagon.providers.http.httpclient.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
at org.apache.maven.wagon.providers.http.httpclient.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.execute(AbstractHttpClientWagon.java:674)
at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:793)
... 8 more
Caused by: java.net.ConnectException: connect: Address is invalid on local machine, or port is not valid on remote machine
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:69)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:337)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:198)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:157)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
at java.net.Socket.connect(Socket.java:579)
at org.apache.maven.wagon.providers.http.httpclient.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:123)
at org.apache.maven.wagon.providers.http.httpclient.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:148)
... 16 more
SOLUTION
Antivirus' firewall was preventing eclipse from accessing web. So, running goal from within eclipse was failing.
This tutorial should help you set up Tomcat with Eclipse. However above commands are Maven. There is Maven plugin for Eclipse but there are number of complains. So if Tomcat on Eclipse on your mind use first link, if Maven is priority get the plugin

Categories