maven - java.lang.NoSuchMethodError: org.glassfish.hk2.api.ServiceLocatorFactory.create -
error:
java.lang.nosuchmethoderror: org.glassfish.hk2.api.servicelocatorfactory.create(ljava/lang/string;lorg/glassfish/hk2/api/servicelocator;lorg/glassfish/hk2/extension/servicelocatorgenerator;lorg/glassfish/hk2/api/servicelocatorfactory$createpolicy;)lorg/glassfish/hk2/api/servicelocator; org.glassfish.jersey.internal.inject.injections._createlocator(injections.java:138)
pom.xml
<dependency> <groupid>org.glassfish.jersey.containers</groupid> <artifactid>jersey-container-servlet</artifactid> <version>2.22.1</version> </dependency>
web.xml
<servlet> <servlet-name>jersey-serlvet</servlet-name> <servlet-class> org.glassfish.jersey.servlet.servletcontainer </servlet-class> <init-param> <param-name>jersey.config.server.provider.packages</param-name> <param-value>...</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>jersey-serlvet</servlet-name> <url-pattern>/prods/*</url-pattern> </servlet-mapping>
any comments welcomed. thanks
you need hk2-api
dependency pom.xml
can find below: , delete .m2
directory clean , rebuild project , update project , run it.
<dependency> <groupid>org.glassfish.hk2</groupid> <artifactid>hk2-api</artifactid> <version>2.5.0-b42</version> </dependency>
Comments
Post a Comment