How to add external jars in Eclipse - java

I'm unable to successfully add and use these external jars from my Eclipse Repository.
org.apache.felix.dependencymanager.annotation-4.0.3
org.apache.felix.dependencymanager.runtime-4.0.2
org.apache.felix.dependencymanager.shell-4.0.3
org.apache.felix.dependencymanager-4.2.0
I get no errors at the Add Files to Repository window:
I, however, get an error warning pop-up window after clicking on the Finish button.
'Building Workspace' has encountered a problem
Errors occured during the build.
I then get the error below whenever I add them from the Available Bundles tab into the Run Requirements tab and then try to resolve the Run Requirements (even though I have added all the jar).
org.osgi.service.resolver.ResolutionException: Unable to resolve <<INITIAL>> version=null: missing requirement org.apache.felix.dependencymanager
How can I successfully add and use these jar files to my project?
Eclipse
Eclipse Java EE IDE for Web Developers.
Version: Mars.1 Release (4.5.1)
Build id: 20150924-1200
Java:
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)

Eclipse Equinox is the OSGi framework developed in the frame of the Eclipse foundation. Deploying on the Eclipse platform means deploying OSGi bundles in Equinox.
You are using Apache Felix, which is the OSGi framework developed in the frame of the Apache foundation.
According to your explanations, it seems you are trying to install Felix as an Eclipse bundle:
[...]add and use these external jars from my Eclipse Repository.
If you wish to develop an Eclipse project which would be deployed as an OSGi bundle in the Apache Felix framework (and not an Eclipse plug-in project), the Felix Documentation details how to integrate Apache Felix with the Eclipse IDE. It seems in this documents snapshot are out of order, but the general procedure should be right. Three ways to include the Felix runtime are specified, an Eclipse repository does not seem to be the right way.

Related

Unable to create Enterprise application in NetBeans IDE 12.6

When I try to create an Enterprise application using the wizard (Ant project) I get the following error
java.lang.NullPointerException: Cannot invoke "org.netbeans.modules.j2ee.dd.api.application.Application.setDisplayName(String)" because "this.application" is null
at org.netbeans.modules.j2ee.earproject.ProjectEar.setupDDFromVirtual(ProjectEar.java:290)
at org.netbeans.modules.j2ee.earproject.ProjectEar.getApplication(ProjectEar.java:255)
at org.netbeans.modules.j2ee.earproject.ui.wizards.NewEarProjectWizardIterator.testableInstantiate(NewEarProjectWizardIterator.java:160)
at org.netbeans.modules.j2ee.earproject.ui.wizards.NewEarProjectWizardIterator.instantiate(NewEarProjectWizardIterator.java:139)
at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.instantiate(TemplateWizard.java:1048)
at org.openide.loaders.TemplateWizard.handleInstantiate(TemplateWizard.java:602)
at org.netbeans.modules.project.ui.NewProjectWizard.handleInstantiate(NewProjectWizard.java:51)
at org.openide.loaders.TemplateWizard.instantiateNewObjects(TemplateWizard.java:436)
at org.openide.loaders.TemplateWizardIterImpl.instantiate(TemplateWizardIterImpl.java:228)
at org.openide.loaders.TemplateWizardIteratorWrapper$ProgressInstantiatingIterator.instantiate(TemplateWizardIteratorWrapper.java:155)
at org.openide.WizardDescriptor.callInstantiateOpen(WizardDescriptor.java:1602)
at org.openide.WizardDescriptor.callInstantiate(WizardDescriptor.java:1546)
at org.openide.WizardDescriptor.access$2300(WizardDescriptor.java:67)
[catch] at org.openide.WizardDescriptor$Listener$2$1.run(WizardDescriptor.java:2233)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
Of course, all the fields in the wizard are filled. However, there are no errors when creating WAR and EJB separately. The error occurs only when an EAR is created, even if it is empty.
use
NetBeans 12.6
Windows 10 OS
GlassFish Server 6.2.1
Java 17
All paths are spelled out correctly, read / write permissions to directories are set
Screen
I can reproduce your problem, and NetBeans Bug Report 5953 "Creating a new Enterprise Application (Java with Ant) impossible (only when selecting JakartaEE9) - NPEs thrown" has already been raised.
The bug report is unresolved, but the problem only occurs when creating a Jakarta EE 9 Enterprise Application. I successfully created a Jakarta EE 8 Enterprise Application simply by selecting Jakarta EE8 from the Java EE Version drop list within the wizard.
You have several options available to resolve this, but none of them are good:
Wait for NetBeans to fix the problem. Definitely not recommended!
Create a Jakarta EE8 Enterprise Application with the Ant wizard instead, if you don't require EE 9 functionality.
Create a Jakarta EE8 Enterprise Application with the Ant wizard, then "hack" the generated projects to use EE 9.
Use another IDE which properly supports this functionality.
Create the EE 9 Enterprise Application in another IDE, then import the projects into NetBeans.
Using Maven or Gradle isnstead of Ant as the build tool doesn't help either:
I couldn't create a Maven Enterprise Application when using Jakarta EE8 or Jakarta EE9, though I didn't research why.
The project wizard doesn't even offer "Enterprise Application" as an option when using Gradle.
Notes:
NetBeans 13 will be released next month, but I don't think this issue will be fixed.
Also see the (ominous) bug report "NETBEANS-2871 Resolve Enterprise Application support" from 2019 which remains unresolved:
Need to figure out whether maybe Web Applications (in Ant, Maven, and
Gradle) might not be enough in terms of Java EE support, i.e., do we
need Enterprise Applications and EJB-specific project types, if not,
let's remove them.
It works with jakarta EE9 provided you do the following:
Plugin versions in all pom.xml files:
maven-compiler-plugin 3.9.0
maven-war-plugin 3.3.2
maven-dependency-plugin 3.2.0
In the pom.xml file of -ejb- change packaging war to jar.
Then:
Clean and build in the following order:
top, ejb, web and ear.
That's all.

Having problems installing Glassfish Tools (1.0.1) through Eclipse (2019-12)

I'm having troubles getting glassfish tools to install on my machine with fresh installs of the Eclipse IDE (2019-12), jdk 1.8.0_241, glassfish (5.1 Full Profile), and glassfish tools (1.0.1).
To recreate my problem, here's what I did:
Install Eclipse with the "Eclipse IDE for Enterprise Java Developers" flavor selected into a folder.
In that same folder, download and then extract the glassfish zip to that same folder.
Open eclipse and use the help menu to install software.
Putting the repository link for glassfish tools (https://download.eclipse.org/glassfish-tools/1.0.1/repository/) into the work with and installing both.
The error I get is:
Software being installed: GlassFish Tools 1.0.1.201904090220 (org.eclipse.glassfish.tools.feature.group 1.0.1.201904090220)
Missing requirement: GlassFish Tools 1.0.1.201904090220 (org.eclipse.glassfish.tools.feature.group 1.0.1.201904090220) requires 'org.eclipse.equinox.p2.iu; org.eclipse.sapphire.feature.group [9.1.0,10.0.0)' but it could not be found.
I honestly can't think of the first step to try and fix this error, as all the googling about equinox.p2 and sapphire makes it out to be that they should be installed by default.
Add https://download.eclipse.org/sapphire/9.1.1/repository/ to your list of Available Update Sites and try it again. The downloadable repository contains only the artifacts built from the Glassfish Tools project.

How to correctly support servlets in WildFly8.2.0

My problem is when adding WildFly 8.x Runtime in targeted runtimes in eclipse, then I can't run servlets, I mean the server runtime library is not in the path.
can you provide me with help.
I'm running ubuntu 14.10, eclips luna, JRE 1.8 and WildFly 8.2.0.
note: I don't want to manually add the servlet-api jar file.
Thank's in advance.
Edit1:
I found that not only the servlet implementation part is not loaded, but all other modules of WildFly, so this ensures me that the problem is in the whole server runtime!
Edit2:
as stated here in 2.1.1. Installing a new runtime section,
You will also note a Deploy-Only Runtime type. This type does not provide a classpath for WTP projects. It is used solely by it's server type for the purpose of setting up a deploy directory for users who do not wish to make use of starting, stopping, or debugging their projects inside Eclipse.
can I conclude that my version is has a "deploy-only runtime type", but it's Version 8.2.0.Final 2014-11-20 Java EE7 Full & Web Distribution !!!
It's OK now, I just installed JbossAS Tools, which is described in eclipse as follows:
Provides WTP server adapters for JBoss installations. These adapters are capable of deployment and providing classpaths for projects
then I could specify project runtime for new projects directly, or add WildFly runtime as a server library from build path for old projects.

eclipse default build and ant build

Cntrl+B( or clean-> build) will build complete java project under eclipse environment. Is this build uses project which is configured default build or it builds based on the eclipse plugin?
one of the java application I have seen is eclipse build will build complete project and depoy in the tomcat directory. How this is happening?
You might have seen the deployment feature with an Eclipse configured with WTP (Web Tools Platform).
WTP is featured in the Eclipse IDE for Java EE Developers and Eclipse IDE for JavaScript Web Developers, and contributes to many of the other Indigo packages.
WTP is able to deploy an app in a Tomcat (or in a local Tomcat within Eclipse itself).
See also "How does eclipse deploy web applications using WTP?"
You can see an example a a build and deployment in "HowToSetupEclipseWtp".

Eclipse RCP: Target platform - Eclipse vs. Equinox?

I'm just starting with OSGi and Eclipse RCP.
Could someone explain to me the difference between "Eclipse" and "Equinox" as the target platform, when creating a new eclipse plugin project?
I still know that Equinox is Eclipse's implementation of OSGi.
I read in some articles that eclipse rcp is also based on Equinox. So where is the difference between the target platform you have to choose in a new Eclipse Plugin Project?
Best regards
Choosing "an OSGi framework":
This simply creates a new bundle with no required plug-ins or imported packages (unless you choose an activator in which case the org.osgi.framework package shows up under imported packages).
Choosing Eclipse version:
After clicking next the wizard gives you the checkbox "This plug-in will make contributions to the UI" and allows you to create a rich client application
Without any other options an Eclipse plugin will have org.eclipse.core.runtime as a required plugin. If you say the plug-in will make contributions to the UI then org.eclipse.ui is added to required plug-ins. By saying you want to create a rich client application the Templates are different on the final screen and you are forced to choose one to finish. Also your Activator will extend Plugin if you did not choose the UI option and AbstractUIPlugin if you did choose the UI option.
There is nothing different about the bundles that are created in either manner, the wizard just sets up some default required plug-ins/imported packages for you. Of course as VonC pointed out some of the dependencies setup by the Eclipse route may not be compatible with other OSGi implementations.
It is about the environement in which the module you will be creating will run: see this
Vogalla's RCP Tutorial
Vogella's OSGi with Eclipse Equinox
Eclipse Equinox is the runtime environment on which the Eclipse IDE and Eclipse RCP application are based.
In Eclipse the smallest unit of modularization is a plugin. The terms plugin and bundle are (almost) interchangable. An Eclipse plugin is also an OSGi bundle and vice versa.
bundle for OSGi, able to run in the Equinox framework (within or outside of Eclipse)
plugin for Eclipse, to run within an Eclipse-based application.
See Equinox Quick Start Guide:
The Equinox OSGi framework implementation forms the underpinnings of the Eclipse RCP and IDE platforms but it is in fact a fully standalone OSGi implementation.
You can run a bundle independently from Eclipse:
java -jar org.eclipse.osgi_3.2.0.jar -console
Once this is running you will see an osgi> prompt. This is the OSGi console waiting for you to type commands

Categories

Resources