How can I deploy OSGi application? - eclipse-plugin

I have created OSGi service and Consumer application from this link.
However application is perfectly working from eclipse run configuration as described in link. Now I want to run this application from windows command line.
I created a xx.jar file using Export option in eclipse but when I try to run this jar, it says 'no main manifest attribute, in xx.jar'.
Any ideas?

Related

What files will get deployed and where can I find the files in worklight console?

We are developing a mobile app using IBM MobileFirst platform.
We compile the code using the command line tool with the command 'mfp build' and deploy it using 'mfp deploy', and we are able to preview the application from the URL mentioned below: http://localhost:xxxxx/worklightconsole/index.html
After doing 'mfp build' I get these 6 files:
mobapp.war
mobAppAdapter.adapter
Dashboard-all.wlapp
Dashboard-common.wlapp
Dashboard-desktopbrowser-1.0.wlapp
Dashboard-ipad-1.2.wlapp
Questions:
Where can I find the 6 files in 'worklight console'? (or)
Which other URL I have to refer to verify whether the files have been deployed correctly or not?
Because when I type in 'mfp build' it deploys the files but we are not sure where its getting deployed. We don't have WAS installed instead 'liberty' is used to our knowledge
The MobileFirst Platform CLI tool contains an embedded WebSphere Liberty profile server inside of it. It is this server and its internal database (during development time(!)), that the artifacts you have mentioned get deployed to.
You create a project ("mfp create").
You then start the server ("mfp start").
You then create your applications, develop them, etc...
Eventually you build and deploy it to the server ("mfp build", "mfp deploy").
The resulting files of the build command are the .adapter and .wlapp files.
These get deployed using the deploy command to the server's database.
You then see these files in the console using "mfp console".
The .war file is your project's runtime, containing metadata required for various server operations. This file is part of the server and handled automatically by the underlying tooling. This is invisible to you during development.

Deploying appfuse app on cloudbees as war

I have appfuse maven project , is it better to deploy it using Click start Tomcat or as a Jenkin Maven project? I have tried both but it does not seem to be working in any ways. I have created database and bound it to the app. still it gives error for spring bean creation etc. Can anyone help in this scenario?
If I would need to deploy my appfuse maven application on CloudBees platform, I will try two different ways:
Use the Tomcat 7 Maven ClickStart as a template changing the SCM to your repo.
Use the CloudBees SDK to deploy your application.
In this last case, you just need to generate your .war file, in case you use maven, launching:
mvn clean package
And then you can deploy your application from the CLoudBees SDK using:
bees app:deploy -t tomcat7 -a APPID MYFILE.war
You say that when you deploy your application it gives error for spring bean creation. However, you don't attach any stacktrace to your question, so it is difficult to do any kind of diagnosis on our end.

When I run the Application, only "web" engine is running in GlassFish. "webservices" is not started

i tried a simple web service program for the first time.
When I run the Application, only "web" engine is running in GlassFish. "webservices" engine is not started.
i have installed java ee sdk 1.6
I assume you have have created a dynamic web project with Webservices annotations on your classes. On deployment, and logging into Glassfish Admin console and then navigating to Applications and looking under Engines column against your deployed application, Glassfish showing only web and not showing webservices.
To enable the webservices, it appears your classes are not compiling under default build/classes directory.
Do either of the following:
Right click on your project > Build Project.
or Go to eclipse menu > Project > Build Automatically
Now redeploy your application again. webservices Engine should be visible along with web engine.
Make sure you're using Full Profile not Web version of Glassfish
in your glassfish bin folder check if the following command has webservices in it
glassfish4\bin>asadmin list-containers
if not you have the web version
goto https://glassfish.java.net/download.html and download, unzip and replace your files
I had similar problem. Actually project was working with NetBeans and local GlassFish, but when I deployed on GlassFish 4.1.1 (on amazon linux) "webservices" engine did not start. I followed previous answer (form mposadar) and just added in class initializer block:
#WebService(endpointInterface = "service.ITranslate")
public class Translate implements ITranslate
{
{
try {
URL url = new URL("http://MY_INSTANCE.us-west-2.compute.amazonaws.com:8080//Translate/TranslateService?wsdl");
} catch (MalformedURLException ex) {
Logger.getLogger(Translate.class.getName()).log(Level.SEVERE, null, ex);
}
}
...
After build and deploy, "webservices" option works also on remote server, as well link to "View Endpoint" and wisdl is available.
According to oracle page there are differences between webprofile and full profile glassfish
the option
Implementing Java Web Services 1.3
is only ticked for full profile, so wouldnt work if you have the web profile
You can look at the license file name to determine which Full profile or Web profile
<glassfish install dir>/glassfish/legal/3RD-PARTY-LICENSE.txt
<glassfish install dir>/glassfish/legal/3RD-PARTY-LICENSE-WEB-PROFILE
Glassfish documentation also states:
If you are using the web profile, you can also use Update Tool to obtain technologies that are included by default in the full platform, such as:
Enterprise Java Beans
Metro
Jersey
I do have the full profile of GlassFish server, so What i did was to manually execute the wsdl url of my java class. For example:
My Java class is "Test": url = http://localhost:8080/ProjectName/TestService?wsdl
then I reload the aplication tab of the glassfish admin.
done problem resolve.
hope this helps anyone
Delete your glassfish4 server from current eclipse ide(eclipse must support jee).
Go to Windows in eclipse menu bar select show console and choose server.
click install new server link in the console.
Select JDK1.8 not default jre. after that choose glassfish 4.0 to install.
Browse directory where you want your glassfish to be install (better choose in C:/Program Files/glassfish).
Click on install server button. Accept the licence and wait till your glassfish 4.0 get installed by eclipse ide.
Finally deploy your application it'll show webservice and view EndPoint.
There have two type version of Java EE on Oracle website.
i) Java EE 7 Platform SDK
ii) Java EE 7 Web Profile SDK
if you want to see "webservices" engine is start on GlassFish Applications then you have to work with "Java EE 7 Platform SDK" version...

How do you deploy a non-web Java app through CloudBees Jenkins "Deploy Now" feature?

With CloudBees now supporting deployment of Java applications, is it possible to use the post-build action in Jenkins "Deploy to CloudBees" to deploy your app? Furthermore, I'd like to use the Maven assembly plugin's jar-with-dependencies goal so that I can simply and automatically deploy my entire app to CloudBees right through Jenkins.
While the current CloudBees deployer Jenkins plugin appears to not support this, in fact it does. Here are the steps that after much trial and error worked for me:
Include the jar-with-dependencies maven plugin in your pom.xml. I used the <goal>single</goal> and <descriptorRef>jar-with-dependencies</descriptorRef> described here. That will put an additional jar file in your target folder {artifactId}-{version}-jar-with-dependencies.jar
Deploy that jar via the CloudBees API. The last line of this page explains how to do that. Specify your runnable jar, make sure the runtimeContainer=java, and the jar file to be uploaded, and it should deploy. Even though CloudBees says to use a zip file, a jar file works just fine.
Once that has been deployed once via the command line, your app ID now "remembers" those settings so that it can be done via Jenkins so long as you're doing the CloudBees Deploy to that same app. In your Jenkins job, add the "Deploy to CloudBees" Post-build action to your configuration. Click "Add Web Application" (strange, I know, since it's not a web-app! CloudBees says they will work to change that...), select First Match (even if it's a Maven project, use First Match), enter your application ID that you deployed your app to in step 2, and then enter the full name of your jar file and try your build again. It should upload your jar file and activate the instance in your CloudBees PaaS. Note that this still hard-codes the version in the jar file - I am working to see how to setup a variable for the version of the jar file so that it corresponds to the Maven build version.
Once you have it setup correctly and deployed initially with the bees sdk, it should just deploy from the deployer plugin on Jenkins as a war normally would.
Once set up, the settings that define where your main class is persist between deploys.

maven tomcat plugin or cargo plugin?

The spring source code examples use maven tomcat plugin and i am able to run these projects using the command mvn tomcat:run but what i dont see the application is not deployed in local tomcat server("C:\apache tomcat\webapps\")..
And how it is different from cargo plugin? (In this case when i ran the command mvn cargo:redeploy, i see the application deployed in the location "C:\apache tomcat\webapps\")
If i add cargo plugin to the POM of spring examples (like mvn-showcase,petclinic)..will it screw up the things?
The spring source code examples use maven tomcat plugin and i am able to run these projects using the command mvn tomcat:run but what i dont see the application is not deployed in local tomcat server("C:\apache tomcat\webapps\")
The command tomcat:run starts an embedded Tomcat, it doesn't deploy an application to your local Tomcat (why does it matter anyway?).
And how it is different from cargo plugin?
Cargo is a container agnostic tool so you could configure it to use a remote container, a locally installed container, an embedded container (as long as implementations are provided for a given container) and still use an unified API (or set of commands).
In this case when I ran the command mvn cargo:redeploy, I see the application deployed in the location "C:\apache tomcat\webapps\"
Cargo doesn't support running Tomcat+6.x in embedded mode. So you are very likely using it with a locally installed container and your app gets physically deployed on it.
If i add cargo plugin to the POM of spring examples (like mvn-showcase,petclinic)..will it screw up the things?
It won't screw up anything, why would it.
You can use tomcat maven plugin and deploy it to external tomcat server.
see this link for all the available goals. tomcat-run will start a embedded server but tomcat:deploy works for external tomcat.