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
Related
I have created application from Jhipster's template,
I have changed almost nothing in the project and it's working fine on local machine but when I deploy it to my server (ubuntu, apache, tomcat - all are the last versions) weird things start to happen.
I have AJAX call to "/api/account" which on local machine get's in response the following json
{
"timestamp":1440703613150,
"status":401,
"error":"Unauthorized",
"message":"Access Denied",
"path":"/api/account"
}
and on the production server (you can check it here) same call get's json WITHOUT "path" field in it
{
"timestamp":1440703613150,
"status":401,
"error":"Unauthorized",
"message":"Access Denied"
}
I stuck on this for long period of time, so, please help me if you can :)
As you have an Apache front-end, have a look at your mod_http_proxy settings, ProxyPass and ProxyPassReverse.
You should also have a look at your Apache logs.
Or disable Apache and access JHipster directly, so you know if this is caused by Apache or not.
I can't see why this would be an issue.
Your setup is probably different somehow, if you want to have same setup the best is to use the executable jar embedding TOmcat rather than deploying it to a server.
Are you running in prod profile for both your local machine and production server?
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)
I have a rare problem, at least for me.
I have a project built in Java. Using Maven and Spring MVC. I define a couple of controllers to redirect between pages (.JSP).
I deploy my WAR project on Tomcat webapps folder. And everything seems fine.
Now when I access to the app from the server local IP (192.168...), everything works.
But, when I access from public IP, the only thing I get is the folders of the project, it's like the context configuration of Spring and controllers doesn't work.
Of course, I can to navigate to each page with the complete URL.
Already checked that both directions also point in the same folder.
Thanks in advance.
EDITED
I want to say that I configure apache and tomcat connector. So When I enter to my local IP with the :8080, my app works fine. But when I enter without it, I see the list of folders.
EDITED 2
My web server is Apache.
And my connector configuration is:
workers.properties:
worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
/etc/apache2/mods-available/tomcat_connector.conf:
<IfModule jk_module>
# Tomcat Connector custom properties
JkWorkersFile /etc/apache2/workers.properties
JkLogFile /var/log/apache2/jk.log
JkShmFile /var/log/apache2/mod_jk.shm
JkLogLevel error
JkMount /manager/* worker1
JkMount /host-manager/* worker1
</IfModule>
And the only thing that I add to /etc/apache2/sites-available/default is:
JkMountCopy On
I get some information from this tutorial:
http://blog.sourcerebels.com/post/28254180614/usar-apache-como-frontal-de-tomcat-en-ubuntu-server
Thanks!
Sorry, but I tried searching for this subject, but I didn't find related to my problem.
Recently, I bought a domain and web hosting for it. I bought it especially for using it for my Java projects.
I have Tomcat available as server on the hosting.
My question is: how do I work with a hosted Tomcat, which, in my opinion, it is quite different from localhost (where you could have unlimited access)?
For example, if I create a Spring project that looks like this:
project-name
src
war
index.jsp
WEB-INF
web.xml
The index.jsp outputs a simple This is a test
web.xml
<welcome-file-list>
<welcome-file>
index.jsp
</welcome-file>
</welcome-file-list>
I created an Ant build.xml that will build the project, but when I access from http://domain.com/project-name it will not work, and I only cand access the file from http://domain.com/project-name/war
If I had done this on localhost, I'd deploy it in tomcat-path/webapps, but how does this work online?
The solution is to install Tomcat Manager Webapp in order to deploy applications on a shared hosting that uses Tomcat as server.
EDIT:
If the hosting doesn't offer you Tomcat Manager (as was in my case), you can still make it through by asking the administrator of your hosting to configure your jk_mod file to deploy your war files.
Append these lines
jkMount /*.war ajp3
jkMount /* ajp3 ## I'm still not sure if this made it work, because it makes tomcat listen on the entire public_html
But be aware, if your version of Tomcat is brought to you by cPanel's EasyApache, you will have to deal with some issues there too - the latest installed Tomcat will be 5.5.33 (a bit old, right?), but again you can try tweaking the old version and install, let's say 6.x.x
A tutorial about this upgrade:
http://www.bestdesigns.co.in/blog/install-tomcat-6
The thing that help me a lot to understand the concepts that were envolved in solving this problem:
http://www.scribd.com/doc/6085698/Tomcat -- a training course about Tomcat and cPanel
An another thing to add: Install a local version of Tomcat on your machine, first deploy it on localhost. If there it works, it should be working online as well.
Those of you who work with Spring Roo, on Tomcat 5.5.33, if you already know, you cannot deploy your projects, becase of the too old Tomcat, so you have to upgrade your Tomcat immediately.
I hope this will help all of those who had difficulties like myself.
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