No Dependency Injection and missing EclispeContext in Plugin - eclipse

I have written an eclipse product, based on Eclipse Neon, which contains a self written plugin. Now I changed the platform to Eclipse 2019-06. Since then I get an InjectionException at the integratetd plugin.
I've debugged the code and found out, that the injection of this Plugin doesn't work any more and the EclipseContext is always null. I also tried to create the Objects with the #Creatable Annotation.
Do I have to transport the context from one plugin to another? In my opinion this isn't necessesary. So, had someone else this problem and has solved it?

Related

NoClassDefFoundError: org/eclipse/search/ui/text/TextSearchQueryProvider

I am writing a plugin for eclipse. When calling TextSearchQueryProvider sqProvider = TextSearchQueryProvider.getPreferred();, I get a NoClassDefFoundError.
The funny thing is, I only get this on the exported jar-plugin, not while debugging the plugin. I figured, it might be related to exporting the org.eclipse.search-plugin, but that plugin is so basic, that eclipse doesn't run without it anyway. So I guess the plugin should be there.
I am running eclipse photon (4.8.0).
Some more clarifications:
I have specified org.eclipse.search as dependency in MANIFEST.MF:
Require-Bundle: javax.inject,
org.eclipse.search;bundle-version="3.0.0";visibility:=reexport,
....
I have imported org.eclipse.search.ui.text.TextSearchQueryProvider
Do I need to do anything else, that I am not aware of?
Addition:
The plug-in related views did not show any obvious problems.
Specifically, the 'org.eclipse.search'-dependency is being satisfied by the version '3.11.200.v20180503-1856', which to me implies, that the plugin has been successfully linked?
The problem vanished, after I exported the plug-in with another version postfix.
I had originally called the postfix "beta". After giving it a new postfix with date,
the dependency tree seems to work correctly. It might be that the original package was bad and misconfigured in the MANIFEST, and only after reexporting with a different name, the pacakge dependencies were reevaluated corrrectly.

Spring roo project doesn't compile in eclipse

I have to maintain a spring roo project so I imported it in eclipse, I can build it, if I run roo command
"perform eclipse"
it works.
The problem is that eclipse show compilation errors like :
The method entityManager() is undefined for the type MyType
or when trying to get model property :
mytype.getName();
The method getName() is undefined for the type MyType
I can see in the file MyType_Roo_JavaBean.aj that the method exits :
privileged aspect MyType_Roo_JavaBean {
...
public String MyType.getName() {
return this.name;
}
...
}
I am using eclipse Juno + roo 1.2.2 + Spring framework 3.1.0 + m2e plugin + STS plugin (nightly build).
I installed STS pluging hoping, it would help, but there is the same error with or without it.
Do you have an idea of what can be wrong ?
thanks !
Try to use the complete STS Version 2.9.x instead of a self assembled eclipse, because it looks like your eclipse is missing AspectJ. If you use the complete STS (Not only the spring plugin) you should have everything you need.
Another hint is to run in eclipse: project / maven / “Update project configuration"
I am using Spring Tool Suite 3.4.0.RELEASE, and ran into a problem similar to this.
Problem: There are numerous warnings and errors occurring through out my class.
Solution: Double check that you don't have any malformed methods anywhere in the class. Anything appears to cause this. Some possible causes could be missing (1) semi-colon (2) closing brackets, and/or (3) closing braces. In my case, I had made some changes to an Enum being used, and I forgot to check where it was being used. Once you get that cleaned up, you should be fine (or, at least I was).
What you need is an AJDT Configurator which also needs AJDT to be installed first.
So, if you don't have AJDT installed in your eclipse (Juno).. first install it from :
http://download.eclipse.org/tools/ajdt/42/update
Then, you need to install AJDT Configuarator from :
http://dist.springsource.org/release/AJDT/configurator/
Well, this thing worked for me, with the same configuration. Lemme know, if this helps you..

Groovy/Grails - Unable to Resolve Class

I am trying to build a Grails project in STS and am getting many error messages of the form: Groovy:unable to resolve class org.codehaus.groovy.grails.commons.ConfigurationHolder as well as others like Groovy:unable to resolve class org.grails.plugins.springsecurity.service.AuthenticateService
. I have Grails 1.3.7 selected in the Project Properties, but I don't see an item for 'Grails Depedencies' like I do when I create a sample project. Is this the problem? How can I add it back in?
I don't know why, but here are the steps I took to solve the problem:
Right click on the project and go to Grails Tools -> Enable Dependency Management
Grails Tools -> Refresh Dependencies. This correctly added the 'Grails Dependencies' library.
I still had plugin errors. I for some reason had to uninstall them and then reinstall them for the project to realize they were there.
For anyone who is using Grails >= 2.4
If you are using Grails 2.4 and above, use grails.util.Holders instead of org.codehaus.groovy.grails.commons.ConfigurationHolder.
Read the doc here section 'Static Holder'
Classes The following deprecated classes have been
removed from Grails 2.4.x:
org.codehaus.groovy.grails.commons.ApplicationHolder
org.codehaus.groovy.grails.commons.ConfigurationHolder
org.codehaus.groovy.grails.plugins.PluginManagerHolder
org.codehaus.groovy.grails.web.context.ServletContextHolder
org.codehaus.groovy.grails.compiler.support.GrailsResourceLoaderHolder
If you or any plugins you have installed are using these classes you
will get a compilation error. The problem can be rectified by updating
to new plugins and using grails.util.Holders instead.
If "Refresh Dependencies" has done all it can for you (as you indicate in your comment on the question), try disabling and re-enabling dependencies. You might try refreshing dependencies again afterward if the Acegi plugin still isn't recognized.
there is another way solved me this issue when i moved my workspace from Windows OS to Ubuntu , go to
yourWorkSpace -->yourGrailsProject-->setting folder --> org.grails.ide.eclipse.core.prefs,
then check all the grails paths are correct or not , because in my case all were pointing to windows paths ..
Hope this solve.
I faced a similar issue: "Unable to resolve class GrailsTestCase". I checked Grails Tools of my project and observed Dependency Management was already enabled (IDE - GGTS). I just disabled Dependency Management, refreshed and enabled it again. This solved the issue for me.

Eclipse RCP: How to troubleshoot plugin dependencies & classpath problems?

I am working on an RCP project based on eclipse. It has been working fine but recently I thought I'd upgrade it to use a new eclipse version (3.2 -> 3.5).
After a bit of trouble, it was running on the new platform. Then I did something. Don't know what. The end result is that I'm now getting a classpath error when one of my plugins (A) tries to access a class in one of the dependent plugins (B) (also one of mine).
As far as I can see, Plugin A has Plugin B in its' dependency list and the compiler shows no errors. To test, I created a new Plugin C with one class and accessed the class from Plugin A. That works fine.
Does anyone have any hints for troubleshooting such issues? A checklist of settings to check? I've been struggling with this for hours and getting nowhere! Particularly frustrating as it was working until I changed something!
Thanks
Update
I should also say that the project is quite old and uses the plugin.xml and not the manifest. Could this be a problem? Is there a way to upgrade?
Some ideas:
Clean-and-build every project (maybe after a restart of Eclipse)
Check, whether the required packages are also exported
Check the Error log, maybe there is some unloadable plug-in, etc.
Check the Run configuration, whether every required plug-in is present there
If the problem does not happen in a Runtime workbench, but in an Exported RCP app, then check whether you compile the project with the same settings during export than in Eclipse
I hope, something helps about these.
You can try the following in your run configuration:
In the Main tab check Clear (workspace) under Workspace Data
In the Configuration tab check clear the configuration area before launching under Configuration Area
This helps me every time I encounter some strange ClassNotFound errors.
If I understand you correctly you have no compiler errors but when you run you get class not found exceptions? You could try PDE Tools > Update Classpath from the project's context menu to see if you declared any dependencies outside of the MANIFEST.MF file, which would result in compiling code that fails at runtime.
I developed for RCP quite a long ago, but if I'm not wrong, since 3.4 or 3.5 you have to declare in the plugin configration which packages/classes are exported for dependent plugins and which are not.
This is unlike the old convention of using 'internal' in the package to mark non-exported packages.
Since you have plugin.xml from very old version of eclipse, it might be the problem, as exported resources from one plugin to another were not enforced in Eclipse RCP 3.2.
One more complement, hope it helps.
Open plugin.xml, check "build" tab, see how "binary build" are configured. It affects which files will compiled and exported.
See binary build here : http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Fguide%2Ftools%2Feditors%2Fmanifest_editor%2Fbuild.htm

Eclipse plugin - wrong jar used on runtime

I have a serious probleam with my Eclipse Plugin..
My plugin depends on another two plugins. All of theese plugins (including my plugin) use Mozilla Rhino engine - two of them use js.jar (version 1.4). But my plugin uses new version, which is not released yet and is packed in MyRhino.jar.
While developing, everything goes fine - code completion offers me classes and methods from my special version of rhino, no errors etc.
But when I run my plugin, a different version of Rhino is used and I get runtime exceptions like ClassNotFoundException and so on.
How am I supposed to tell eclipse to use the same jar in runtime as in development time?
When I was developing plugins on NetBeans, the solution was simple - wrapping the jar in a separate module, set which packages to export and declare dependency on this new module..
I found simmilar solution in Eclipse, however it did not work for me - although I declared a dependency on the wrapper plugin, the packages and classes were not available even in development time.
I've spent hours with this probleam and not solved it, so and help is appreciated. Thanks everyone.
Make sure your dependencies are correct. If your code depends on new version of library, then you need to indicate that in your MANIFEST.MF. E.g. if you require bundle org.mozilla.rhino, specify minimum version you need:
Require-Bundle: org.mozilla.rhino;bundle-version="1.5.0"
Your MyRhino.jar will need to specify correct version (e.g. 1.5.0), even though it is not released yet:
Bundle-Version: 1.5.0.qualifier
(If MyRhino.jar isn't converted to plugin yet, you need to do that manually: you can simply craete new plugin project using existing JAR in Eclipse)
Alternativaly, you can wrap MyRhino.jar into your plugin, and remove dependencies on other plugins. To do this, use Bundle-ClassPath (see http://www.aqute.biz/Blog/2007-02-19 for details). If you put your MyRhino.jar directly into your plugin, then Bundle-ClassPath should be:
Bundle-ClassPath: .,MyRhino.jar
Finally I've solved it..
It's simple to create the wrapper plugin form existing jar by the new project wizard in eclipse.. But the catch is that the wizard does not include the jar in bundle classpath (as I expected). Prety confusing (at least for me) that the wizard does only half of the job for you :/
After inserting the jar in the wrapper plugin bundle classpath, everytning works.
Thanks Peter for your answear anyway :)