users@jersey.java.net

Re: [Jersey] Jersey Spring CGLIB2 is not available

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 16 Nov 2009 13:57:22 +0100

On Nov 16, 2009, at 1:42 PM, Nabil Benothman wrote:

>
> Hi,
> In my resources I am using the annotation @Secured (cf. code bellow).
> suppose that AOP is implicitly utilized, why it cannot find CGLIB in
> the
> classpath however it is present in the project dependencies? (cf.
> maven
> entry bellow)

The spring-based dependencies of the jersey-spring module does not
included the CGLIB dependency and it declares a minimal set:

                 <dependency>
                     <groupId>org.springframework</groupId>
                     <artifactId>spring-core</artifactId>
                     <version>${spring25-release-version}</version>
                     <scope>compile</scope>
                 </dependency>
                 <dependency>
                     <groupId>org.springframework</groupId>
                     <artifactId>spring</artifactId>
                     <version>${spring25-release-version}</version>
                     <scope>compile</scope>
                 </dependency>
                 <dependency>
                     <groupId>org.springframework</groupId>
                     <artifactId>spring-beans</artifactId>
                     <version>${spring25-release-version}</version>
                     <scope>compile</scope>
                 </dependency>
                 <dependency>
                     <groupId>org.springframework</groupId>
                     <artifactId>spring-context</artifactId>
                     <version>${spring25-release-version}</version>
                     <scope>compile</scope>
                 </dependency>
                 <dependency>
                     <groupId>org.springframework</groupId>
                     <artifactId>spring-web</artifactId>
                     <version>${spring25-release-version}</version>
                     <scope>compile</scope>
                 </dependency>


$ mvn dependency:tree
...
[INFO] +- org.springframework:spring-core:jar:2.5.6:compile
[INFO] | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.springframework:spring:jar:2.5.6:compile
[INFO] +- org.springframework:spring-beans:jar:2.5.6:compile
[INFO] +- org.springframework:spring-context:jar:2.5.6:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-web:jar:2.5.6:compile


I would prefer not to add to this set additional dependencies that may
or may not be required.

I think the best thing to do is document additional dependencies.

Are you declaring any additional spring dependencies in your pom file?

Paul.

>
> @Path("/students/")
> @Component
> @Scope("request")
> public class StudentsResource {
>
> .....
>
> @Secured({"ROLE_USER", "USER_ACCESS"})
> @GET
> @Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_XML,
> MediaType.APPLICATION_JSON})
> public Viewable get(
> @QueryParam("start") @DefaultValue("0") int start,
> @QueryParam("max") @DefaultValue("10") int max,
> @QueryParam("expandLevel") @DefaultValue("1") int
> expandLevel,
> @QueryParam("query") @DefaultValue("SELECT e FROM Student
> e")
> String query) {
> PersistenceService persistenceSvc =
> PersistenceService.getInstance();
> try {
> persistenceSvc.beginTx();
> StudentsConverter converter = new
> StudentsConverter(getEntities(start, max, query),
> uriInfo.getAbsolutePath(), expandLevel);
>
> return new Viewable("/students.jsp",
> converter.getEntities());
> } finally {
> persistenceSvc.commitTx();
> persistenceSvc.close();
> }
> }
> .....
>
> }
>
>
> ---
> <dependency>
> <groupId>cglib</groupId>
> <artifactId>cglib-nodep</artifactId>
> <version>2.2</version>
> </dependency>
>
> --
> View this message in context: http://n2.nabble.com/Jersey-Spring-CGLIB2-is-not-available-tp4005853p4011801.html
> Sent from the Jersey mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>