I'm having a little problem using JPA (Hibernate)
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.validation.constraints.NotNull;
/**
* Bean decribing a user.
*
*/
#Entity
public class User implements Serializable {
...
I'm able to use some of the annotation (like #Entity), as shown in the example above.
But #Stateless cannot be found by Eclipse.
Why ?
I'm using the latest version from Hibernate (4.1.9)
I created a user library containing all the required library from the hibernate directory.
I upgraded my dynamic web project with the JPA Project Facet.
I solved my problem by using TomEE web server, which contains EJB implementation
#Stateless annotation are related to EJB stuffs.For this you need to include EJB3.1 jar in your project build path.
Related
I have seen all the issues noticed in this forum, but I still don't have any solution for my problem.
I work on a EAR project with Maven, Wildfly and JBoss.
When I try to browse to my resource I have NPE.
This is my JAX activator class:
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
#ApplicationPath("/resource")
public class JaxRsActivator extends Application{
}
and this is my resource class:
#Path("/drivers")
public class DriverResource {
#Inject DriverCpoServiceLocal driverCpoServiceLocal;
#GET
#Produces(MediaType.APPLICATION_JSON)
public List<DriverCpo> doFindAllDrivers(){
return driverCpoServiceLocal.findAll();
}
}
This code works correctly on my personal computer, but in the work computer I see the NPE.
It is driving me crazy.
I am using Java 8 in eclipse. Could the issue be that spring security does not support Java 8 as of yet?
12:13:44.226 [localhost-startStop-1] ERROR org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [C:\dev\workspace_professional_web_development\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\movierental\WEB-INF\classes\com\hemswortht\movierental\annotation\ReleaseYearConstraint.class]; nested exception is org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet: file [C:\dev\workspace_professional_web_development\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\movierental\WEB-INF\classes\com\hemswortht\movierental\annotation\ReleaseYearConstraint.class]; nested exception is java.lang.IllegalArgumentException
and ReleaseYearConstraint.java...
package com.hemswortht.movierental.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.validation.Constraint;
import javax.validation.Payload;
import javax.validation.ReportAsSingleViolation;
import com.hemswortht.movierental.validator.ReleaseYearConstraintValidator;
#Target({ ElementType.TYPE })
#Constraint(validatedBy = ReleaseYearConstraintValidator.class)
#Retention(RetentionPolicy.RUNTIME)
#Documented
#ReportAsSingleViolation
public #interface ReleaseYearConstraint {
String message() default "You have specified invalid search input parameters.";
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
}
This all boils down to dependencies version management in your build.
I suggest you to take a look at the various solutions Spring offers for that:
Spring Framework BOM, for managing spring-framework versions efficiently
Spring IO platform BOM if you want to get version management for spring-framework, spring portfolio projects (so spring security) and even third party dependencies
Note that changing the order of dependencies in your pom does not solve completely your problem - you'd better add dependency exclusions.
I figured it out! So basically you must use Spring 4 if you are using Java 8. Spring Security 3.2 is compatible with Spring 4 so that's ok.
so where did I go wrong?????
You need to make sure the Spring Security 3.2 dependencies COME AFTER the Spring 4 dependencies in the pom. Otherwise all spring versions get resolved to 3.2.6 !!! Doh.
I have a class file beginning with the following in Eclipse:
package org.jsoup.parser;
import org.junit.Assert.*;
import org.junit.Test;
import org.jsoup.nodes.Document;
import org.jsoup.parser.HtmlTreeBuilder;
However, Eclipse indicates an error saying that org.junit cannot be resolved. I have already modified the project properties to include jUnit 3 in the classpath, so wouldn't know what to do further.
Ideas?
EDIT: I have included jUnit 4 as suggested but to no avail...
If you want to use org.junit.Assert you should include JUnit 4. JUnit 3 uses junit.framework.* packages.
I have recently started exploring Scala.
I have installed Eclips and I integrated Akka-Actors Libs in the Build-Path Project.
But whenever I try compiling the project, I got an erorr. I can't resolve such libraries.
import akka.routing.{Routing, CyclicIterator}
import Routing._
Any idea how to configure Akka to work perfectly with Eclips ?
AFAICT, there's no such class in Akka.
Router, yes - Routing, no.
I have the same problem, I have Added the akka-actor_2.10-2.3.0.jar and the config-1.0.2.jar libraries but the error persists.
In the webpage of akka (akka.io) they use both imports in a example proyect.
http://doc.akka.io/docs/akka/1.3/intro/getting-started-first-scala.html
package akka.tutorial.first.scala
import akka.actor.{Actor, PoisonPill}
import Actor._
import akka.routing.{Routing, CyclicIterator}
import Routing._
.....
.....
....
ANSWER: You should use spray and the spray's library, it has a routing method you can use aswell.
import spray.routing._
You have to download the spray-routing-1.2.0.jar if you want to use it (http://repo.spray.io/io/spray/spray-routing/)
I am not being able to import com.google.gwt.view.client.ListViewAdapter;. I have GWT 2.1 and it is giving the error The import com.google.gwt.view.client.ListViewAdapter
cannot be resolved
ListViewAdapter has been replaced by ListDataProvider in 2.1