I could need some help.
I want to use Xpages that communicates with java source. Actually I get a problem by importing the ReferencedLibraries of the Java project.
This standalone project has many java packages in use, so I think domino gets trouble by using them.
I'm not sure, but I think it's because there are some libraries/packages twice now.
Once on domino and once in the imported library of the java project.
Has anybody an idea or experience how I could get it work?
Is there a way to find double packages?
Or is domino able to use one of them?
I don't want to proof and deselect every library by hand. That would be a big effort and would not make sense because I have to to it again if the new release of the java project is comming.
Thanks for help.
Importing Java packages is certainly possible. You'd have to provide more details what issues you're seeing.
Domino uses OSGi. So you can use OSGi capabilities, e.g. "exact match" in your dependency definition.
Are you trying to import the libraries into an NSF or as OSGi bundle?
Related
How would you implement a Plugin-system for your Java application?
Is it possible to have an easy to use (for the developer) system which achieves the following:
Users put their plugins into a subdirectory of the app
The Plugin can provide a configuration screen
If you use a framework, is the license compatible with commercial developement?
First you need an interface that all plugins need to implement, e.g.
public interface Plugin {
public void load(PluginConfiguration pluginConfiguration);
public void run();
public void unload();
public JComponent getConfigurationPage();
}
Plugin authors should then bundle their plugins into JAR files. Your applications opens the JAR file and could then use an attribute from JAR manifest or the list of all files in the JAR file to find the class that implements your Plugin interface. Instantiate that class, the plugin is ready to go.
Of course you may also want to implement some kind of sandboxing so that the plugin is restricted in what it can and can not do. I have created a small test application (and blogged about it) that consists of two plugins, one of which is denied access to local resources.
Use OSGi.
It is the foundation of the Eclipse plug-in system. Equinox is Eclipse's implementation (licensed EPL) and Felix is the Apache Project's implementation (licensed Apache Public License).
Eclipse provides a concrete example that OSGi can cover the points you mentioned (or you could just build your application on top of Eclipse RCP if you want a full Eclipse/SWT/JFace stack).
Since 1.6, there's been java.util.ServiceLoader which can be used if you want to code your own simple system.
But if you want anything more than basic features, use one of the existing frameworks.
Use PF4J.
It has support for Web, Spring and Wicket.
Easy to use and build the applications
There is also JPF (Java Plugin Framework).
I worked on OSGi for a week--an intense, nothing but OSGi week. At the end it was like a bad dream but I learned a lot.
I was able to get OSGi working (not easy, all examples are out of date, everything on the net is at least three years old if not five), but I had serious trouble getting it integrated into an existing project because of issues with the jar manifests.
In short, there are only a few obscure tools used for building manifests and they are not well documented (BND Tools is hardly obscure, but it is designed for a certain process in Eclipse). Also, most of the OSGi information available is not targeted towards application developers who have an existing desktop application.
This makes a lot of the context for the information foggy or inappropriate. Neil Bartlett's blog posts were the biggest help, but even those failed to get a working system (I grabbed some code from the Felix tutorial and pieced it together to get the embedded framework rolling). I found his book draft that he posted for free years ago, which is excellent, but the examples in Eclipse do not work because of changes in Eclipse OSGi support.
I think that recommending OSGi for solving the above stated problem is extremely poor advice. OSGi is "the right choice" but for a scenario as the one above, I think either JPF or some homegrown minimalistic framework is sufficient.
Years ago I started a project like that and I hope soon will be ready.I got inspired by projects like NetBeans and Eclipse but meanwhile it changed to something a little bit different. OSGi looks like a good choice now, but I didn't had a chance to compare it with my project.It is similar with JPF mentioned above, but in the same time different in many ways.
The basic idea which motivated me is to be as easy as possible to build Java application, with no separation between web applications, desktop applications or applet/JWS applications(of course this doesn't cover the UI - yet) as a core functionality.
I built the project with a few goals in my mind :
it doesn't matter if you build a web application or a desktop application you should start the application in the same way, a plain main method, No fancy web.xml declaration(not that I'm against having a standard web descriptor, but it doesn't go well with a plug-in system, where you add "servlets" - I call them RequestHandler(s) - dynamic at your will).
easy to plug in "extensions" around an "extension point" - something from Eclipse but a different approach.
self-deployable, since all the plugins are registered(XML files) the application must be self-deployable independent of the build system - of course there is an Ant task and a Maven MOJO which are the links with the ourside world, but in the end it calls the application and instruct it to self-deploy itself at a specific location.
borrowed from Maven, it can download code from repositories(including Maven 1 & 2 repositories) so your application can be deployed as a single small jar as long as you have access to the repositories(useful sometime, and basically this provides support for auto-updates - don't you love the idea to be notified by your web application that there is a newer version, it was downloaded and it just needs your permission to install it? I know I love that).
basic application monitoring about system health, email notifications in case of failures
I'm using Eclipse Luna (64Bit) and I have to develop a System, which can manage several Plug-In's. The Plug-In's must be included at Runtime dynamically and I've read, that it is possible to do this with the OSGi-Framework. In Eclipse I started to implement some Example Plugin-Projects and now I want to include them into an another Eclipse Java-Project but thats over my head till now.
Is there a solution for this problem anyway or do I have to use another Framework?
Thanks for all answers!
Are you trying to write a plug-in for Eclipse or create your own plugin management system? If the latter, I'd suggest that you use OSGi as the basis instead of re-inventing the wheel. There's lots of good documentation on the 'net about how to do that.
I am working on a library that ideally will have a strictly-Java component and added functionality for Android-specific projects, with the intent to be most useful for Android apps, but also work with other Java apps.
But my question is: how should this be designed? I do not plan on needing resources, so I want to compile it into a JAR, but would I need to make two JARs, one of the Java stuff and another for the Android stuff? Or would a Java-only application be able to use a single JAR so long as it does not use the Android components?
If you make a library that uses pure java and does not use any android apis. It will work on both standard java and android java. However if the library uses any android apis it can't be used in a standard java project.
As far as I know, the JAR would be good for both types of aplications. It seems to mee that both JARs (just Java and android) are totally identical and thus equally compatible. If you don't use any of the android components, including Resources there should not be a problem at all.
You should still check whether you depend on libraries which are available on android and any normal Java distribution or -if not- either tell the user to preinstall the depending libraries or ship them whitin your JAR package and build path. Be carefull not to use libraries which are not available on android because the user has no or really few options to install them on himself.
What I don't understand is why you think your library is more usefull to android developers. I can not think of any example where this could happen. If the problem is really specific for android, you should consider developing the library android-only. If the problem is more general the lib will be usefull to all developers that might come to this problem, not just android.
I am on a project that uses GWT/ eclipse/ SQL Developer and the guy who originally implemented it is no longer on the project. We have a normal WAR and everything but the jsp files are kept in a different environment. Anyone know why? Can they not be run through GWT?
The issue we are facing is the only way we have to test/ compile JSPs is to actually deploy it into DEV which takes a lot of time. So we are in need of being able to run JSPs locally.
I have been told someone used to use Jdeveloper to do this, but I am unfamiliar with it and the only YouTube tutorials are in a foreign language (in regards to using JSPs with JDeveloper 11g). Someone else suggested notepad/ Tomcat? Or yet another option would be to configure eclipse to run it with our current project in GWT?
I am not familiar with any of this being I am brand new to JSPs,Tomcat, etc. and am in desperate need of some help.
What is the best way to accomplish my needs and are there any guides/ tutorials to help me through the process?
My requirements are just to run a folder with 4 linked jsps and be able to connect to the database to provide the information.
"I am not familiar with any of this being I am brand new to
JSPs,Tomcat, etc. and am in desperate need of some help."
That's sounds true!
One answer about the different environments is that jsp needs "EE" .I.E. EclipseEE but the GWT app just uses plain old eclipse (like an eclipse helios release with GWT plugin).
Regarding your requirements, I can't understand them clearly enough to begin to provide helpful information, but good luck.
Tony
I am developing a framework where jars can be dropped into a folder and scanned for a function that can be called later. My first implementation used naive ClassLoader method where the jars were loaded and the class instance created. This is plugin architecture.
The problem I ran into is the versioning. Let's say for example my host app is using third-party lib that depends on org.joda time version 1.6 and the plugin is dependent on version 2.1 of the same (newer ) library.
I tried to use the Java Simple Plugin Framework but it does not seem to load my plug-ins using custom class loaders (which is what i assume i will need to overcome the version conflict and have the 2.1 version actually loaded).
My next step is to try osgi.
So, the question is: is this the right approach or is there a simple way that i don't know, I am coming from .net world and don't know java too well but i remember dll hell, and this seems to be the java version of it. I am developing in Scala btw, but that should not matter to the main question.
I had a similar use-case. I wanted a simple plugin framework much like you have described, but was not ready to jump into OSGi. I went the custom classloader route, but ran into much the same problems as you have. I did try a Parent-Last Classloader, which did help with some of the jar conflicts. That might be something to look into. I looked fairly seriously into what the CI Server Jenkins had done for their plugin system - and found this article interesting.
In the end, I needed to be able to track when services are coming and going, have a service registry, etc... and realized that I was re-inventing OSGi. I switched over to pure OSGi, and even though there is a learning curve and it can be a pain sometimes, I'm glad I did.
Try ScalaScriptEngine. It allows you to dynamically load and compile classes from source files and supports quite a few advanced features.