If I try to activate the "JPA Facet" for my Eclipse (Juno) project and point it to a user library containing the JPA libraries (in my case OpenJPA) I get the error:
"The class 'javax.persistence.Entity' is required to be in the selected libraries."
But this class is present there!
"Solution": The JPA libraries were contained in an Eclipse project folder. If I copy it somewhere outside and create another user library with them it works perfectly (although it has exactly the same content as the one before with the libraries located in the Eclipse project!). Seems like an Eclipse bug...
Just create a user library that contains the javax.persistence... JAR in it (It is located in Eclipse/plugins) and add this library at "JPA Implementation"
I'm using Spring Tool Suite (STS). The problem I was facing is that in the default installation the M2E-WTP plugin does not include the Optional component "m2e-wtp - JPA Configurator for WTP".
So I went to Help -> Eclipse Marketplace... and searched "m2e-wtp".
Click on the Installed button and it will become Change. Click on the Change button and select the optional component "m2e-wtp - JPA Configurator for WTP". Apply changes.
This solved for me.
Related
I have Intellij Idea community Edition and I am programming in Scala.
My #Entity annotations are highlighted with the message "Cannot resolve symbol."
I looked at this question IntelliJ IDEA highlights #Entity class names with "Cannot resolve symbol" in JP QL, which has the same issue.
The answer there says that I should install the JPA plugin for Intellij.
I looked here: https://www.jetbrains.com/idea/help/enabling-jpa-support.html
However, when I search for a plugin called JPA or Java EE in Intellij I can not find anything.
Any idea about why this is happening?
Am I not searching for the correct plugin?
For IDEA to resolve the symbols, you need to add the relevant dependency in the same way you'd add any other dependency. Either (the better option) to your build system (SBT, Gradle, or Maven) or directly to the IDEA project if you don't use any of those:
Open the Project Structure dialog (e.g. Ctrl+Shift+Alt+S).
In the left-hand pane of the dialog, select Modules.
In the pane to the right, select the module of interest.
In the right-hand part of the dialog, on the Module page, select the Dependencies tab.
On the Dependencies tab, click add and select Library.
In the Choose Libraries dialog, click New Library.
If suggested, select:
Java to create a Java library. Select the files and folders to be included in the library in the dialog that opens.
From Maven to download a Java library from a public Maven repository. Specify the artifact to be downloaded and the associated settings in the Download Library from Maven Repository dialog.
In the Configure Library dialog:
Specify the library name.
Select the library level (global, project or module).
Configure the library contents using add, iconLibExclude and delete.
Click OK.
In the Choose Libraries dialog, click Add Selected.
If necessary, select the Export option and change the dependency scope.
Click OK in the Project Structure dialog.
Of course, this won't give you any special JPA support. In particular, the linked question is talking about errors shown in JPQL strings, not on the annotations themselves.
I have created a Dynamic web project, but I am not able to deploy it into
Apache Tomcat Server 6.0. I am getting this error when I try to deploy my project:
There are No resources that can be added or removed from the server.
For this you need to update your Project Facets setting.
Project (right click) -> Properties -> Project Facets from left
navigation.
If it is not open...click on the link, Check the Dynamic Web Module Check Box and select the respective version (Probably 2.4). Click on Apply Button and then Click on OK.
Check whether your Java version is compatible with the project. Right click the project>>Properties>>Project Facets>>Java check the version is compatible with your project.
The issue is incompatible web application version with the targeted server. So project facets needs to be changed. In most of the cases the "Dynamic Web Module" property. This should be the value of the servlet-api version supported by the server.
In my case,
I tried changing the web_app value in web.xml. It did not worked.
I tried changing the project facet by right clicking on project properties(as mentioned above), did not work.
What worked is:
Changing "version" value as in jst.web to right version from
org.eclipse.wst.common.project.facet.core.xml file. This file is present in the .setting folder under your project root directory.
You may also look at this
if your project maven based, you can also try updating your project maven config by selecting project. Right click project> Maven>Update Project option. it will update your project config.
I used mvn eclipse:eclipse -Dwtpversion=2.0 in command line in the folder where I had my pom.xml. Then I refreshed the project in eclipse IDE. After that I was able to add my project.
I didn't find the Dynamic Web Module option when I clicked on the link, then I have installed Maven(Java EE) Integration for Eclipse WTP from the Eclipse Marketplace.Then, the above steps worked.
I encountered this error even though the Project Facets were set appropriately. The problem was that the "Runtime Environment" property was not set on the server:
It simply needed to be set to the appropriate Runtime:
The only thing that worked for me was creating a
.java-version
file with "oracle64-1.8.0.112" as the only entry ( use something that is 1.6+ )
Make sure you have dynamic web module facet turned on.
Right click on the project, select properties and then select "Targeted Runtimes". Check if Tomcat is selected here.
The issue is it is missing Dynamic Web Module facet definition.
Run the following at command line
mvn eclipse:eclipse -Dwtpversion=2.0
After build is success, refresh the project and you will be add the web project to server.
First check Project Facets setting as most replies had been answered.
Then check the Runtime Server is also aligned with the appropriate JRE.
In my case, I updated project JRE System Library and JDK compiler to 1.8,
but original Tomcat server is setting up on JRE 1.7,after upgraded to 1.8,the issue is resolved.
I want to use Spring ROO 1.2.1 + GWT 2.6.1 in Springsource Tool Suite 2.9.1 in Ubuntu 12.04.
Following guides like the video in http://www.bytespring.com/blog/spring-roo-integration-gwt, I can create with roo a new project via the "expense" script, then run it with mvn gwt:run.
Ok, than I want to manage it in STS and now the problem starts.
It seems to be problem about m2e.
In pom.xml the tag for artifact with ID "exec-maven-plugin" have this error:
Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:exec-maven-plugin:1.2:exec (execution: default, phase: process-classes)
I tried to follow the solution suggested in How to solve "Plugin execution not covered by lifecycle configuration" for Spring Data Maven Builds.
Surrounded "plugins" tag with the "pluginManagement" tag. Now the error no longer appears.
Then I run the application, "Run as -> Web Application"... HTML Page Selection: ApplicationScaffold.html.
The web page appears, but with a window with this error:
Error: One or more exceptions caught, see full set in UmbrellaException#getCause".
The STS console says
"java.lang.RuntimeException: The RequestFactory ValidationTool must be run for the org.springsource.roo.extrack.client.managed.request.ApplicationRequestFactory RequestFactory type".
To solve this problem, I followed the instructions in http://code.google.com/p/google-web-toolkit/wiki/RequestFactoryInterfaceValidation.
1)In Project Properties->Java Compiler->Annotation Properties I enabled project specific settings, annotation processing and processing in editor, gen.source directory: .apt_generated; verbose false.
2) In Factory Path, enabled project specific settings, and added the external requestfactory-apt.jar located in
/home/toni/springsource/sts-2.9.1.RELEASE/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201205091048-rel-r37/gwt-2.4.0
(right??)
(I do not understand if "Validation Tool" and "Maven build" sections are important for me)
Now I tried to re-run (after a rebuild of project) and the same error persists.
Someone solved this problem?? How? Please explain step-by-step because I am not an expert, It's my first approach with spring and gwt...
This looks like the same problem I ran into a short while back, which (after considerable digging) appeared to be down to a bug in AJDT (Eclipse's AspectJ compiler) which means that it currently cannot handle Java 6 annotations (used heavily by Roo).
A comment on a connected GWT bug report describes the following workaround:
move AspectJ builder to be in front (on top) of Java builder in project properties, Builder page.
clean and build the project.
copy and save generated Java/class files in .apt_generated directory to somewhere else.
move Java builder back in front of AspectJ builder.
clean and rebuild the project
copy the class file from 3 above to your project's classpath.
Alternatively, you can build your project outside of Eclipse - the non-IDE AspectJ compiler, ajc, does not suffer from this problem.
How I can setup Hibernate for a Dynamic Web application by using Eclipse Helios? I am a newbe so please let me know if there is any example.
I tried for Java application and included all JARS and it worked fine. But don't understand how I can do it for Web application and test it.
I will use Struts2 so I will appreciate if I can get appropriate example or guidance.
Drop the jars in WEB-INF/lib. Those jars are automatically added by Eclipse to the project build path, and constitute (with the WEB-INF/classes directory and the container classpath) the classpath of the webapp.
http://hardik4u.wordpress.com/2008/09/02/struts-2-hibernate-3-integrationcomplete-using-eclipse/
https://stackoverflow.com/questions/4364923/struts2-and-hibernate-framework-create-in-eclipse
First, download Struts2, and import example WAR file into Eclipse. You can find it from the source folder: struts-2.3.1-all\struts-2.3.1\apps\struts2-blank.war
Second, you should install Eclipse Hibernate Plugin. Goto Window > Preferences > Install/Update > Available Software Sites and add following link and name it JBossTools or something.
http://download.jboss.org/jbosstools/updates/helios/
Depending on your needs you can install Hibernate Plugins for many project types. In this case, select web application plugin.
And after, you should include Hibernate Core libraries into your classpath. I would recomment Hibernate 3.6 and greater. Because it does not depend on asm (asm-3.3.jar, asm-commons-3.3.jar ...) anymore. If you use earlier versions you might encounter some problems, since Struts2 also depend on asm libraries.
Then create your database, and use following link to configure and generate model bean classes.
http://casteyo.wordpress.com/2007/06/06/conf_hibernate/
Now you don't need to write mapping files by yourselves. And with DAO factory pattern you have your way to finish your project.
Hope this helps, and Goodluck
I am using Eclipse Liferay IDE for making a hook to a Liferay native portlet. I mean a porlet that comes with default installation, eg. blogs, content management or similar.
I have done the steps like following:
Select new Liferay Project
Enter project name MyHook
Made configurations (found an SDK directory and Liferay Server instance for Runtime)
Selected Plugin type to Hook
My only option after that was Finish and I ended up having a project with certain structure without any class or properties file inside.
My problem is that I could only get an empty project and don't know how to make the modifications to the files of Liferay because no Liferay originated package names can be found if I make a new class file and try to start typing com.Liferay. or org.Liferay. Because this is a Liferay Hook project, I suppose some Liferay originating tips should normally pop up for my selection, but I didn't see any.
What I am making wrong? What I am missing? Should I know the filenames by myself or is there a trick somewhere to tell the IDE to give me some help?
I use Liferay 6.0 and my IDE version is 6.0.5. At least in my eyes they should match together.
In the IDE you first create a "Liferay Hook Project". This is indeed an empty project. Then you create a Hook, select the Hook project to create it in. You can do the second step manually, but there's a wizard helping you to do this. This might be what you've been missing
I made the same steps again and it worked! Somehow at first time I managed to do a Java project although the project should be interpreted as a Liferay project.
Maybe the IDE is not 100% working always. Whoever knows.