APT error in eclipse as JSR250: CommonAnnotations for Java - eclipse

i am getting below APT error in eclipse as JSR250: CommonAnnotations for Java, 2.3: #Resource methods must be setters that follow the standard JavaBeans convention. i.e. void "setProperty( value)" for " property".
Firstly I got the same 256 errors, I created a new workspace and imported maven projects again into new workspace then they reduced to 9 errors.
SCREENSHOT

It seems you are referring multiple repositories in you project. Please check your project .factorypath file. What it is referring ?

Related

Eclipse Kotlin plugin not compiling Kotlin classes

Using Eclipse 2018.12, I've installed the Eclipse Kotlin plugin (0.8.20.20200316-1305), created a Kotlin project (using the "New..." options under "Kotlin") and wrote a "Hello World!" program:
Test.kt:
fun main() = System.out.println("Hello World!")
However, when I try to run it I get the message
Error: Could not find or load main class TestKt
Caused by: java.lang.ClassNotFoundException: TestKt
Upon further inspection it seems the class has never been compiled. There is no corresponding .class file anywhere. Under the project directory I see Eclipse configuration directory .settings and files .project and .classpath. Besides that, I have an empty bin directory and a src directory with Test.kt only.
I found two similar questions about this in SO:
In Unable to Run Kotlin Application in Eclipse, the accepted answer simply indicates working with a new version of Eclipse and Kotlin plugin, both older than what I have now. Besides, the problem may have been solved in that case due to a new installation rather than the version.
Kotlin - Error: Could not find or load main class _DefaultPackage is quite old and the accepted answer does not apply anymore. It was about not naming the main class properly, but in my case there is not even a byte code file to be found.
Running "Project -> Compile Kotlin classes" had no effect.
How can I get this simple example to run?
Update: I've updated to 2020-06 (not that it should matter since Eclipse Kotlin lists 2018-12 in its requirements) and replaced Zuly by AdoptOpenJDK HotSpotJDK 11. The error persists. The Eclipse log does not show any related messages.
Update 2: re-created the project in a brand-new workspace but the problem persists.

Eclipse error - Cannot be resolved to type

Created a Maven Project and have set the dependencies in the pom.xml. The import statement (com.splunk.*) seems to recognize the library included in the Maven Dependencies, however when I refer to the class (for e.g. ResultsReaderXml) within that library, it shows the "error message cannot be resolved to type". Can some please explain why Spring Tool Suite (Eclipse) is doing that?
https://i.stack.imgur.com/enCRW.png

How do I find the correct Maven archetype project for developing with Scala in Eclipse?

I'm having problems trying to just create a Maven project using Scala (v2.11.6) within Eclipse (Luna). The instructions here says to install both plugins below.
Maven Integration in Eclipse
m2eclipse-scala connector
Both plugins can be installed by using the m2eclipse-scala update site. So here's what I did in my first attempt.
Download Eclipse Luna (for JavaEE developers)
Install "both" plugins above by using the m2eclipse-scala update site.
When Eclipse loads up, I attempt to create a Maven project, and the archetype I want to use is Group Id=net.alchim31.maven, Artifact Id=scala-archetype-simple, Version=1.5. However, this archetype never shows up when I enter in "scala-arch" in the filter text field.
The only project I see is the one with Group Id=org.scala-tools.archetypes, Artifact Id=scala-archetype-simple, Version=1.2. When I select this archetype to use, I get a bunch of error messages in Eclipse.
error while loading ConsoleRunner, Scala signature ConsoleRunner has wrong version expected: 5.0 found: 4.1 in ConsoleRunner.class
error while loading JUnit4, Scala signature JUnit4 has wrong version expected: 5.0 found: 4.1 in JUnit4.class
error while loading Specification, Scala signature Specification has wrong version expected: 5.0 found: 4.1 in Specification.class
In my second attempt, I try to download the pre-packaged bundle (Scala IDE for Eclipse). Again, when I attempt to create a Scala Maven project, I don't see the Maven archetype for Group Id=net.alchim31.maven (only for Group Id=org.scala-tools.archetypes).
Any ideas on what I'm doing wrong here? Or where I can find a vanilla Scala Maven project to import/modify and use for my own purpose?
Here's how I got it to work. It seems all the archetypes aren't available, so based on this answer, I created a remote catalog
Before
So do this
Go to [Windows] → [Preferences] → [Maven] → [Archetypes] → Add Remote Catalog and create the catalog, then Apply
For copy-pasting:
Catalog File: http://repo1.maven.org/maven2/archetype-catalog.xml
Description: Remote Archetypes
Go back to creating a new Maven project. Select the Remote Catalog from the dropdown. It will take a few moments to gather all the archetypes. You can see the progress at the very bottom right of the IDE. When it's done, you should be able to see the archetypes
After
Create your project with groupId and artifactId and such.
Right click the project, then from the context menu [Run As] &rarr [Maven Build]. In the dialog, type clean package into the goals. The run. The project should build and run the tests.
For me at first I got an error on the build. It was because my default environment is using Java 8. I'm pretty new to Scala, so I'm not sure is there is a problem with Scala and Java 8 or not (I think it's the Scala version in the pom (2.10.0)). But what I did to get it to work was just change the Java version used in the IDE to Java 7.
Basically just go to [Windows] → [Preferenes] → [Java] → [Installed JREs] → Add → [System VM] → Next → Directory → Find the directory of the Java home (version 7) → Finish → Then in the list tick Java 7.
Then build again. It should work. Good Luck!
One point I want to add, If you are getting following error while installing the archetype showed in image 1
Can't resolve Archetype
org.glassfish.jersey.archetypes:jersey-quickstart-webapp:2.21
org.eclipse.core.runtime.CoreException: Could not resolve artifact
org.glassfish.jersey.archetypes:jersey-quickstart-webapp:pom:2.21
Image 1:
Then before procedding with the solution specified above, try to complete these steps in eclipse.
I faced the same problem and chanced upon this SO question, as well as the answer, given by #peeskillet (many thanks). I am using:
Maven 3.3.3
Eclipse Luna Scala IDE 4.0.0.-vfinal-20150305-1644-Typesafe
Scala 2.11.6
JDK 1.8
After following the steps exactly as given here, I hit a wall. When I chose the right archetype (net.alchim31.maven), I was greeted with this error:
Could not resolve artifact net.alchim31.maven:scala-archetype-simple:pom:1.5
Suspecting that the maven embedded in eclipse was acting funny, I visited [Windows] -> [Maven] -> [Installations] and added local installation of maven (whatever is set to M2_HOME in my shell). But, no luck!
Exasperated, I visited this site: Scala Doc and switched back to command-line as this page instructs. Surprisingly (to me, at least), it worked. A maven-Scala project was created in the present directory, which I could import into Eclipse.
Just so that I am not misunderstood, I am not suggesting that #peeskillet's answer is wrong. Just wanted to share another way of creating a maven-scala project on Eclipse, in case it helps someone. I have not yet understood, why Eclipse-Scala-IDE is yet to give that 'Aha' feeling.
After you have successfully created the scala-maven project as described above, you will probably see an error "Type not found: type JUnitRunner specs.scala". In that case, manually add the following XML snippet to your pom.
<dependency>
<groupId>org.specs2</groupId>
<artifactId>specs2-junit_${scala.compat.version}</artifactId>
<version>2.4.16</version>
<scope>test</scope>
</dependency>
Moreover, to avoid errors when running mvn test,
[ERROR] scalac error: bad option: '-make:transitive'
You also need to delete the following line from the pom.xml file:
<arg>-make:transitive</arg>

Error in Eclipse about type indirectly referenced from required .class file

I'm having this exception with some stubs generateds by Axis2:
"The type org.apache.axiom.om.OMElement cannot be resolved. It is
indirectly referenced from required .class files"
I've been reading many posts, and trying to find a solution. What I've found so far is to add the apache tomcat 5.5 library to the build path. It removed the error in the java file, but then, when I to execute any java program inside the project, I got this error:
'Launching myApp' has encountered a problem Exception occurred
executing command line. Cannot run program "C:\Program
Files\Java\jdk1.5.0_22\bin\javaw.exe" (in directory
"D:\Digicel\workspace\Digicel\myClassSample"): CreateProcess error=87,
The parameter is incorrect
then if I remove the apache tomcat library from the build path, I can run the other java programs, but not the one mentioned initially.
Any thoughts about it?
Okay, I've found the cause of the problem with the help of a friend :)
The thing is that Eclipse is aware that one of my dependencies, depends of another library, and Eclipse is checking for it when it tries to build the code.
So, what I've done is try to check which jar file contains this library: " org.apache.axiom.om.OMElement".
I've googled it and found that it is "axiom-api-1.2.10.jar" and finally my file compiled with 0 errors.
He also explained to me that my original solution of adding the apache tomcat server library is adding all the jars that cames with apache tomcat (which is a big list), and probably there may have been a version conflict with my current list of added jars.
So, the fix was to find the appropriate jar and add it to the project.
This error can also occur when a indirect dependency has a corrupt jar file. This may be caused by problems at the public maven repository.
If this is the case removing the local maven repository to download fresh jar files will fix your problem:
rm -Rf ~/.m2/repository/{enter/path/to/broken/stuff}
Goto Maven >Update Maven project>checkmark the Force update >Then Run
..That error Will gone....

Only a type can be imported. org.apache.poi.hssf.usermodel.HSSFWorkbook resolves to a package

Trying to use Apache POI in a Eclipse JSP project. The POI jar is in the project's Java Resources Library list.
<%# page import="org.apache.poi.hssf.usermodel.HSSFSheet"%>
at run the following error occurs:
An error occurred at line: 7 in the
generated java file Only a type can be
imported.
org.apache.poi.hssf.usermodel.HSSFWorkbook
resolves to a package
Any ideas? Thanks
Don Lawton
The message indicates that the class could not be found on the classpath of your deployed application. Did you make sure that the POI jar is in your WEB-INF/lib folder?
Same happened to me, even when the needed jars were indeed in the WEB-INF folder.
I was using the provided server in SpringSource ToolSuite (STS). It took me several attempts to clean, republish, etc... before it finally worked.