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?
Related
I have a big problem, I want to send my backend to Google Cloud Run however, I get the following error when I follow this tutorial for the jvm part: https://quarkus.io/guides/deploying-to-google-cloud#deploying-to-google-cloud-run
ERROR: (gcloud.run.deploy) The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable. Logs for this revision might contain more information.
I tried to defined this variable in my application.yml : quarkus.http.port: 8080 but it still doesn't work :(
If you have any advice, I am interested, thank you very much
Look at https://github.com/cescoffier/polycloud-demo/blob/main/src/main/resources/application.properties.
This is part of a demo deploying on Google Cloud Run. As you can see, the port is configured using:
quarkus.http.port=${PORT:8080}
Also, make sure your application starts correctly. If there is an issue during the startup, the port is not opened.
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
I am writing and small app using Java EE. I am using Apache Tomcat v 7 and Eclipse as IDE. When I Run the project (Run on server) I get :
http://127.0.0.1:8080/java-web/lis
(That's fine)
But I don't know If there is some way to rewrite the [java-web] dir just to get :
http://my-local-app.dev/list
I suppose there is some way like in Apache Server using confing files and enabling
the mod_rewrite.
I'll apreciate your help. Thanks
In short: All of the pieces you want to change are components of your deployment environment. Unless you have a specific need to override them, it's usually easiest during development to use the URLs that are a little less pretty.
If you do want to alter them, you need to familiarize yourself with what the various parts of an HTTP URL mean. What you have in your test environment is this:
http:// 127.0.0.1:8080/java-web/list
protocol host port path
You could insert an entry into your hosts file listing my-local-app.dev at 127.0.0.1, but that would not change the port or the path.
The port is determined when Tomcat starts up and is 8080 by default. The general port for HTTP is 80, but specific permission is required to bind to ports below 1024. On Linux, the authbind package makes this pretty easy; on Windows, the necessary steps will depend on your version and configuration (e.g., if you have a Group Policy).
In Tomcat, Web applications are prefixed with their names in the path; it looks like your (hypothetical?) application is named java-web.war. You can install an application as the "root application", but this requires a little bit more configuration and is generally skipped in development.
All of this can indeed also be done using something like mod_rewrite, but that seems like overkill to have slightly prettier URLs for your dev machine.
If you want your application to respond to the my-local-app.dev, you need to purchase the "my-local-app.dev" domain and get a Java web hotel running on it.
If your web application is named "java-web" and you do not want the URL to reflect that, you need to tell Tomcat that you want your application deployed at the ROOT location where the name of the web application is not present in the URL. This is typically done in the deployment stage but unfortunately there is no standard location to say this for WAR files so this is vendor dependent. For example does Glassfish use an extra XML file in your deployment.
I believe Tomcat supports this for ROOT.war files. If not, you probably needs to set the META-INF/context.xml file. See https://tomcat.apache.org/tomcat-7.0-doc/config/context.html for details on what to put in this file - especially the context path.
On my Windows development machine I have IntelliJ setup to run my the static html through Apache Webserver and the GWT-RPC services with Tomcat. Everything is working except the debugging of the server code of the GWT-RPC services. Is it possible to still debug the GWT-RPC server code this way?
Here is how I do it:
Configure tomcat server instance in IntelliJ and make sure you can start your application WITHOUT GWT debugger. In other words in your IntelliJ IDEA go to edit configurations and add tomcat local server and choose your war file to be deployed to tomcat
Start your tomcat in debug mode through IntelliJ
Make sure you can open your application and it works at the URL you expect it to work, should be something like that http://localhost:8080/applicationContextThatYouSpecifiedInTomcatDeployentTabConfiguration
Make sure that now you can debug your server side by clicking inside you application and checking if the requests are stopped at appropriate break points on server.
Create GWT run configuration in IntelliJ
Make sure that you have Dev Mode Parameters set to "-noserver -bindAddress 0.0.0.0" noserver means when you will start GWT configuration from intelliJ it won't start embedded server, since we're using Tomcat as our server now.
Run GWT configuration through IntelliJ in debug mode - and YES you have now two configurations running at the same time: one for client side(GWT) debug, another one for server side(Tomcat) debug.
Now, in your browser add to the end of URL following text ?gwt.codesvr=127.0.1.1:9997.
For example if in URL you have http://localhost:8080/hiThereMyApp/index.html the new URL should look like http://localhost:8080/hiThereMyApp/index.html?gwt.codesvr=127.0.1.1:9997
P.S. sometimes browser's gwt plugin will complain that 127.0.1.1 host is not allowed as a GWT codebase, in this case try either replacing 127.0.1.1 to localhost or your computer's ip address, or try to configure your browser's GWT plugin to actually allow your desired gwt codebase.
Do I understad you correct?
You have a GWT application running in dev-mode hostet in intelliJ
And you have the serverpart of this Application running hostet within a tomcat?
If so, you should start your tomcat with enabled remote-debugging and connect you intelliJ.
Ok, I now can debug server code with the described setup:
To be complete I include the steps I already knew and had done:
First you have to configure Tomcat to support remote debugging. This is described in link that Christian Kuetbach gave in his answer. In short it is adding two options to the jvm:
-Xdebug
-Xrunjdwp:transport=dt_socket,address=<yourport>,server=y,suspend=n
(I already did this step)
The seccond step is where I needed help, configure IntelliJ.
You have to include a Remote Run/Debug configuration. In this configuration you need to specify the port from step 1. Also, before starting the GWT debugging you have to start this Remote debug configuration so it will connect to the Tomcat debug socket.
Now you can debug the client code and the server code in the same IntelliJ session.
I'm trying to deploy my first servlet to my server. There are, of course, many tutorials online. But most of them are very detailed and complicated, and I only need to deploy a few simply servlets to this server.
I found what I think to be the shortest method of deployment: Deployment on Tomcat Startup. I moved my .WAR file (FirstProject.war) into $CATALINA_BASE/webapps folder, but when trying to access it (ServerIP/FirstProject) I get the "The requested resource is not available." error.
Is there anything I forgot in the process of deployment?
I know that deployOnStartup has to be set to true, but I didn't change anything with the server's hosts, so the current host is localhost. I didn't change its settings, so deployOnStartup should be true (It's said that true is the default).
What am I missing?
You are using easiest way but I don't know what you are missing. Here what I would suggest is run your server and access through localhost:8080 then click manage app then enter username and password then you can deploy your war.
If you have any query post command.
Even i used to face this problem while deploying my first web application on Jboss and Apache ..
Even though your code is working properly with all your servlet mappings and paths using in your content files ...some times they kick back in real time environment ..So we have to know the proper deployment folder structure and accordingly we have to change our paths in the code
what i am concluding is check the below lines of code
Examples, assuming root is http://foo.com/site/
Absolute path, no matter where we are on the site
/foo.html
will refer to http://foo.com/site/foo.html
Relative path, assuming the containing link is located in http://foo.com/site/part1/bar.html
../part2/quux.html
will refer to http://foo.com/site/part2/quux.html
or
part2/blue.html
will refer to http://foo.com/site/part1/part2/blue.html