I am developing a Google Appengine Java application and I am facing a major challenge testing with the local dev server. I dumped the Eclipse tools cause I'm more flexible with Netbeans and
I am using Appengine Maven plugin for my development.
This is my sample project structure :
myapp
module-endpoints
module-web
module-ear
pom.xml
The application works when I build with mvn clean install on the root folder(myapp) and also when I use the mvn appengine:devserver command to run the module-ear application, however I can't seem to access the cloud endpoints via http://localhost:8080/_ah/api. I can only access the endpoint's API via the dynamically issued port when I access it via the admin console http://localhost:8080/_ah/admin.
The issue with this is that when testing cloud-endpoint Javascript client on the module-web project according to tutorials I am supposed to use localhost:8080/_ah/api as my url to test. Am I missing something?
If the question is still actual you could always update your pom.xml with flags so that the ports of all your modules are defined:
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.target.version}</version>
<configuration>
<port>8080</port>
<jvmFlags>
<jvmFlag>-Xdebug</jvmFlag>
<jvmFlag>-Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=n</jvmFlag>
<jvmFlag>-Dcom.google.appengine.devappserver_module.mymodule2.port=9090</jvmFlag>
</jvmFlags>
<disableUpdateCheck>true</disableUpdateCheck>
</configuration>
</plugin>
Then you could use localhost:9090/_ah/api/explorer to test your APIs
If you have several modules deployed, you need to update your maven app engine launcher setup to recognize the different modules. See the modules sample Java app at https://github.com/GoogleCloudPlatform/appengine-modules-sample-java.
If you've already done that, then a dispatch.xml file will tell app engine how to route requests: https://cloud.google.com/appengine/docs/java/modules/routing
It worked when I made the endpoints project the default module.
dispatch.xml is ignored on devserver, the documentation states the following.
Dispatch files
All dispatch files are ignored when running the development server.
The only way to target instances is through their ports.
This means that only the default module will be reachable at the configured port (typically 8888 or 8080). I have just tested it with app engine 1.9.25 and it does not work, so no improvement has been made.
On the other hand you can always refer to the module by its port. The module's location is logged in the console when the application starts, you will see something like:
INFO: Module instance module2-auto is running at http://localhost:37251/
In my case this was useless since I was expecting to make AJAX requests to different modules by using the same host (but different urls). For instance:
Related
I have a spring boot app as backend and using react as front end (both are in same project). I only have the one pom file for the backend and I run the spring app manually and then do a npm start on the frontend, all works fine. What I want to do now is deploy both backend and frontend and start them up automatically. Do I need another POM file for the front end or something which will execute npm etc? Front end was created with create-react-app and currently running on port 3000 ( "start": "react-scripts start" ), my backend running on port 8080 but would be deployed to an external tomcat server.
Do I need to add the following plugin:
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
and then some execution rules in the pom?
Any information is much appreciated.
Thanks
If you want to create war in spring boot, you need to add packaging as war and spring-boot-starter-tomcat should be <scope>provided</scope>. I think yes you need to add, please check the reference in the below url,
https://github.com/spring-guides/tut-react-and-spring-data-rest/blob/master/basic/pom.xml
Ref: https://spring.io/guides/tutorials/react-and-spring-data-rest/
<packaging>war</packaging>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
let me chip in and say something else. If you need a war as packaging, you can proceed as per Thangavel said. But I am a bit sceptical to go for a deployment like that on a production site.
Since you are using a front-end framework and spring as backend, I would suggest another way. Usually after doing a build of your front-end, you will use a http server like apache or nginx to deploy your build and then your war or jar for your spring boot project.
But if you want to keep both in the same project, you can do a build of your react project and it should be possible to import those JS files of your build in a thymeleaf or JSP view. Then you would only need to run the project on port 8080.
Here is an example for Angular. I am sure you can look for same in React.
How to include angular2/4 component in JSP page?
Please let me know how it goes.
If you want a good reference implementation you can generate a jhipster project and look at how the frontend plugin is used.
Setting up IntelliJ IDEA to run my PHP Wordpress (for App Engine) projects. Google Cloud Tools installed.
Have imported existing project files and then went to Tools > Google Cloud Tools > Run on a local App Engine Standard dev server.
An error is returned:
Project does not contain App Engine Standard modules: To use the App Engine Standard local development server, the project must contain at least one App Engine Standard module with an appengine-web.xml configuration file.
I read up on appengine-web.xml and apparently its used for Java projects. I'm trying to run PHP at the moment.
I haven't dealt with this file type before, is it similar to app.yaml?
Do I need this fie to set up my local server for PHP?
Actually the file appengine-web.xml corresponds to the App Engine Java runtime, you don't need to use it in your PHP project. It is similar to the app.yaml in the sense that it is where you define your default service.
In order to define the default service in your PHP app, you need the app.yaml. There are also optional configuration files, such as:
dispatch.yaml, queue.yaml, index.yaml, cron.yaml, dos.yaml
On a side note, maybe PHP Storm or Eclipse with the PHP Development tools are more suitable for your use case.
I am migrating my web application from tomcat to wildfly. I was able to deploy the app using a temporary workaround of placing the configurations inside the WEB-INF/web.xml (). But I wanted it outside my war file. Is there any equivalent for catalina/conf/localhost/myapplicationconfig.xml in wildfly. Any suggestions please. I tried naming subsytem configuration and also placing it in modules but it didn't work for me
In my ionic application rest service doesn't work when i create apk file using below code
adb install -r platforms/android/build/output/apk/android-debug.apk
If i run application in browser:
ionic serve
then its work file
If I run application in mobile using below code
ionic run -l
then its work fine..
But once i create apk file and install in mobile then service does't work..
how can solve this problem??
please help
The most probable reason is that you don't have cordova-whitelist plugin. The newer version of cordova/ ionic requires for you to use this plugin
Steps:
Install the plugin
cordova plugin add cordova-plugin-whitelist
Update your config.xml to whitelist the allowed urls:
<allow-navigation href="*" />
Refer https://github.com/apache/cordova-plugin-whitelist for details
The rest web service is hosted locally on a development server or PC and running on a address like e.g. http://localhost:8888. Once compiling to an APK it will also be expecting the service address which obviously is not on the device itself.
Therefore you need to host the REST service locally on a development server or PC using a WIFI enabled network exposing the PC's IIS or Apache (which ever one you are using) or you can use cloud hosting and reference the newly created API address in the app's source before compiling the APK.
This ARTICLE provides a good explanation between the difference of ionic serve and run variances
I am struggling, and failing, to create a Java project on appengine which should use a nodejs server running in the same project in a managed vm.
Anyone knows of an example/template for appengine projects with multiple runtimes?
I believe you can just upload them all to the same "project" with different named modules. One of you modules will have to be "default" and the rest are just other named modules in the same project. I think you can just set vm=true on both projects so that they're managed-vm modules, not regular appengine modules (there might be some extra config here for managed-vms).
For instance you have one java module with an appengine-web.xml that looks like
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>my-modules-app</application>
<module>default</module>
<version>1</version>
<vm>true</vm> // for managed-vm
...
...
</appengine-web-app>
I've never tried node on appengine, but with a second module in python you could configure your app.yaml (same application, different module)
application: my-modules-app
module: non-default-module
version: 1
vm: true // for managed-vm
runtime: python27
...
Presumably, you just need to configure the node.js project correctly to upload to the same application with a different module name.