Spring - Apache and XML error - eclipse

I was following this tutorial for Spring Login example. I downloaded their sample code and import in my Eclipse. It throws 2 error.
Error 1
Target runtime Apache Tomcat v6.0 (2) is not defined. Unknown Faceted Project Problem
Error 2
Referenced file contains errors (http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd).
I already download the latest updates in eclipse and reinstall the tomcat.
Using Tomcat6,Spring-3.2.0.RC1.
Please advice. Thanks

We need to right click on the project, properties and Targeted Runtimes. Uncheck the old server entry and enable the new entry. This should solve this error.
http://javashine.wordpress.com/2010/09/07/target-runtime-apache-tomcat-v6-0-is-not-defined/
Hope this helps.

Right click on the project->select properties option.
Search for targetedruntimes in the search bar
uncheck the tomcat old version
select latest version and the version you wnat to use.

Related

java.lang.NoSuchMethodError: org.testng.remote.AbstractRemoteTestNG.addListener(Lorg/testng/ISuiteListener;)

I am getting the following error when running test cases. i am using testNG latest version and my errors follows like this
java.lang.NoSuchMethodError: org.testng.remote.AbstractRemoteTestNG.addListener(Lorg/testng/ISuiteListener;)V
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:128)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:236)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:81)
can anyone help with me a solution
tried this solution it works successfully.
steps
1 right click on your project
2 click on build path
3 click on configure build path
4 click on add library
5 select TestNG
6 click on next
7 click on finish
8 click on apply and close
i also faced the same problem. Follow some steps it might help you.
Right click on project.
Click on build path -> configure build path
Click on Add library.
Select testNG.
Click on NEXT.
Click on FINISH --> Apply --> Close
I had the same issue. Changing my testng version to 6.8 from 7.x.x solved it.
The NoSuchMethodError indicates that the compiled code you're running is expecting a method in a type, but that it does not exist.
The documentation for the exception class
Thrown if an application tries to call a specified method of a
class (either static or instance), and that class no longer has a
definition of that method.
Normally, this error is caught by the compiler; this error can
only occur at run time if the definition of a class has
incompatibly changed.
This suggests that you either have different JARs/classes in your classpath when you run the test than when you compiled it, or you potentially have duplicate JARs of different versions in the classpath.
Issue got resolved after changing TestNG jar from testng-7.4.0 to testng-7.1.0.
Also add TestNG library via configure build if it is missing.
This error is mostly due to TestNG Plugin not properly installed in eclipse.
Go to help(you will find at top of eclipse)
Click on Install New Software
Click on Add(You will find at top right side in the new window)
I. Give any name(ex. TestNG Plugin)
II. In Location field, need to give latest updated link(you will find that link
at https://testng.org/doc/download.html).
III. Open above link and check for "Update site for release" on same
webpage(probably you will find at bottom of the webpage) and you will find
one URL there, copy that URL and paste in Location field of eclipse.
Also make sure you have added below 2 jars of the same version.
testng-7.1.0.jar and testng-7.1.0-sources.jar
try adding following libraries -
Right click on the Project
Build Path
Configure Build Path
Libraries (Tab)
remove Wildfly 11 Runtime (or Wildfly 10 Runtime)

plug-in org.eclipse.m2e.core.ui was unable to load class

I had made an maven project and it worked fine.
Then I installed plugins
EclEmma Java Code Coverage,
PHP Development Tools (PDT),
Eclipse.orgSonarQube
Then I worked on some other project. When I again wanted to create an maven project,it threw the following error window which said
The selected wizard could not be started
reason
plug-in org.eclipse.m2e.core.ui was unable to load class
org.eclipse.m2e.core.ui.internal wizards.MavenProjectWizard
Removed SonarQube plugin .This solved the issue.
Now it works all fine.
But is there any other solution to this problem since I have to use sonar.
Click on eclipse help tab and open installation details search sonar and remove all related plugins.
That's not quite the right characterization of what it says on the page,Please check your .log file /path/workspace/.metadata/
Find the correct plugin which is causing this problem and update to compatible version of the plugin with eclipse version.
To find the hidden files in the workspace use Ctrl+H
I had the same problem, and I've tried so many solutions. But what I did to solve the problem, is that I just upgraded my Eclipse IDE (2019-06 to 2020-03) by following these steps (from https://wiki.eclipse.org/FAQ_How_do_I_upgrade_Eclipse_IDE%3F) :
You first need to add the new release's repository as follows:
1-1. Window > Preferences > Install/Update > Available Software Sites
1-2. Click 'Add'
1-3. Enter the URL https://download.eclipse.org/releases/2020-03/
1-4. Click 'Ok'
Help > Check for Updates
If updates are found, proceed through the install wizard and restart the IDE when
prompted. Otherwise, read carefully the error message to find out which component
is conflicting and establish your resolution strategy.
Note that the start splash screen may be cached and will not necessarily be
updated to the latest version after the IDE is restarted. Performing a full
relaunch should display the new version number.

Can´t run acceleo uml2java example

I´m beginning with Acceleo.
I installed eclipse-modeling-luna-M6-win32.
Then i installed acceleo by update on eclipse.
(is there any better option?)
Trying to use the uml2java example.
To run it i tried to run org.eclipse.acceleo.examples.uml2java.
It gave me:
Error
Couldn't load class org.eclipse.acceleo.examples.uml2java.main.Uml2java from project org.eclipse.acceleo.examples.uml2java
Couldn't load class org.eclipse.acceleo.examples.uml2java.main.Uml2java. Check that its containing package is exported.
I did not change the code.
I checked the MANIFEST and it has on the runtime: org.eclipse.acceleo.examples.uml2java.main
I also saw that there is an UI project that as i understand is a plugin but i don´t know what to do with it (so that it will create a new menu on eclipse).
Any help is appreciated!!
Thanks.
it worked using eclipse indigo with the latest acceleo. i don´t know if it´s possible to use a more recent eclipse version. also works with eclipse kepler.
This fixed the problem for me. Try adding the "bin/" directory to the Classpath in the Manifest file.
Right click the MANIFEST.MF file and "Open With >" "Plug-in Manifest Editor".
This gives some tabs at the bottom. Use the "Runtime" tab. On the bottom right of this screen there is a place to edit the classpath. Add "bin/".
I got this idea from Etienne's answer in: Can't generate java from UML using Acceleo in Eclipse

"Unable to locate JAR/zip" error for JDBC connections [BIRT Eclipse, Windows 7, Oracle 11g]

As an FYI, I'm new to this entire stack, so I might be making a basic error.
I'm attempting to explore BIRT reporting for a Maximo system that was recently upgraded.
To do so, I installed the following:
Java 6 & Java 7 JDKs
BIRT version of Eclipse (Eclipse + BIRT plugins built in).
Some Oracle 11gR2 client options (a custom install)
SQL*Plus
JDBC/ODBC drivers
Thin Client
I take the following steps:
Open Eclipse
Create a new Reporting Project
Add a Data Source
Select "JDBC Data Source" (also tried "JDBC Database Connection for Query Builder")
Select the "Oracle" connection profile type and click next.
At this point, I see that the drivers list is empty. This strikes me as odd, but I figure maybe I have to define the driver definition. So I take the following steps:
Click "Define driver definition"
In the Name/Type tab, select "Oracle Thin Driver", system version 11
At this point, I see an error message: Unable to locate JAR/zip in file system as specified by the driver definition: ojdbc14.jar. It seems that ojdbc14.jar doesn't even exist on my system that I can find.
I have tried adding other jdbc jar files that I can find in the oracle client directory (i.e. from Oracle_Base\product\11.2.0\client_1\jdbc\lib) but nothing seems to resolve the issue.
Help?
I had similar issue.
Clicking "Clear all" and then adding the jar manually solved the problem.
The answer in this case was unfortunately stupidly simple -- after closing and reopening Eclipse, I had no trouble removing the driver, adding another, and getting to work. I was up and running in no time.
Thanks for all your help!
Ensure the ojdbc14.jar file exsists and is in your library path. When on the dialog for picking the driver ojdbc14.jar, simply click the find jar/zip button and find the file.
Sometimes it is there, but still does not work. To solve this problem, press the "clear all" button. Now repeat the above process. The .jar will be added and you will continue to driver connection and details dialog box.
This happens because the Eclipse IDE could not find the driver in the eclipse installation path. This is what you will do:
Search for the .jar file in your system and copy it to the eclipse installation path.
If you could not get it visit http://dev.mysql.com/downloads/connector/j and locate the required connector. Download it and save it to the eclipse installation path. So now Eclipse can see it and the error would no longer appear.
Very simple answer is Into the Jar Console Click on edit jar and Again select jar in your file system. that will locate file in your file system simple

How can I add my application to Tomcat in Eclipse?

I have a web app built with Maven.
Most of the time, I built the application using Intellij IDEA, but now I want to import the application in Eclipse to see something in this IDE.
After mvn eclipse:eclipse, I add in Eclipse the app, but when I try to add the app to the server (tomcat), I receive:
There are no resources that can be added or removed from the server
Solutions?
You need the project to have a Eclipse Dynamic Web Module facet. You can try doing this via the project properties dialog and looking at project facets, then clicking the appropriate check box. This may not be available however, so you may need to do the next thing.
Create a backup of your project and follow the directions at dzone.com. This'll allow you to modify the project facets via your eclipse .project file.
Keep in mind, once you add those facets, you cannot change them back via Eclipse. Definitely make sure you have a backup before starting.
This step worked for me:
Right-Click on the Project Name, then
Maven-->Update Project..
Click OK
After doing this I was able to see my project in Add/Remove Programs.
As mentioned somewhere else adding Eclipse WTP didn't do any good, however I performed the above step after I had already added Eclipse WTP, so I am guessing that may not be needed.
This was done for Eclipse Juno.
Hope this helps someone.
Edited: You can follow this link as above mentioned I think might have needed WTP and that add a lot of other things into the workspace.
http://blog.teamextension.com/maven-as-eclipse-dynamic-web-module-556
Check whether Maven Integration for Eclipse WTP is installed. If not, install it from Eclipse Marketplace
After installation restart Eclipse
Right click your project and Maven--> update project configuration
Delete tomcat and re create tomcat (clean tomcat,add your project,publish and enjoy)
I've got Tomcat 6, Java 1.6, and was trying to get it to work in Eclipse Juno Service Release 1's "internal server" (whatever that's called.) Here's what I did that worked for me:
(Found these instructions at http://www.mkyong.com/eclipse/eclipse-ide-tomcat-version-6-0-only-supports-j2ee-1-2-1-3-1-4-and-java-ee-5-web-modules/)
I should point out that I followed ClutchDude's instructions to make my project a Dynamic Web Module facet. It didn't work on its own for me, but maybe it was part of making it work in the end.
Using Eclipse (or other text editor), open the file
.settings/org.eclipse.wst.common.project.facet.core.xml
Find the line that reads
<installed facet="jst.web" version="3.0"/>
3.0 is for Tomcat 7.x (so says mkyong.) Change it to 2.5 (or 2.4).
I restarted Eclipse and it worked for my project.
The reason why this is happening is because eclipse by default looks for the deployment descriptor in the folder {project.home}/Webcontent/WEB-INF/web.xml where as the Maven puts them in src/main/webapp/WEB-INF/web.xml.
So when you are trying to add your project onto the server eclipse cannot find a deployment descriptor and hence you get the annoying message.
This can be solved by adding the following entries in .settings/org.eclipse.wst.common which can be found in
Project home folder in your workspace if it is a new maven project.
The folder where you already imported from if you are using Import -> Maven projects.
Make the following changes in to the org.eclipse.wst.common
wb-resource deploy-path="/" source-path="/src/main/webapp"/. Add this entry.
Edit --> property name="java-output-path"
Please check the following link from more details. http://java.dzone.com/articles/webapps-eclipse-and-maven.
The comments section has an excellent example with a working project.
This issue was fixed for me my installing additional eclipse modules. in particular, the ones related to m2e-wtp. just do a search for m2e in the plugins search listing for your version of eclipse
If you face an error like "There are no resources that can be added or removed from the server",
then
1) Go to the META_INF of your websvcsEAR and go to the application.xml.
2) Goto modules-> clickDetails and add the module that is existing. i.e., some EAR which your project demands.
3) Click ok
4) Now go to your server -> right click -> add and remove -> add your EAR.
Maybe you don't need add your application to the server's configuration. I think that you must use m2e eclipse plugin in order to launch the app.
For example, in your eclipse you will see a contextual menu called "Run as" if you right-click on your pom file. You can clicking on "Maven build" and Maven will download all the information needed to start tomcat.
I hope this helps you.
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 was able to resolve this by removing my EAR project from my Eclipse workspace, then re-importing it.
Well, with a Spring and maven project, i got it that way:
Eclipse Version: 2019-06 (4.12.0)
Java 1.8
Tomcat 7
Yes, go to Project Properties >> Facets >> select Dynamic Web Module but dont apply yet!!!
Right under, it should appear a link Further Configuration Available. Click on it, otherwise one will have to edit .settings/org.eclipse.wst.common.component manually. Update source directory to src/main/java. (source)
Then in Facets window check Java - mine was pointing to 11 even though i don't have Java 11 installed or configured like a JRE runtime. I could only add/remove when changed to 1.8. (source). Note: That was really the problem, why don't Eclipse get this configuration automatically from the project?
Finally Eclipse creates some directories like WEB-INF and META-INF, just delete them.