My Java Google Endpoints V2 project is throwing com.google.api.config.ServiceConfigException. What am I missing? - google-cloud-endpoints-v2

I am seeing below error in logs. What would explain it?
I have another similar project that is working fine. I have gone over my pom.xml, web.xml, appengine-web.xml multiple times and cannot see what is missing.
This was previously a V1 project. Does that enter in?
Thanks in advance.
com.google.apphosting.runtime.jetty9.JettyLogger warn:
Failed startup of context c.g.a.r.j.AppEngineWebAppContext#57e008cd
{/, file:///base/data/home/apps/s~form8949/
20171214t103140.406216052512279215/,UNAVAILABLE} (JettyLogger.java:29)
com.google.api.config.ServiceConfigException:
Failed to fetch default config version for service
'form8949.appspot.com'. No versions exist!
at com.google.api.config.ServiceConfigSupplier.
fetchLatestServiceVersion(ServiceConfigSupplier.java:157)
at com.google.api.config.ServiceConfigSupplier.
fetch(ServiceConfigSupplier.java:126) ...
2018 08 01 Addition per request:
Removing the below from my web.xml file silenced the error.
Unfortunately, I still don't understand the reasons and the implications of doing so.
<filter-mapping>
<filter-name>endpoints-api-configuration</filter-name>
<servlet-name>EndpointsServlet</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>endpoints-api-controller</filter-name>
<servlet-name>EndpointsServlet</servlet-name>
</filter-mapping>

If you're doing a strict migration and not needing the features in the Endpoints UI in Cloud Console, then you did some extra steps. You don't need the config or control filter. See the migration steps.

Related

How to use swagger-ui with service deployed in tomcat running on eclipse

I have a REST api running at http://localhost:8080/MyService and can see the JSON produced by swagger at http://localhost:8080/MyService/api-docs. In the Servers project in eclipse I have modified web.xml to include the Cors filter:
<filter>
<filter-name>CorsFilter</filter-name>
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CorsFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
but when I point swagger-ui (loaded in browser from file system) at http://localhost:8080/MyService/api-docs, I get the following error:
Can't read from server. It may not have the appropriate
access-control-origin settings.
Adding the Swagger dist directly to the webapps folder did the trick

The requested resource is not available error in Eclipse

Hi all I am working on Eclipse 6.0.36 and using tomcat server.I am having an error said "The requested resource is not available" error 404.I had seen other post on same question and this is the common error that many solution that I could find on google. But still cannot solve my problem.. I am also still new working on eclipse.If there any information that you need just ask me, before vote down.. there are so long codes that I need to show..
some says this might be caused by servlet command.My servlet,from web_bkup.xml files looks like this:
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SourceCodeServlet</servlet-name>
<url-pattern>*.source</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
surely there is lack of information that I give and you all can ask for it. But if there any solution that you all can shared.Hopefully can solve my error
Since you have only given little information, I try to answer under a few assumptions.
The 404 tells you that Tomcat could not find the resource e-system.jsp. I now assume that you have a project PM_Portal in Eclipse that you have successfully deployed to the Tomcat server, meaning there were no severe errors in the Tomcat log files which stopped the web application from starting. I also assume that PM_Portal is the root context of your application.
From that information, getting a 404 after successfull deployment means that there either is no JSP file e-system.jsp in the /WebContent folder of the Eclipse PM_Portal project or the Deployment Assembly configuration for you project lacks a mapping for the /WebContent folder. In order to check this, you can right-click on the project folder and choose Properties. Open the Deployment Assembly property and check that /WebContent is mapped to the root folder / of the target deployment.
Hope this is helpful.

nullPointerException when deploy webLogic 12c application

when i deploy my first web app on webLogic i get this error:
weblogic.application.ModuleException: java.lang.NullPointerException
at weblogic.application.internal.ExtensibleModuleWrapper.prepare(ExtensibleModuleWrapper.java:114)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:100)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:172)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:167)
at weblogic.application.utils.StateMachineDriver$ParallelChange.run(StateMachineDriver.java:80)
Truncated. see log file for complete stacktrace
Caused By: java.lang.NullPointerException
at weblogic.servlet.internal.WebAnnotationProcessor.processMultipartConfigAnnotation(WebAnnotationProcessor.java:286)
at weblogic.servlet.internal.AnnotationProcessingManager.processAnnotationForClasses(AnnotationProcessingManager.java:169)
at weblogic.servlet.internal.AnnotationProcessingManager.processAnnotations(AnnotationProcessingManager.java:114)
at weblogic.servlet.internal.AnnotationProcessingManager.processAnnotationsOutsideWebFragment(AnnotationProcessingManager.java:141)
at weblogic.servlet.internal.AnnotationProcessingManager.processAnnotations(AnnotationProcessingManager.java:102)
Truncated. see log file for complete stacktrace
I had this problem and resolved it by removing JSF 2.2 Mojarra 2.2.0 from the application libraries. It only needs to be in the classpath.
In Eclipse, edit properties for the project, go to Project Facets-->Java Server Faces and uncheck "Include libraries with this application" and Apply change.
I deploy from Eclipse (OEPE), same problem here without JSF. Here is what solved my problem:
Quit Eclipse
Delete the workspace's .metadata folder
Launch Eclipse
The same solution worked on NetBeans8. From projects, go to your war project, right click over Libraries > JSF2.2 and click Remove. Rebuild the project and deploy. Remember to deploy as shared library the JSF on WLS.
This seems to be a duplicate of Maven generated ear file fails during deploying weblogic server. Some details about the solution can be found in this post https://roundwheeltech.wordpress.com/2016/06/15/deploying-a-jsf-2-2-to-weblogic-12-1-3/.
Because WebLogic 12.1.3 ships with JSF 2.1, the required JSF jars have to be bundles within the WAR file (specified as dependencies in pom.xml). WebLogic must also be instructed to use the libraries packaged in the WAR file instead of the ones that are provided by the container.
I had the exact same NPE. It was started by an instantiation of an factory that went wrong. I had to remote debug in to find this. An exception in the initialisation of the factory is swallowed and we don't get the real exception.
In my case the problem was antlr.Token and antlr.CommonToken not arriving from the same source. This gave me an ClassCastException. I solved it by moving all libraries from the ear to war to get more control over them.
Edit the file web.xml and put:
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>

freemarker.runtime - Template processing error: "No mapping defined for http://www.springframework.org/security/tags"

Spring-security:3.0.2
Freemarker:2.3.19
I want to use springSecurity tags in freemarker, but it throws this errors:
[16 14:10:46,349 ERROR] [btpool0-0] freemarker.runtime - Template processing error: "No mapping defined for http://www.springframework.org/security/tags"
No mapping defined for http://www.springframework.org/security/tags
The problematic instruction:
==> assignment: security=JspTaglibs["http://www.springframework.org/security/tags"] [on line 1, column 1 in macro/header.ftl]
in user-directive page.bodytemplate [on line 6, column 1 in items.ftl]
ftl:
<#assign security=JspTaglibs["http://www.springframework.org/security/tags"] />
pom.xml
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>3.0.2.RELEASE</version>
</dependency>
if the problems happen with tomcat7-maven-plugin and not with jetty-maven-plugin you most likely suffer from the not fully initialized servlet context of tomcat7.
Instead of "tomcat:run", do "tomcat:run-war"
the latter makes sure that your web app is (almost) fully being build and bootstrapped, like having jars in /WEB-INF/libs. freemarker's scanning logic for tlds will work like a charm.
It seems like a tag library which you want to download contains the tag org.springframework.security.taglibs.authz.AclTag.
The last version of Spring Security taglibs (which had this class) was the 2.0.7 release, hence the problem.
You can change you spring to 2.0 version. Or you can download security.tld from https://src.springframework.org/svn/spring-security/branches/spring-2.5-integration-branch/taglibs/src/main/resources/META-INF/security.tld and use it on freemarker template like this: <#assign security=JspTaglibs["/WEB-INF/tlds/security.tld"] />
By the way I really don't understand why http://www.springframework.org/security/tags doesn't work... I have tried to use it like you, and I have faced the same issue.
I encountered this error when switched to run-jetty-run maven module.
Module jetty:run didn't had this error.
This helped me:
Download spring-security.tld file and put it in webapp/WEB-INF/tld folder
Add this code to web.xml:
<jsp-config>
<taglib>
<taglib-uri>http://www.springframework.org/security/tags</taglib-uri>
<taglib-location>/WEB-INF/tld/spring-security.tld</taglib-location>
</taglib>
</jsp-config>
The reason why this doesn't work has to do with the Servlet container (and maybe the spec). If you're associating taglibs by the namespace it will only do that automatically if the JAR is in the WEB-INF/lib folder.
If you move the spring-security-taglibs.jar into the WEB-INF/lib folder, it will work.

Why Jetty has not found CometServerServlet from Rocket package?

I have a common GWT application that is using (trying to) Rocket-Framework to implement a CometServerServlet.
After I have registered my servlet in web.xml and my app.gwt.xml, like this:
App.gwt.xml:
<servlet path="/server" class="myapp.server.MyCometServlet"/>
web.xml
<servlet>
<servlet-name>myCometServlet</servlet-name>
<servlet-class>myapp.server.MyCometServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>myCometServlet</servlet-name>
<url-pattern>/myapp/server</url-pattern>
</servlet-mapping>
Jetty apparently doesn't find the CometServerServlet from which my MyCometServlet extends:
WARNING: Error starting handlers
java.lang.NoClassDefFoundError:
rocket/remoting/server/comet/CometServerServlet
Caused by:
java.lang.ClassNotFoundException:
rocket.remoting.server.comet.CometServerServlet
That is strange, because I've added the Rocket jar to my project.
Could someone explain why this error happened?
I could understand if I "registered" the servlet in a wrong way or something, but at what point Jetty (or who?) looks for the CometServerServlet and fails at finding it?
Adding the jar to your project (e.g. in some IDE) will remove compilation errors, because the jar can be found at compile time.
But Jetty needs the library at runtime, and the usual way to provide it, is by putting it in the WEB-INF/lib folder of your project.
Of course, make sure to redeploy the app afterwards (e.g. if you're using Dev Mode, click refresh in the "Development Mode" view).