I have a java Spring Boot app which is being packaged into a "thin jar" using the spring boot maven thin jar plugin. I followed instructions from here https://www.baeldung.com/spring-boot-thin-jar and it's all working great. I can deploy new versions of my app in lightweight jars while the production server running the app maintains its own .m2 repository, updating if the new thin jar lists any new dependencies.
Recently I wanted to include my own external library. This is hosted in a gitlab-maven package repository and accessed via an access token. I set this up following instructions here: https://docs.gitlab.com/ee/user/packages/maven_repository/
I've written a settings.xml and saved to home/user/.m2/settings.xml which includes the access token.
After that any mvn ... command is pulling the library into the repository as expected. So far so good.
However when I create my thin jar and try to run with java -jar thin-jar.jar it fails to get the library. The error is as follows:
$ java -Dthin.trace=true -jar thin-jar.jar
May 20, 2022 4:49:24 PM org.springframework.boot.loader.thin.ThinJarLauncher launch
INFO: Version: 1.0.28.RELEASE
May 20, 2022 4:49:24 PM org.springframework.boot.loader.thin.PathResolver resolve
INFO: Extracting dependencies from: jar:file:/home/user/thin-jar.jar!/, with profiles []
May 20, 2022 4:49:24 PM org.springframework.boot.loader.thin.PathResolver loadProperties
INFO: Searching for properties in: jar:file:/home/user/thin-jar.jar!/
May 20, 2022 4:49:24 PM org.springframework.boot.loader.thin.PathResolver loadProperties
INFO: Searching for properties in: classpath:/
May 20, 2022 4:49:24 PM org.springframework.boot.loader.thin.PathResolver loadProperties
INFO: Searching for properties in: file:./
May 20, 2022 4:49:24 PM org.springframework.boot.loader.thin.PathResolver extract
INFO: Extracting dependencies from: URL [jar:file:/home/user/thin-jar.jar!/META-INF/maven/my.group/thin-jar/pom.xml], with profiles []
May 20, 2022 4:49:24 PM org.springframework.boot.loader.thin.MavenSettingsReader loadSettings
INFO: Reading settings from: /home/user/.m2/settings.xml
May 20, 2022 4:49:24 PM org.springframework.boot.loader.thin.DependencyResolver dependencies
INFO: Computing dependencies from pom and properties
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.boot.loader.wrapper.ThinJarWrapper.launch(ThinJarWrapper.java:139)
at org.springframework.boot.loader.wrapper.ThinJarWrapper.main(ThinJarWrapper.java:107)
Caused by: java.lang.RuntimeException: Failed to read artifact descriptor for my.group:external-library:jar:0.0.1-dev
at org.springframework.boot.loader.thin.DependencyResolver.dependencies(DependencyResolver.java:239)
at org.springframework.boot.loader.thin.PathResolver.extract(PathResolver.java:259)
at org.springframework.boot.loader.thin.PathResolver.resolve(PathResolver.java:105)
at org.springframework.boot.loader.thin.ThinJarLauncher.getClassPathArchives(ThinJarLauncher.java:369)
at org.springframework.boot.loader.thin.ThinJarLauncher.getClassPathArchives(ThinJarLauncher.java:352)
at org.springframework.boot.loader.thin.ThinJarLauncher.getClassPathArchivesIterator(ThinJarLauncher.java:200)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:55)
at org.springframework.boot.loader.thin.ThinJarLauncher.launch(ThinJarLauncher.java:195)
at org.springframework.boot.loader.thin.ThinJarLauncher.main(ThinJarLauncher.java:141)
... 6 more
I'm assuming this is because the repository is private and somewhere along the way the authentication is failing while trying to pull that library? Looking at the trace it appears to load the settings file properly, so where is it going wrong?
Related
I'm having trouble creating an agent with JADE.
My structure
/
Applications
jade
lib
jade.jar
jadeExamples.jar
src
examples
hello
HelloWorldAgent.class
HelloWorldAgent.java
My file HelloWorldAgent.java
package examples.hello;
import jade.core.Agent;
public class HelloWorldAgent extends Agent {
protected void setup() {
System.out.println("Hello! My name is "+getLocalName());
}
}
The steps I follow to create an agent :
/Applications/jade/src/examples/hello $ javac *.java
/Applications/jade/src/examples/hello $ java jade.Boot -gui -agents fred:examples.hello.HelloWorldAgent
Myclasspath
/Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home:/Applications/jade/lib/jade.jar:/Applications/jade/lib/jadeExamples.jar:/Applications/jade/src/
The output
Sep 21, 2019 5:28:05 PM jade.core.Runtime beginContainer
INFO: ----------------------------------
This is JADE 4.5.0 - revision 6825 of 23-05-2017 10:06:04
downloaded in Open Source, under LGPL restrictions,
at http://jade.tilab.com/
----------------------------------------
Sep 21, 2019 5:28:05 PM jade.imtp.leap.LEAPIMTPManager initialize
INFO: Listening for intra-platform commands on address:
- jicp://192.168.1.104:1099
Sep 21, 2019 5:28:06 PM jade.core.BaseService init
INFO: Service jade.core.management.AgentManagement initialized
Sep 21, 2019 5:28:06 PM jade.core.BaseService init
INFO: Service jade.core.messaging.Messaging initialized
Sep 21, 2019 5:28:06 PM jade.core.BaseService init
INFO: Service jade.core.resource.ResourceManagement initialized
Sep 21, 2019 5:28:06 PM jade.core.BaseService init
INFO: Service jade.core.mobility.AgentMobility initialized
Sep 21, 2019 5:28:06 PM jade.core.BaseService init
INFO: Service jade.core.event.Notification initialized
Sep 21, 2019 5:28:11 PM jade.mtp.http.HTTPServer <init>
INFO: HTTP-MTP Using XML parser com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser
Sep 21, 2019 5:28:11 PM jade.core.messaging.MessagingService boot
INFO: MTP addresses:
http://192.168.1.104:7778/acc
Hello World! My name is fred
Sep 21, 2019 5:28:11 PM jade.core.AgentContainerImpl joinPlatform
INFO: --------------------------------------
Agent container Main-Container#192.168.1.104 is ready.
--------------------------------------------
My problem
If I change the message in the HelloWorldAgent (e.g. System.out.println("Hello ! My name is "+getLocalName());), it doesn't update when I run my agent (the console says Hello World! My name is fred). And when I create a new class in the hello folder, I can't find my agent in the GUI.
What have I missed?
You have not set the classpath correctly. As mentioned in the accepted answer to 'What is a classpath and how do I set it?', your classpath can contain two entry types:
So, classpaths contain:
JAR files, and
Paths to the top of package hierarchies.
In your case you have reference ONLY the following .jar files :
/Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home
/Applications/jade/lib/jade.jar
/Applications/jade/lib/jadeExamples.jar
Notice that your working path /Applications/jade/src/examples/hello/ is not in the classpath. This means that your custom jade classes are not visible/accessable.
To solve your problem you have to add the additional paths you want to use in your classpaths. Usually you use the directory . to indicate that you want the "current directory" in your classpath.
Keep in mind that you have the JAR file jadeExamples.jar in your classpath. When you have a .class file for your changed HelloWorldAgent class it might not be clear which class the JVM is loading, the one from the JAR file or the .class file from the file system. Do not provide the same class with the same package in your classpath twice or even change the jadeExamples.jar file with a new changed JAR file (this might be even more confusing). Instead, create a new agent in YOUR package/namespace/directory and load it -agents foobar:your.package.and.ClassName, but ensure that the classpath is set correctly .
We are using Vert.X library to develop REST service layer to receive messages from many sources. Part of the requirements is to run REST verticle(s) in High availability (HA) mode. We are following vert.x core manual for implementation of VertX cluster to run in distributed cluster (3 nodes to start with).
Based on the documentation we did the following
Included hazelcast library in dependencies
io.vertx
vertx-hazelcast
3.3.0
Created a fat jar with the following manifest entries and added resources folder in classpath which has required configurations to load. We took hazelcast-default.xml from vertx-examples from github
log4j.properties
config.json
hazelcast-default.xml
io.vertx.core.Launcher
com.msg.verticles.RootVerticle
resources/
Created a script file to trigger the launcher
java -jar -Xmx2048m -Xms512m message-1.0-SNAPSHOT.jar -ha -D config=resources/config.json
Launcher fails to to pickup hazelcast-default.xml from resurce folder and stops with the following exception. Not sure what I am missing here.
$>java -jar -Xmx2048m -Xms512m message-1.0-SNAPSHOT.jar -ha -D config=resources/config.json
Jul 16, 2017 7:20:26 PM io.vertx.core.impl.launcher.commands.RunCommand
INFO: Starting clustering...
Jul 16, 2017 7:20:27 PM io.vertx.core.impl.launcher.commands.RunCommand
INFO: No cluster-host specified so using address 127.0.0.1
Jul 16, 2017 7:20:28 PM io.vertx.spi.cluster.hazelcast.HazelcastClusterManager
WARNING: Cannot find cluster configuration on 'vertx.hazelcast.config' system property, on the classpath, or specified programmatically. Using default hazelcast configuration
Jul 16, 2017 7:20:28 PM com.hazelcast.config.XmlConfigLocator
INFO: Loading 'hazelcast-default.xml' from classpath.
Jul 16, 2017 7:20:28 PM com.hazelcast.config.AbstractXmlConfigHelper
WARNING: Name of the hazelcast schema location incorrect using default
Jul 16, 2017 7:20:28 PM io.vertx.core.impl.VertxImpl
SEVERE: Failed to join cluster
com.hazelcast.core.HazelcastException: org.xml.sax.SAXParseException; schema_reference.4: Failed to read schema document 'null', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
at com.hazelcast.util.ExceptionUtil.peel(ExceptionUtil.java:73)
According to the documentation of Hazelcast cluster manager you need to specify your Hazelcast configuration in a file named cluster.xml in your classpath (either embedded in the root of your fatjar or in a directory that is in your classpath).
Solved the issue by configuring zookeeper as co-ordination service. Which worked like a champ!!
https://github.com/vert-x3/vertx-zookeeper
Launching GlassFish on Felix platform
gru 05, 2016 2:02:02 PM
com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner createBundleProvisioner
INFO: Create bundle provisioner class = class com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner.
gru 05, 2016 2:02:02 PM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner$DefaultCustomizer getLocations
**WARNING: Skipping entry because it is not an absolute URI.**
gru 05, 2016 2:02:02 PM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner$DefaultCustomizer getLocations
**WARNING: Skipping entry because it is not an absolute URI.**
gru 05, 2016 2:02:11 PM com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner startBundles
**WARNING: Can not start bundle file:/C:/Users/MyName/Desktop/Servers/glassfish4/glassfish/modules/core.jar because it is not contained in the list of installed bundles.**
Registered com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishRuntime#294d3883 in service registry.
I can't run my project.
What already I did:
- clear&build
- tryed to change ports from 8080 to 9090
- closed connections in TCPView on localports
- closed Java Binary process in task menager and still not working.
When i running project i got this:
C:\Users\MyName\Desktop\Java Web Profile\MyProject\nbproject\build-impl.xml:1048: The module has not been deployed.
See the server log for details.
1047-1049 lines from build-impl.xml:
<target if="netbeans.home" name="-run-deploy-nb">
<nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/>
</target>
Any ideas? :)
I found this solution/cause on another site, didn't resolve the issue for me but hopefully it can help you:
Reasons: In mac OS Sierra ,the new update blocks the sites which uses system proxy settings, where localhost,127.0.0.1 all connections are blocked.
Solution:
Step 1: Go to system preference >Network>Select your wifi connection>Advanced>select proxies tab.
There check 3 options 1) Auto proxy Discovery 2)Automatic Proxy configuration 3) web proxy(http)
Step 2: Go to Netbeans>preferences>General> select use system proxy> reload> test connection
You may get connection successful.
If connection gets successful, Now Clean & build your Applications in netbeans and press run .
Hope it will work . In my case it works.
https://discussions.apple.com/message/30715103#message30715103
https://netbeans.org/bugzilla/show_bug.cgi?id=268076
Trying to run my app with IntelliJ 13 and Apache tomcat 7.0.42. JDK1.6
Always getting the error Artifact app:war exploded: Server is not connected. Deploy is not available.
But when I deploy through terminal with catalina.sh start it works perfectly fine.
I referred this link for setup: http://confluence.jetbrains.com/display/IntelliJIDEA/Application+Servers
Any idea what am I missing?
Here is the Tomcat Catalina log:
Dec 29, 2014 11:43:29 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
Dec 29, 2014 11:43:29 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Dec 29, 2014 11:43:29 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Dec 29, 2014 11:43:29 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 614 ms
Dec 29, 2014 11:43:29 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Dec 29, 2014 11:43:29 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.42
Dec 29, 2014 11:43:29 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Dec 29, 2014 11:43:29 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Dec 29, 2014 11:43:29 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 44 ms
Dec 29, 2014 11:43:39 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /Users/yesuagg/apache-tomcat-7.0.42/webapps/manager
Exception in Event log
4:58:40 PM Compilation completed successfully with 104 warnings in 6 sec
4:58:42 PM Application Server was not connected before run configuration stop, reason:
java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection refused]
Please check this answer posted by Christian and also read that thread.
Tomcat deployment issue via IntelliJ
Simply try removing setenv.sh in $CATALINA_HOME/bin
I had this issue today and it wasn't due to setenv.sh as discussed on the other thread. In the end it was an issue with $CATALINA_BASE/conf/server.xml.
For some reason in our server.xml we were using a custom engine name for example
<Engine name="custom-value" defaultHost="localhost">
I tried again with a clean server.xml from tomcat 7.0.57 and the artifact deployed perfectly. After trial and error it came down to this one line.
Changing engine name to 'Catalina' as shown below value fixed our issue and allowed our exploded artifact to deploy using our customised server.xml
<Engine name="Catalina" defaultHost="localhost">
If you are seeing this issue try a clean server.xml and work backwards from there.
tomcat-7.0-doc RUNNING
(3.2) Set JRE_HOME or JAVA_HOME (required)
These variables are used to specify location of a Java Runtime
Environment or of a Java Development Kit that is used to start Tomcat.
The JRE_HOME variable is used to specify location of a JRE. The JAVA_HOME
variable is used to specify location of a JDK.
Using JAVA_HOME provides access to certain additional startup options that
are not allowed when JRE_HOME is used.
If both JRE_HOME and JAVA_HOME are specified, JRE_HOME is used.
In my case, Intellij IDEA doesn't support run tomcat8 installed from linux repositories.
/usr/share/tomcat/bin/catalina.sh start (not support)
/usr/share/tomcat/bin/catalina.sh run (supported)
Only tomcat8 installed from official website. I tried with distribution downloaded from http://tomcat.apache.org/download-80.cgi. So I got successful results.
The reason is in the catalina.sh file from linux distribution, where there isn't "run" command. But in the tomcat downloaded there is "run" command. catalina.sh_InstalledFromLinuxRepository
Do you set JAVA_OPTS anywhere in Tomcat bat/sh files?
If you do, make sure to keep previous values also - IDEA seems to use those to specify some connection options to Tomcat.
E.g. in .sh files do
JAVA_OPTS="<your new stuff> $JAVA_OPTS"
instead of just
JAVA_OPTS=<your new stuff>
P.S. Same answer as this actually: https://stackoverflow.com/a/28867346/307295
type Status report
message /mydirectory/index.jsp
description The requested resource (/mydirectory/index.jsp) is not available.
What could be the issue?
Here is the log file:
Jul 28, 2009 6:16:25 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Testing' did not find a matching property.
Jul 28, 2009 6:16:25 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\Intel\DMIX;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared\10.0\DLLShared\;c:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\SlikSvn\bin\;C:\Program Files\MySQL\MySQL Server 5.1\bin;C:\Sun\SDK\bin
Jul 28, 2009 6:16:25 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jul 28, 2009 6:16:25 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 447 ms
Jul 28, 2009 6:16:25 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jul 28, 2009 6:16:25 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.20
If you're using Eclipse 3.4 or 3.5 -- look at the Servers view in Eclipse. Against your server, you should see "Started" and "Synchronized". If it tells you to restart or republish, right-click on your server and do so.
Deploy your file again (you can drag your index.jsp file on to the server). Does it start this time?
If not, something could be wrong with your web.xml. Open the Console view and look at the server log -- do you notice any exceptions etc? You will need to resolve those.
First of all, check your server plug-in configuration:
When Tomcat within Eclipse publishes you Dynamic Web Project, all embedded tomcat useful files (conf, code, work) are stored in this following location:
<path_to_workspace>\.metadata\.plugins\org.eclipse.wst.server.core\tmp[0-9]
Check the deployment architecture, if you need more help regarding tomcat files architecture, see tomcat documentation