example stand alone application using EJB-MDB, eclipse, jetty server? - ejb

how to develop one example application using EJB-MDB, eclipse, jetty server?
I have created two java class. and i have .jar file, where I have to deploy .jar file in jetty server? after that what I have to do?

Your requirement for EJB-MDB seems to demand a full blown server like Jboss, Glassfish, TomEE and others. If you need jetty with the equivalent of EJB MDB functionality probably you should look at Spring-Boot. On the other hand if you need EJB/MDB compatibility you should probably choose an Application server and each of these comes with a plethora of examples and quickstarts, but each one comes with it's own Servlet Container respectively Undertow, Tomcat, Grizzly, but not Jetty.

Related

Standalone Tomcat Server for webapp

I am newbie in configuration. I have made Spring web application. When I run it on Intellij's Tomcat it works correctly. Now I would like to move to a different computer without Java, IntelliJ on it. Is it possible to do this only with Tomcat (XAMPP) installed?
To run a java web app (including Tomcat) you need to have Java on all computers at the level of your web application code.
i.e. if your web app is done with Java 1.8 then you have to have it there.
You treat the deployment as a standard java web application deployment check out this link:
http://www.codejava.net/servers/tomcat/how-to-deploy-a-java-web-application-on-tomcat

HttpAdapter to JavaServlet commnication

Initially we had the application server as a separate one. The communication to the Application Server from worklight servers using adapters. But currently we are moving the Application Server code to the Worklight's Server folder. We are able to call the java class (Simple java class not servlets) using HTTPAdapter. But it is difficult to communicate with the servlet (which is included in the server folder) using HTTPAdapter. Plese provide any solution?
If I understand correctly, you have put some servlet classes in your Worklight server folder. As they are Java classes they are now visible to your adapters. However servlets to be true servlets must be deployed to a JEE servlet engine, with appropriate configuration. You can deploy Servlets (in a WAR file of their own) as a separate JEE application on the same server as Worklight, but you cannot package them inside Worklight itself.
edited in response to your clarification:
You want to consolidate your servlet application, which is providing data accessed via the worklight adapter onto the same server instance as the worklight server. The Worklight Server is actually a JEE application deployed to one of the supported JEE servers, usually WebSphere Liberty which is supplied with Worklight, and the Worklight Server is in fact packaged as a WAR file. Your Data Provider servlet will also be packaged as a WAR file, all you need to do is deploy that WAR to the Liberty server you are currently using for worklight.
If you are doing this is development in Worklight Studio you can find the relevent folders by looking under "Worklight Development Server". You can drop the WAR into the apps folder and if necessary edit the server.xml to add any extra configuration:
WorklightServerConfig/servers/worklight/server.xml
See: http://www-01.ibm.com/support/knowledgecenter/SSCKBL_8.5.5/com.ibm.websphere.wlp.nd.doc/ae/twlp_dep_war.html
a second edit to try to explain again.
The Worklight Project represents your application, when you deploy to the Worklight Server a WAR file is created let's call this MyApp.WAR, that can be deployed to a WebSphere Application Server, inside Worklight Studio you are automatically given a WebSphere Liberty Profile. That Liberty Profile's configuration can be seen in the Project Worklight Development Server. Key Idea here you have one App Server that Liberty Profile, and you deploy the MyApp.WAR file to create what we usually call the Worklight server, it's the MyApp.WaR that is serving your Worklight console. That WAR file is derived from the contents of your project's server folder, this folder's name is a little misleading it's not the "server" itself it's your project-specific WAR information.
Now in addition you want to run a Servlet you already have packaged as a WAR file, let's call this Data.WAR. The key point is that you need to run Data.WAR on the Worklight Developmennt Server, the Liberty Profile. You are not including this DATA.WAR file into your project's server folder, that would effectively put DATA.war inside MyApp.WAR. Instead all you need to do is put Data.WAR in the Worklight Developmennt Server's apps folder and adjust the server.xml.
So: Step 1. Get Data.WAR running in the Development Server. Verify that from a browser you can call your expected servlet. Note the URL that works. Do not make any attempt to use your adapter until you have verified this.
Step 2. Adjust you adapter to call that URL.

Spring web app deploys on Gradle's embedded Jetty but not in standalone Jetty

I have built a small web app using Gradle. Things seemed to be going well using the embedded Jetty server, but not so well when I tried to copy the WAR file to a standalone server.
I used the gradle war plugin to assemble the war.
Running gradle jettyRunWar works fine.
Copying the war to the Jetty webapps folder and running Jetty fails with this exception:
java.lang.IllegalStateException: No such servlet servlet_name
But this very same servlet is found and used without issue in the embedded Jetty server.
The same issue happens if I manually copy the exploded war to the webapps directory.
The Spring web and Spring mvc libs are copied and present in the WEB-INF/libs directory, so it isn't an issue of not finding Spring (or is it?)
I'm using Jetty 9.1, and my web.xml file is configured for Servlets v3.
I'm also using Spring 3.2. The web app I'm writing is a RESTful service, using the #Controller annotations to route requests.
This should be as simple as copying the war over, but it seems not to be. At a bit of a loss at what to do here, any thoughts?
Thanks!
Sometimes the answer is staring you in the face...after posting I realized that I had my servlet-mapping before my servlet declaration. While this did not present an issue for the Gradle Jetty (not sure why), it made Jetty unhappy. Not sure why I changed the order to begin with...
In short, Jetty seemed to not find the servlet because it had not been declared yet.

ASP.NET application to host on Java EE configured directory

One of our clients has a Java EE application. We would like to develop a new project using ASP.NET/C# by hosting the application as a sub directory under this Java EE project.
My questions are:
Will the .NET application run smoothly?
Do I need to keep anything in mind before I make a promise to the client?
The way you strucure your projects do not affect the behavior of your applications at all.
However in the end, each of the compiled and not compiled resources need to be configured propoerly to their proper Web Server, you shouldn't have any problem at all.
IIS has its own directory and Tomcat(or whatever you are using) will have its own directory.
Just let him understand that there is no sense on sharing the projects in a single root folder if the projects are not going to be related at all.
The only way to make them interact is by means of services and queues that you can orchestrate in any of both technologies.
UPDATE
let's suppose that:
you are using default of both web servers: your IIS need your applications to be copied to c:\inetpub folder whereas tomcat uses the $CATALINA_BASE system variable to locate their own folder. That won't be a problem at all.
Now, let's suppose that your client chose the same exact folder to be the root of your websites in tomcat and iis, (very bad maintenance decision by the way)
you could also separate both environments by having two folders : JAVA and DOTNET
Now let's suppose your client won't accept any logic suggestion, and you have to merge java files and aspx files, technically there won't be any issue because each web server will handle requests for very different issues, however, if you are also using the same resources, let's say a picture used in both pages, you will have locked-files issues, your iis can only respond for its own behavior and tomcat will only respond with its own behavior.
So in summary, technically speaking it could work, performance will be hit on your hard drive, it all depends on the request loads of each app, but overall it is a bad infrastructure design.
hope it helps,

Cannot access SOAP service when Flex 3 app is compiled

I've got a flex app that hits a remote SOAP service and populates a list with the results.
It works fine when i run it through flex builder, but when i compile the application and move it onto a webserver it can't access the services.
I've tried it from a standalone webserver and on my own machine. I'm assuming that there's a security issue that i've missed as i can't think of any other reason why it's ok in flex builder but not when compiled on the same box.
Thanks all.
Is it a crossdomain.xml issue?
The web server running the SOAP service needs crossdomain.xml file to allow your flash movie to access it. See http://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html

Resources