I have created a runnable jar file from an existing maven project on netbeans, which contains all dependencies included in pom.xml
When I run it on Netbeans it work:
stampa
adsa
stampa2
when instead I run it from the runnable jar file I get this error:
java -jar ./Prova-1.0-SNAPSHOT-jar-with-dependencies.jar
stampa
adsa
Exception in thread "main" javax.jcr.RepositoryException: Unable to access a repository with the following settings:
org.apache.jackrabbit.repository.uri: http://localhost:8082/server
The following RepositoryFactory classes were consulted:
org.apache.jackrabbit.core.RepositoryFactoryImpl: declined
Perhaps the repository you are trying to access is not available at the moment.
at org.apache.jackrabbit.commons.JcrUtils.getRepository(JcrUtils.java:223)
at org.apache.jackrabbit.commons.JcrUtils.getRepository(JcrUtils.java:263)
at com.mycompany.leggitutto.Source.main(Source.java:38)
I don't get it.
Why on netbeans the RepositoryException is not thrown?
The java code is the same, the build is successful and the Run is different!!!
public static void main(String[] args) throws Exception
{
System.out.println("stampa");
System.out.println("adsa");
Repository repository1 = JcrUtils.getRepository("http://localhost:8082/server");
Session session1 = repository1.login(new SimpleCredentials("admin","admin".toCharArray()), "default");
System.out.println("stampa2");
}
Jackrabbit server is running at
"http://localhost:8082/server",
I have even checked it on firefox, and the repository is reachable.
I'd be glad if someone can help me to figure this out :)