I am trying to implement LAN based service discovery in my project. I have Apache Felix with the DOSGI single bundle distribution deployed. Additionally, I have the Apache Hadoop Zookeeper server running. i have been following this tutorial here
However, i dont know what it means when it says
To configure the ZooKeeper client in CXF/Discovery the following configuration variables apply. They need to be set on Configuration Admin PID org.apache.cxf.dosgi.discovery.zookeeper.
it then says
An easy way to set the configuration, it by placing a file called org.apache.cxf.dosgi.discovery.zookeeper.cfg in the load directory created by the FileInstall bundle with the following content:
zookeeper.host = 127.0.0.1
the problem im having is that i cant find the load directory that the FileInstall bundle is supposed to create. I need this to complete my final year project and am running out of time
any help on this is much appreciated
Many thanks
Billy
You should create the load directory yourself. You can even configure it to point to a different directory if you like. More information about that can be found in the documentation of Apache Felix File Install: http://felix.apache.org/documentation/subprojects/apache-felix-file-install.html
If you're after LAN based service discovery, then you might want to consider using different discovery protocols (like for example SLP).
And, shameless plug, you might also want to take a look at Amdatu Remote, which will be the reference implementation for the updated Remote Services specification: http://amdatu.org/components/remote.html
Related
I searched about cloning or copying weblogic and it's domain, and found 2 ways that I think is the most nearest to my question.
1, packing and unpacking a weblogic domain
2, Creating Extension Templates .
There is weblogic 12.2.4 installed on Linux server and I want to coppy it's configuration and domain and create my own instance with exact configuration.
If it's possible, pleas give me solution or some clues and key-word to search more.
And do I need to change some configs by hand or provided tool does everything?
Is copying domain different from copying weblogic configuration?
Thanks very much.
If you want to create a domain with the same configuration, but on Windows, you should use Weblogic Deploy Tooling.
The first step is to install Oracle Weblogic on your windows machine(s).
The second step is to use the discoverydomain.sh to introspect the domain, which is running on Linux.
The previous step will generate a model in YAML, which represents your Linux domain as code and then you will have to customize it with proper values for Weblogic's user's passwords, data sources, etc.
Once you have the model ready, you can run createdomain.cmd on Windows to create the domain. By the way, if your domain is distributed on several machines you will have to run pack and unpack after creating the domain with Weblogic Deploy Tooling because it only works on the node, which will host the AdminServer.
Here you have an example about using Weblogic Deploy Tooling with Ansible to create a domain with SOA https://github.com/textanalyticsman/ansible-soa-wldt
Yes, it is theoretically possible to copy $DOMAIN_HOME (WebLogic domain) to or from Windows.
However, I would NOT copy the $WL_HOME directory. Here a fresh installation is the only way.
As you mention the tool recommended by Oracle would be pack and unpack. With the assumption, that there is no WebLogic security realm configured.
Another option would be to create a new domain (preferable with the same name) with the Configuration Wizard and then copy the XML-fragments from the old $DOMAIN_HOME/config/* files in the fresh domain. Watch out for the encrypted passwords. Don't mix the encrypted fields in the old a new domain.
Another option would to use Windows Subsystem for Linux (WSL2). In this case, you can copy your files 1:1. $JAVA_HOME, $WL_HOME and $DOMAIN_HOME in one go. You WebLogic Server will start without any problems, except some DNS-Names or IP-Addresses issues.
I'm wondering if I can configure an OSGi container like Karaf (or any other popular ones) to download bundles (.BNDs) from a remote repository hosted on another machine, via any networking mechanism out there (RMI, HTTP, URLClassLoader, etc.)?
Ideally, I'd be able to deploy new versions of my bundles to this remote repo at any time, and somehow have that trigger the OSGi container "downloading" (installing/deploying) the remote bundles and hot-deploying them over older versions of the same bundle.
Is this possible? If so, how? Thanks in advance!
OSGi has an API for managing OSGi frameworks on the BundleContext that every bundle activator receives. This API allows you to install/update a bundle via URL or InputStream.
Since this is a standardized API there have been lots of people making bundles that provide a policy around this deployment process. The archetypical one is Apache FileInstall, it watches a directory and automatically installs every bundle found in this directory and uninstall the bundle when it is gone. This works well with for example dropbox. It also supports configuring via the the Configuration Admin service. On the other hand of the spectrum you find Apache Ace which provides a remote management system.
To find the best solution, try to enlist the requirements you have. One or two systems or 1 million? Local or remote over slow lines?
One thing is for sure, you will find some project or provider being able to provide you with an OSGi bundle that implements your desired management policy.
We use Apache Felix and maintain an OBR repository. Once set up you can deploy new versions from the OSGi shell. This does require you to manually log in and enter the command, for example deploy com.example.foo.
Alternatively you can install directly from urls, like install http://example.com/bundles/bundle.jar.
Your last requirement (auto deploy) is trickier. You could perhaps enable a remote shell on your OSGi container and as part of your build push the commands via telnet.
I recommend taking a look at the provisioning of Karaf at documentation for provisioning.
Your able to deploy bundles either with maven urls, http or file references. Or you might deploy your set of bundles either as a feature definition (which loads all required and used bundles from a maven repo) or by deploying a kar file.
I was wondering if it is possible to embed an OSGi container like Karaf inside a Tomcat instance. According to this SO question and a few others, it seems like its possible, but I can't seem to find any solid details on how to do this or what pitfalls/caveats to watch out for.
So:
Is it possible to embed an OSGi container inside Tomcat, so that I can hot-deploy OSGi bundles at any point to this container without having to restart Tomcat?
If the answer to #1 above is "yes", then what system services/ports does embedding OSGi inside Tomcat expose? I ask because I would like to deploy OSGi in a Tomcat server hosted on a Java PaaS where I don't have admin rights. And I'm wondering if - when I try to deploy the embedded OSGi container to Tomcat, that it will try to start listening on ports, or perhaps start doing something to the local file system. If this is the case I will likely receive security/permission errors.
Thanks in advance!
Is it possible to embed an OSGi container inside Tomcat?
Yes. In fact if you download Karaf and look in <KARAF_HOME>/demos/web you'll find a demo project that does exactly that.
what system services/ports does embedding OSGi inside Tomcat expose?
That would depend on what you install in it and how you configure it. Here is somewhat old (but IMHO stil relevant) discussion about default ports and how to configure them.
We deploy our application in the same fashion. We have deployed karaf in tomcat & on weblogic using a servelt bridge. The reason for using the container was to get past environment constraints where some customers are a "oracle" or an "ibm" shop and want all deployments done on these servers.
Since you will be using a servlet bridge it does not need to open a new port to list to http traffic. You may have issues with the karaf console if that port is blocked. Also I recall having issues with running cxf due to an embedded jetty instance it starts on another port.
Other than the ports you will need a karaf home directory with write access.
I am very new to enterprise technologies and web development and my current project has me stuck in a tough spot. I am using OSGI and trying to use HelpGUI my previous OSGI question and I cannot get a 3rd party library to display my html files from Java. Instead can I use OSGI or some other library to host those html files locally? I could then use Java to pop open a browser that points to the index.html on localhost right?
Let me know if my train of thought is sound. I googled for tutorials, but they take me down paths which I believe are overly complicated or do not get my html files available to the browser. Can someone start me in the right direction?
There is a simple way of doing this.
You need to host the html files inside OSGi and publish them over HTTP.
Hosting
One option (probably the simplest one) is to package them inside the jar of your bundle.
Publish over HTTP
The OSGi spec includes a small embedded web server and an API for publishing content in it.
The related service you need to use is called HttpService. Check the OSGi specification or the javadoc of the HTTPService to see how to use it.
You can publish servlets or plain resources - for your case the latter is enough.
You have to provide a short HttpContext class, which knows how to find your html files - e.g. by using
public URL getResource(String name) {
return (getClass().getResource(name));
}
You can check the HTTP Demo available in ProSyst's mBedded Server - it does exactly what you need.
Note that in some OSGi frameworks the HTTP Service maybe won't be installed by default - check what additional bundles are available in the installation and whether you have to install smth additional to make it available in the OSGi registry.
I am developing an web app using java/j2ee as middle ware and Mysql 5.1 as database. I have to deploy it on AWS-EC2 server.
My questions are:
How do I create the build
How do I deploy on ec2 server?
I am using Apache Tomcat-6. Should I use any other server like Apache2 as web-server?
Use WTP to create a Dynamic Web Module project.
Use AWS Toolkit for Eclipse
That's pretty terse, but you'll need so many more details that it's pointless to list them here. Read the docs, then come back with specific questions :)
Whether you need Apache2 in front of Tomcat depends on your requirements. If you need it you'll know it :) Things that you might want to punt off on Apache2:
SSL
Static content
URL rewriting
If you are just planning to do every thing manually. You should read this manual http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/
Basically,
You need to create an AMI instance of platform of your choice. (Win/Unix-based).
Configure it with the software that you need. In your case, Tomcat-6 and MySQL-5.1. Configure them. Set Schema etc.
Upload your WAR file to the instance and deploy to Tomcat-6.
Make sure Tomcat port (8080 or whatever you've configured) is open. You can configure this from AWS console's Security Group setting.
Use the instance's Public DNS to access your app. Public DNS can be found from AWS console.
There are many freely available, pre-configured AMI available. Since your setting is one of the most common one. I am sure you will get one and skip Step#2.