I try to add frontend (angular) in my backend project to deploy it on GCP.
When I try in local with: mvn appengine:run no problem, but when I want to deploy it with mvn package appengine:deploy I get this error:
ERROR: (gcloud.app.deploy) Cannot upload file [/Users/.../project/target/appengine-staging/static/front/node/node], which has size [41783856] (greater than maximum allowed size of [33554432]). Please delete the file or add to the skip_files entry in your application .yaml file and try again.
I didn't have a file: app.yaml.
I try to add .gcloudignore file but didn't work.
I don't know what I can do to fix this issue.
There's a 32MB static file limit with App Engine and this corresponds to the error you're receiving.
Evidently, you're including a file /Users/.../project/target/appengine-staging/static/front/node/node (possibly a NodeJS binary?) in your upload to App Engine and this is being rejected.
You should only include your Java-related sources and the static content (HTML|JavaScript) that forms the Angular app.
If you're unable to streamline the directory that's being deployed, you can use .gcloudignore to exclude content from the upload.
Related
I have simple Springboot application, but whenever I try to run the app
I get following error, I have tried mvn clean install, also tried reimports and Generate Sources and Update Folder options
/Users/a0r00rf/Downloads/SpringStartedCRUD/demoCRUD/src/main/java/com/abhimanyu/demoCRUD/com/abhimanyu/demoCRUD/com/abhimanyu/demoCRUD/services/EmployeeServiceImpl.java
Error:(1, 1) java: cannot access com.abhimanyu.demoCRUD.com.abhimanyu.demoCRUD.com.abhimanyu.demoCRUD.services
Error reading file /Users/a0r00rf/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.21/tomcat-embed-core-9.0.21.jar: zip file is empty
/Users/a0r00rf/Downloads/SpringStartedCRUD/demoCRUD/src/main/java/com/abhimanyu/demoCRUD/com/abhimanyu/demoCRUD/com/abhimanyu/demoCRUD/services/EmployeeService.java
Error:(1, 1) java: cannot access com.abhimanyu.demoCRUD.com.abhimanyu.demoCRUD.com.abhimanyu.demoCRUD
Error reading file /Users/a0r00rf/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.21/tomcat-embed-core-9.0.21.jar: zip file is empty
Error:(7, 8) java: cannot access java.lang
Error reading file /Users/a0r00rf/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.21/tomcat-embed-core-9.0.21.jar: zip file is empty ```
Find Tomcat under .m2/repository, remove it and mvn install again.
This usually happens when a few of yours particular dependency could not be downloaded properly. For this the cure is to go to $HOME/.m2/ and delete this folder.
This deletes all the dependencies installed. Then select invalidate Cache and restart from File in the topmost toolbar in IntellJ.
Then select your POM.xml file, right click and reload dependencies
It will download dependencies, index them and Boom it will work
I am trying to write and deploy a simple web-app at Google Cloud Platform. I installed gcloud and the corresponding libraries/plugins on Eclipse in my Mac. I use the following code to try to open a file specified in a HttpServeletRequest:
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
resp.setContentType("text/html");
resp.getWriter().println("<p>DEBUG: In Create2.</p>");
// get the file info
// to get the value of each input, always use the name and then
// req.getParameter(name);
String fileName = req.getParameter("file");
// create the file
File file = new File(fileName);
resp.getWriter().println("<p>"+file.getAbsolutePath()+"</p>");
if (file.exists()) {
...
}
else {
...
}
I put a test.txt file under project/src/main/webapp directory, run this project as an app engine and submit "test.txt" to servelet. But
In my local machine (localhost:8080), file.exists() always fails and the absolute path printed is
Applications/Eclipse/Contents/MacOS/test.txt
On the contrary, after I deploy the project to Google App Engine, everything works just fine and the absolute path printed is
/base/data/home/apps/XXXX/20170425t133741.400812218449586767/test.txt
I read a couple discussion threads all saying the file access in GAE/Google Cloud Platform is relative path. But why would my eclipse interpret it as an absolutely path when trying to open the file? Is there a fix on this issue so that I can always use relativ path both locally and on google cloud?
Thank you very much.
If you could set the working directory of the local App Engine dev server correctly, you wouldn't have problems using relative paths locally. Unfortunately, as of now, the Cloud Tools for Eclipse plugin doesn't support changing the working directory. Here is what you can do as a workaround:
Run the local dev server and check the server log in the Console view to see the actual web application root the server should use as a working directory. You'll see a log message like this:
WARNING: Your working directory, (<...your current, out-of-sync local server working directory...>) is not equal to your
web application root (<...your workspace...>.metadata/.plugins/org.eclipse.wst.server.core/tmp0/<...your Eclipse project name...>)
Open the Servers view. Stop the server.
Double-click on the server. Click Open launch configuration on the Overview page that pops up.
Select the Arguments tab.
Enter -Duser.dir=<...the directory of the web application root from the server log...> in the VM arguments: box. Click OK. (The Working directory section below doesn't work unfortunately.)
From now on, you won't see the WARNING message, and the server will use the directory you provided as a working directory.
UPDATE: This has been fixed in recent CT4E versions, which automatically set the working directory properly (unless you run multiple projects in a single local server). Update to the latest CT4E if you encounter this issue.
I have a play framework (2.2.3) project which also uses maven. One of the dependencies in my project is org.apache.wss4j.wss4j-ws-security-common-2.1.4.jar. This JAR has a messages folder in classpath. On starting play I get the following error (I am just pasting a few lines here)
Oops, cannot start the server.
MainException: class java.lang.NullPointerException(null)
class java.lang.NullPointerException(null)
java.io.FilterInputStream.read(FilterInputStream.java:133)
play.api.i18n.Messages$MessagesParser.parse(Messages.scala:216)
If I remove the messages folder from this JAR, play starts normally. I assume that Play tries to load all messages in the classpath and expects them to be files - it breaks because the messages in the WSS4J jar is a folder.
How can I resolve this error?
The way I solved this problem was changing the name to the folder that contains the "wss4j_errors.properties" file.
In code, edit line 42 at src/main/java/org/apache/wss4j/common/crypto/WSS4JResourceBundle.java
Run the tests, compile and try the new jar.
Not the answer I would like, but it works.
I uploaded a Spring application to Heroku but the application crashed with the following error:
java.io.FileNotFoundException: class path resource [com/myname/myapp/config/dao-context.xml
The file is definitely there, and it is in GIT, and the app runs successfully locally.
Any ideas what is happening here?
I suspect that when you are running locally, it is picking up the file on the classpath as a regular file on the filesystem (i.e. not inside of a JAR).
On Heroku, it is probably inside of a JAR file, which means it is not a regular file, and must be read as an input stream, which might look like this:
ClassLoader cl = this.getClass().getClassLoader();
InputStream inputStream = cl.getResourceAsStream("com/myname/myapp/config/dao-context.xml");
You can probably reproduce the problem locally by running the same command that's in your Procfile.
If this is not the case, then make sure the file exists on Heroku by running this command:
$ heroku run ls com/myname/myapp/config/dao-context.xml
For future visitors to this question, I overcame the problem by converting my DAO XML config file to the Java Config method, therefore Spring no longer required that XML file. This didn't directly solve the issue of being unable to find the XML file, but the added benefit is that I am now using the more modern and less verbose Java Config method.
When I am trying to run a Jasper Report,it is giving me this error.I am using this Jasper reports in adempiere technology.
-----------> ReportStarter.ejbGetRemoteMD5: Unable to create jndi context did you deployed webApp.ear package?
Remote hashing is impossible
12:21:15.496 ReportStarter.httpDownloadedReport: MD5 for local file is Cv0/FrUANvGZq2xkmOi1zA
-----------> ReportStarter.httpDownloadedReport: Remote hashing is not available did you deployed webApp.ear?
-----------> ReportStarter.getRemoteFile: 404 not found: Report cannot be found on server http://[Server PC IP Address]:4911/CustomReports/barcodePrint.jasper
12:21:15.541 ReportStarter.httpDownloadedReport: report on server is different that local one, replacing
Please tell me what to do,so as to solve this error.I tried to google it, but not getting it.
First of all, give path to the .jrxml file not the .jasper file .
Also in order to check that the path you entered is correct you can, copy paste the path on go to URL bar in chrome and check whether is generates and XML file. If it generates an XML file on chrome the path is correct and then you can move ahead.
P.S Check the path once the server is started.