eclipse - java.lang.ClassNotFoundException: org.glassfish.jersey.client.JerseyClientBuilder -


hi using followng maven dependencies. when run application in eclipse, working fine. when deploy application jar file, throwing following error.

caused by: java.lang.classnotfoundexception: org.glassfish.jersey.client.jerseyclientbuilder  @ java.net.urlclassloader.findclass(unknown source) 

following maven dependency file.

<dependencies>           <dependency>             <groupid>org.glassfish.jersey.core</groupid>             <artifactid>jersey-client</artifactid>             <version>${jersey.client.version}</version>             <scope>provided</scope>         </dependency>          <dependency>             <groupid>org.glassfish.jersey.media</groupid>             <artifactid>jersey-media-moxy</artifactid>             <version>${jersey.client.version}</version>         </dependency>          <!-- http://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->         <dependency>             <groupid>com.googlecode.json-simple</groupid>             <artifactid>json-simple</artifactid>             <version>1.1</version>         </dependency>      </dependencies>      <properties>         <jersey.client.version>2.21</jersey.client.version>     </properties>  <dependencies>   

any on this.... gone through following link, don't me.

running standalone java executable in eclipse results in noclassdeffound

if distribute single jar (not fat-jar/uber-jar) need provide classpath it, library jars required run it.

in case along lines:

java -jar my.jar -cp $home/.m2/repository/org/glassfish/jersey/core/jersey-client/2.21/jersey-client-2.21.jar 

and after : need add other dependencies have.

another option use e.g. assembly plugin build uber jar (jar contain other jars, libraries , code): http://maven.apache.org/plugins/maven-assembly-plugin/usage.html:

  <build>     <plugins>       <plugin>         <artifactid>maven-assembly-plugin</artifactid>         <version>2.6</version>         <configuration>           <descriptorrefs>             <descriptorref>jar-with-dependencies</descriptorref>           </descriptorrefs>         </configuration>        </plugin>     </plugins> </build> 

and build jar using: mvn clean package assembly:single, , see have 2 jars inside target, larger 1 uber jar can distribute.


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -