Spring JDBC - Configure Build Path warning error showing - java

I am new for Spring JDBC Template.
I am using Eclipse Kepler IDE and Mysql DB.
I trying to insert the data in DB using Spring JDBCTemplate, but its showing error as "Configure build path".(refer the screen shot)
I have added all the related JARS in my project build path.
Kindly advise me how to resolve this issue .

Click "Configure build path" (in your screenshot), a window will emerge.
OR
Right click on your project (in project explorer) ->Configure ->Build Path
In the emerging window, you will find four tabs, select "Libraries".There, under You can find "Web app libraries" OR "Maven Dependencies" (after expand it)
2.You will see the libraries added to the project's classpath. look out for JDBC jar and IMPORT it into your project.
Try to remove and add spring-jdbc jar as external jar as below.
Java Build Path -> Libraries -> Add External JARs

Same error I faced once and by changing or downgrading the version of spring framework helped me to resolve this error.
Old maven dependency ---
and changed to -----

Related

Add project JAR to deployment assembly but not build path in Eclipse

Eclipse automatically adds everything in WEB-INF/lib (specified in deployment assembly) to the project's build path. Is there a way to override this behavior? I need for another project jar to be deployed and available at run time but not have a forced compile-time dependency on it. Thanks!
Go to the properties window of the project. Then go to java build path tab and remove the relevant other project from libraries there. Then go to projects in the same tab and select the required project by using the add option and add it. Then restart Eclipse.

Convert Java Project into IntelliJ IDEA plugin?

I am developing a plugin for IntelliJ as part of a larger research team. The logic for the plugin was developed and tested as a Java project in IntelliJ IDEA. Now the time has come to develop the front end, and the module is not configured as a plugin. How should I go about converting the Java project to a plugin project?
It is not reasonable to start the project over as a plugin project, because it has complex dependencies on several other modules.
This is a similar question to how to import existing plugins, but is different because the code is not a plugin yet.
These are the steps I have followed so far:
Create a new action class (that extends AnAction) to be the main class for the plugin.
Create a run configuration for the plugin. I get this error: Run Configuration Error: No plugin module specified for configuration
Follow the instructions given by OpherV in the question I linked to above to change type="JAVA_MODULE" to type="PLUGIN_MODULE" in the .iml file.
The third step did not resolve the "Run Configuration Error: No plugin module specified for configuration issue." What additional steps are needed?
I am using IntelliJIDEA (Community Edition) 14.1.4 Build #IC-141.1532 on OSX 10.11.1.
I was able to successfully convert the project into a plugin by following these additional steps:
Create a META-INF directory in the root of the project. Inside of this directory create the plugin.xml file. In plugin.xml, register your action. See the IntelliJ code samples for examples of what this file should look like.
Right-click on your project root in the project view (Cmd-1 if it’s not open already) and choose “Open Module Settings” (Cmd-down). This will open Project Structure > Modules > Dependencies.
5.1. Alternately, you can get here by opening the Project Structure with Cmd-; and then choosing Modules and picking your project from the list and going to the Dependencies tab.
Make sure the module SDK is the IntelliJ Community Edition instead of the normal Java 1.8 (or whichever version you have). (I noticed that this changed a line in the .iml file, but you should change the SDK here so you can create it as described here.)
At the bottom of the dependencies window, there is a plus. Click it, and follow the instructions given by samkass in the answer to this question, which I will reiterate here with more context-specificity for ease of following them:
7.1. Once you have clicked on the plus button, select “Jars or directories…”
7.2. Navigate to the META-INF folder, select it, and click OK
7.3. In the dialog that comes up, select “classes” and NOT “jar directory”
7.4. Make sure you’re using that Module in your run target
Once I followed all of these steps, the "Run Configuration Error: No plugin module specified for configuration issue" went away and the Run Configuration I had created worked. I ran it and my action was available in the Refactoring menu as I had registered it in plugin.xml.

why this eclipse error showing and what should be the solution for it

Missing library: xdoclet-1.2.1.jar. Select the home directory for XDoclet. 1.2.1
why this eclipse error showing and what should be the solution for it alz
It is causing possibly because that jar is not added to your project build path. Follow this steps:
Right click on project(in the package explorer)
-> Buid Path
-> Configure Build Path
-> Java Build Path
-> Libraries tab
-> Add JARs button
Then locate the folder where the jar resides. You can filter your search by typing *.jar in the search field. And then click ok.
I downloaded the xdoclet-lib-1.2.3.zip file from:
http://sourceforge.net/projects/xdoclet/files/xdoclet/1.2.3/
unziped it to its folder name, xdoclet-1.2.3, and then from the Eclipse (I was using 4.5) preferences JavaEE -> XDoclet tab selected the Version 1.2.3 and then the Browse button to the xdoclet-1.2.3 folder. Apply and OK and Eclipse error goes away.
Saying all that, I suspect you don't really need it unless you know that you are using xdoclet. If that's the case and it was intentionally left out then the error message should be fixed in Eclipse. I only went around fixing it because of the message.
If have maven version of the project, can also try by updating the project. I also had this XDoclet. 1.2.1.jar complaint, which got resolved once I update the project.
Right Click Project > Maven > Update Project ... > Check the projects > OK.
Please add maven dependency in your project . Steps are -
1- Right Click on Project
2- select configure build path
3- select library tab
4- add library and select Maven Dependencies
5- apply and Apply and Close .

I used m2eclipse plugins in eclipse.why the imported package still cannot be resolved by eclipse?

I get a mvn project , and to debug this project in eclipse,I imported the project into eclipse.But it's a pitty that some imported packages cannot be resolved by eclipse.Othes tell me that I should install m2eclipse plugin for eclipse, and run ""mvn eclipse:eclipse" to convert the project as a eclipse-like" project ,thus all packages will imported to eclipse build path automatically. Yes , I do so. And the eclipse build path is just like this
:
But it is extremely strange that eclipse still cannot resolve some import .
Any body can tell me what happened? From the build path ,I can see that eclipse have already imported the needed jar file for me.But it seems that the build path didn't take effect.
First of all, you're not using the m2e plugin; while it may be installed, it's not activated for this project:
There is no little "M" on the project's icon
The classpath doesn't include an entry org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER
From what I can see, Eclipse can't resolve the dependencies since the variable M2_REPO isn't defined (if it could, you would see the absolute path to the JARs in the upper image after the symbolic path).
To fix this, go to Preferences and search for "Classpath Variables". Add M2_REPO there with the correct path (default is $HOME/.m2/repository).
If it already exists, make sure the path is correct.
Alternatively, right click on project and select "Convert to Maven Project" under "Configuration".
How did u create a project. Try creating a web project. This template will provide the correct creation web application structure. It will also automatically add the required jars in the build path.
It is an eclipse problem (are you using the latest version?), try to run:
mvn eclipse:clean
mvn eclipse:eclipse
then open eclipse, refresh the project (right click on the project icon and select refresh),
clean it (Project > clean ...). It could be necessary to reconvert the project to maven
(right click on the project and convert it to maven project).
Sometimes closing the project (right click on the project icon > close project) and reopening it (double click on the icon) solves this issue.

java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration

I'm trying to do an initial setup with Hibernate in Eclipse, while deploying with Tomcat.
I encountered the following problem:
java.lang.ClassNotFoundException: org.hibernate.cfg.Configuration
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1701)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546)
db.HibernateUtil.buildSessionFactory(HibernateUtil.java:13)
db.HibernateUtil.<clinit>(HibernateUtil.java:8)
I've goggled my problem online and I understand that it has something to to with the project class path.
I've added a user library to my project containing all the jars under the "required" directory in the hibernate download, but that doesn't seem to work.
Please find a screen shot of my project here:
You're getting the error because the hibernate libraries are not available to Tomcat. In your picture, below the hibernate library set there is an empty set called 'Web App Libraries' - this is the set your hibernate libraries need to be in.
Right click your project -> Build Path -> Configure Build Path, and remove the hibernate set from the build path. Now import the jars into the WEB-INF/lib folder. Refresh your project and now you should see them listed in the 'Web App Libraries' set (i appreciate this is somewhat annoying that you have to import them into your code base - someone else might know a better way to do this that doesn't involve copying the jars in)
This error can happen when your jar files has not been exported with your web archive. You can do what #Chris White has said or you can follow below steps if you are using Eclipse.
Right click the project -> Build Path -> Configure Build Path
In the list at left side click on Deployment Assembly. Click "Add" button. Select "Java Build Path Entries" and click next. Now select your hibernate jar files or library. Click finish. Then click Ok.
Restart the server if necessary.
Simpler way than Chris White's way.
You're getting the error because the hibernate libraries are not available to Tomcat. Right click your project -> Build Path -> Configure Build Path, and remove the hibernate set from the build path.
Do the same stuff, but instead of importing the jars everytime for a new project, **copy the required hibernate jars in lib folder of Apache Tomcat **(or whatever the server u are using).
You don't have the hibernate jar present in your library folder
Visit the below link for the possible solution, http://www.smashplus.info/2012/11/javalangnoclassdeffounderror.html
To achieve the same with IntelliJ :
File -> Project Structure
Project Settings -> Artifacts
Select your .war artifact
expand Available Elements
right click the Hibernate lib -> Put into /WEB-INF/lib
Done.

Categories