Using Nexus as feature repository - java

Is there a way to add a secured Nexus repository as feature repository to Apache Karaf?
I tried to run the command:
karaf#root()> feature:repo-add http://<user>:<password>#<my-repository>
But I get the following error:
Adding feature url http://<user>:<password>#<my-repository> Error executing command: Server returned HTTP response code: 401 for URL: http://<user>:<password>#<my-repository>
I'm using Apache Karaf 3.0.0.
Thanks,
Mickael

The solution is simple.
Install Maven on the server on which Karaf is running and configure it. Generally, you will configure it through the file settings.xml present in ~/.m2. The credentials for accessing the Nexus repository are indicated in the file.
Finally, instead of using an HTTP URL for referencing your feature, use a Maven URL of the form:
mvn:<groupId>/<artifactId>/<version>/xml/features
The feature will be resolved through Maven.

You can add your own Maven repository to org.ops4j.pax.url.mvn.repositories.
config:edit org.ops4j.pax.url.mvn
config:property-set org.ops4j.pax.url.mvn.repositories http://your.nexus.repo/here
config:update

Related

Spring Config-server throwing 404 on config file only from my git repository

I've been following this microservices tutorial and launching the config server with these properties:
spring.application.name=configuration-server
server.port=8888
spring.cloud.config.server.git.uri=https://github.com/sylleryum/microservices-config-server
spring.cloud.config.server.git.clone-on-start=true
the config server runs fine, but when trying to access it through http://localhost:8888/order-service/default i get a 404.
if i change the spring.cloud.config.server.git.uri to https://github.com/SaiUpadhyayula/microservices-config-server which has exactly the same files, it works.
found out, apparently the config files have to be on master branch

Spring Cloud config authentication with AWS Code Commit

I'm novice to use spring cloud config server, so is first time for me and i hope i can receive help, thanks in advance for this.
What i can try to do is to configure Spring cloud Configuration Server as central server for configurations among all Microservices.
We are using AWS CodeCommit as SCM repository.
The problem is that i receive always the same error once i try to inve an existing file on AWS CC.
I suppose is a problem of authentication, but i'm not sure
Error screenshot
This is the bootstrap configuration on Spring CSC
server.port=9090
management.security.enabled=false
logging.level.org.springframework.web: TRACE
spring.application.name=config-service
spring.cloud.config.server.git.uri: https://git-codecommit.eu-west-1.amazonaws.com/v1/repos/ServiceLayer
This is the file in my SCM repository that i'm trying to call:
configuration:
projectName: ms-login
server:
port: 8000
message:
greeting: Hello from the configuration
I've make a several try:
Placed the AWS GIT Credential (NOT the AWS Secret key) in bootstrap properties, but without result. Example:
spring.cloud.config.server.git.username: sergio.greco-at-682088819034
spring.cloud.config.server.git.password: xxxxxxx
Placed the AWS Secret Key \ Identity ID as java parameter once start, as follow:
-Daws.accessKeyId=xxxxxxxxYNOA -Daws.secretKey=xxxxxxxxxxxxxxxx
Set environment variables AWS_ACCESS_KEY_ID \ AWS_SECRET_ACCESS_KEY.
Can someone help me?
You need has the AWS SDK in the classpath.
Relevant documentation on this: http://cloud.spring.io/spring-cloud-static/spring-cloud-config/1.3.1.RELEASE/
Search for “Authentication with AWS CodeCommit”.
Note: The aws-java-sdk-core jar is an optional dependency. If the aws-java-sdk-core jar is not on your classpath, then the AWS Code Commit credential provider will not be created regardless of the git server URI.

Apache Cayenne "DI container has no binding for key ObjectContextFactory" error

I'm using Apache 4.0 BETA and I'm getting the following runtime error:
org.apache.cayenne.di.DIRuntimeException: DI container has no binding for key <BindingKey: org.apache.cayenne.configuration.ObjectContextFactory>
at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:158)
at org.apache.cayenne.di.spi.DefaultInjector.getProvider(DefaultInjector.java:144)
at org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:134)
at org.apache.cayenne.configuration.CayenneRuntime.newContext(CayenneRuntime.java:124)
As Cayenne is modular, I've included only these dependencies (see pic).
What library needs to be included?
Thanks!
(The backend db is postgres but I don't this this is relavant to this error.)
I resolved this problem myself. Turns out that I need to build the artifact with "copy to output directory and link via manifest" (using IntelliJ IDEA) and upload the entire generated _jar directory to the server.

checking out project from svn access forbidden

i want to check out a project from svn,but it gives an error(the server is actually runnig)
URL access forbidden for unknown reason
svn: Unable to connect to a repository at URL 'http:.................'
svn: Access to '............' forbidden
The error means that your user account does not have permissions to read the repository path you want to checkout. Contact your manager or server / repository admin for assistance with this issue.
It seems the issue is with a wrong repository access path configuration in svn server.
For e.g. if you are trying to access repository path
yoursvnserver.com/repo/projectRepository/trunk
and svn repository access rules is set wrong as below you could face the mentioned error. Please check with your svn server admin to fix this.
[groups]
superUser=admin
projectDev=user1,user2
[projectRepository:trunk]
#projectDev=r
[projectRepository:/branches]
#projectDev=rw

Gradle build is failing [Could not resolve all dependencies for configuration ':compile'.]

I am trying for so many days to resolve this exception , followed many blogs and couldn't find solution. when I run a bundle.gradle by giving jettyRun as command
I am getting an exception
**FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all dependencies for configuration ':compile'.
> Could not resolve javax.servlet:servlet-api:2.5.
Required by:
:1-SimpleServlet:unspecified
> Could not GET 'http://repo1.maven.org/maven2/javax/servlet/servlet-api/2.5/servlet-api-2.5.pom'.
> Connection to http://repo1.maven.org refused
> Could not resolve org.apache.commons:commons-io:1.3.2.
Required by:
:1-SimpleServlet:unspecified
> Could not GET 'http://repo1.maven.org/maven2/org/apache/commons/commons-io/1.3.2/commons-io-1.3.2.pom'.
> Connection to http://repo1.maven.org refused**
The real error is this:
Connection to http://repo1.maven.org refused
Gradle needs to download the dependencies listed in the error message to be able to compile the project.
You're probably behind a firewall or your Internet connection isn't working. You need to make sure Gradle can access http://repo1.maven.org.
Note: Maven Central (http://repo1.maven.org) can be accessed with a browser. If you see the message "Browsing for this directory has been disabled" that means your browser could connect to the server (the error is a special message my Maven Central, not a standard HTTP error message).
If you see this but Maven or Gradle fail, then you need to check your browser's/OS's proxy settings and configure your tool accordingly.
Related:
How do I use Maven through a proxy?
Gradle proxy configuration
Using --refresh-dependencies switch with gradle, helped me to resolve this issue.
In my case the problem was resolved when I changed my gradle version from 4.6 to 4.7.
#Aaron Digulla said I have firewall problem.
I was having problem with GSON dependency, (hope it will solve other dependecy problems also) and this answer solved the problem. Stack Overflow Could not resolve all dependencies for configuration ':classpath'
#Kangars post :
This is what i have in my gradle.build for build script and allprojects
buildscript {
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
}
allprojects {
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
}
This is because of slow internet connection or you haven't configure proxy settings correctly. Gradle needs to download some dependencies , if it cant access the repository it fires this error. All you have to do is check your internet connection and make sure gradle can access the maven repository.
The root cause
Connection to http://repo1.maven.org refused
indicates that the build is failing as gradle is not able to fetch some dependencies from the repository.
Here is a list of causes and corresponding resolutions you might want to try:
Internet connectivity issues - Have a good internet speed and connectivity
Firewall (system or third party) - Ensure firewall is not blocking access to the repository
Working behind a proxy - Gradle proxy configuration
Firewall or some random application meddling with proxy application1 - Kill the process meddling with the proxy application
The proxy application causes certificate problems2 - Import proxy application's certificate
References:
Telerik forum's answer on how to fix internet connectivity issue while using Fiddler
Telerik forum's answer on secure connection issue while using Fiddler
It looks like you don't have a working internet connection or haven't configured your proxy/firewall.
Please check if you can access repo1.maven.org from commandline or a browser.
I used the steps below to fix it.
Go to command prompt and set the java opts.
SET JAVA_OPTS=-Dhttp.proxyHost=your_proxy_server_name -Dhttp.proxyPort=your_proxy_port -Dhttp.nonProxyHosts=127.0.0.1
Then build your Gradle application and all the connection refused errors no longer appear.
gradle clean build distZip
For my case it was a poor connection issue so the IDE couldn't get resources online

Categories

Resources