openejb + Tomcat : How to use ejbd protocol? - java

I have deployed an openEJB.war in a Tomcat container. I have deployed an EJB in the /webapps folder of Tomcat. When I call the ejb via HTTP it works fine :
props.put(Context.PROVIDER_URL, "http://localhost:8080/openejb/ejb");
I would like to use ejbd protocol instead of http but I don't know how to do this. If I replace http://localhost:8080/openejb/ejb by ejbd://localhost:4201/ or ejbd://localhost:8080/ it doesn't work. I think Tomcat doesn't provide any ejbd listener. If I deploy my EJB on openEJB standalone server, it works fine.
Do you know how can I fix this?
Thanks

For provider url we use
ejbd://localhost:4201/ejb
Also, you may need to review this page to setup all necessary properties and configuration: http://openejb.apache.org/3.0/embedded-and-remotable.html
Especially, set openejb.embedded.remotable to true

Related

Jhipster apache tomcat install

I'm using JHipster to build a web application (awesome project, keep going guys :).
I'm using a server where apache is already installed deploying a php app (http://www.myurl.com)
I'm trying to deploy my JHipster app under another url (http://www.myurl.com/my_project)
I tried :
rewrite rule to redirect /my_project http://localhost:PORT/my_project using my own tomcat install
using runnable jhipster war
changing some cong in yml file to add context under server > context-path
Nothing is working fine :
access to first page webapp ok but 404 to any other pages
blank page, unable to load resources because context is missing I think
doesn't change anything
Any other idea? Something I forget? Something related to webpack ?
Thanks for any help :)
Use apache(httpd) proxying to redirect calls to your jHipster application to your tomcat
the configuration is meant to be put in apache configuration files you must have proxying mod enabled in apache but if my memories are good proxying user sessions from apache httpd to tomcat can be quite tricky. The following syntax is what you are looking for
ProxyPass "/images" "http://www.example.com/"
ProxyPassReverse "/images" "http://www.example.com/"
https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html

how to configure Embedded Tomcat virtual host for Spring Boot Application?

i have a multiple domains on my centos vps (domains running on apache http server via virtual host configurations). and also same vps, i want to add my new domain but that domain will route my spring boot application (application is a jar file also inside embedded tomcat ). i couldn't find any configuration for embedded tomcat specific domains and ports.
standalone Tomcat i can make configuration via server.xml file like this image
also this short tutorial shows configuration for stadalone tomcat Tomcat Virtual Host Configuration
But how can i do that configuration for embedded Tomcat ? Any suggestion ?
With Spring Boot embedded Tomcat, you are hosting only one application per servlet container. So I don't believe that Tomcat's concept of Virtual Hosts make sense at all.
If you have to host your app on shared Tomcat instance, just build WAR without embedded container.
It depends. 2 ways to deploy your project.jar as you want to :
First way : You can use the "apache web server" and his own "mod_proxy" in order to serve as many Spring webapps you want to, each on a specific port configured with "php-fpm" and with a proxy defined to route requests from/to your namebased VirtualHost configuration.
Nowadays, with Spring Boot 2.5, all you have to do is to set the property server.port in your application.properties file, and use it accordingly with mod_proxy directives.
If you are using profile, you can either set one port to dev or prod or test or whatever properties file you need.
Another way to proceed : you can use the apache web server "mod_jk" bridge module to configure multiple load-balancers for your Virtualhosts too.
Choose your path, young Jedi ;)
This response is certainly not for the OP, 7 years later, but for other people whom are using any web search engine like Google. They will come here and see "something is impossible". It is not true.

Is it possible to disallow jsp execution on tomcat + apache

I have an application tomcat + apache + mod_jk + spring mvc deployed on remote server. After making request to the controller I am having jsp source code in the response. It is not related with spring config cause locally it is working. After debugging mod_jk I see that tomcat returns jsp source.
I think the problem is related with remote tomcat or apache (cause it was configured by our it department). Is it possible to dissalow jsp execution on tomcat or apache (maybe httpd conf)? Plese suggest how can resolve this problem.
Apache Web Server does not execute JSPs, so you're probably getting your JSP from there.
Normally, static files are deployed on Apache Web Server, and dynamic files (JSPs, Custom Tags, classes, etc.) are deployed on Apache Tomcat (where Apache Web server redirects the corresponding requests). Check if your app is deployed this way.
Try to send an HTTP request directly to the Apache Tomcat (without intervention of Apache Web Server, and see what happens)
The reason was that jsp compiler was disabled see org.apache.jasper.servlet.JspServlet, in the tomcat\conf\web.xml. It-team says that it is recommend option for production)

Humanizing the URL scheme when deploying a Spring app to a production environment

I am a complete newbie, just starting with Spring.
I have developed a sample app which I want to deploy on a production environment. My problem is that my app serivces still look like that:
http://mydomain.com:8400/myserver/myapp/controller/view
I want to humanize this and turn it into something like that:
http://mydomain.com/controller/view
basically removing the port as well as the boilereplate /myserver/myapp/, since this domain will be used entirely for the purposes of that app
However, I still want to keep the existing url scheme as well.
How do I do that? do I have to configure server.xml (for the port), web.xml, .htaccess or something else?
To remove the port, you have at least 3 choices:
let the container server (Tomcat or what ever) run on port 80
use a Proxy Server (for example Apache Httpd) run on port 80 and forward the requests to your application Server (Tomcat)
use some Firewall constraints to forward the requests fron port 80 to 8080
To get rid of the log path: you can use a combination of that ideas:
(if you use an tomcat) rename the war to ROOT.war (uppercase) instead of myapp.war. Then you will get rid of the "myapp" part.
Use some java framework like tuckey UrlRewriteFilter to change the rest of the urls

GWT urls change when deployed to tomcat

Simple question, maybe someone knows:
In GWT devmode, my urls look like this: http://myserver/myapp/myservice
When I run 'ant war' and deploy that war on tomcat, they mysteriously change to: http://myserver/myapp/myapp/myservice
Everything still works, but obviously the URLs are uglier. I'd like to just keep the URLs used in devmode. Any info is appreciated, thanks.
-tjw
Deploy the web service as ROOT.war, not as myapp.war, because the first 'myapp' is the web application context path, and 'myapp/myservice' is the path inside the web application.
Change your mappings in your web.xml to all start with / instead of /myapp/ and deploy your application as myapp.war or deploy the war as Root.war
Ok, I've got a solution for this. So many people are having this problem all over the net, I decided to answer my own question. The key is to use #RemoteServiceRelativePath in your RemoteService interface file. For example, to solve my original problem, I would annotate my RemoteService interface like this:
#RemoteServiceRelativePath("../myservice")
This way, whatever path is in front of the service's URL is irrelevant. Now in the web.xml, instead of using /myapp/myservice as the url-pattern, I just use /myservice. Now it works in both GWT's devmode and in Tomcat with no further modification needed.

Categories

Resources