Robots.txt in AppEngine Java - java

I have a Java AppEngine web application. I noticed in the dashboard in admin console of appengine that there is a URI error encountered everyday for /robots.txt.
How to remove the error?

robots.txt is a magic URL used by search engine and other robots before processing your site. See wikipedia for more details.
The best way of dealing with this error on GAE is to put a robots.txt file, and define it as a static file in your app.yaml for gae/python:
- url: /(robots\.txt)
static_files: \1
upload: (robots\.txt)
And in appengine-web.xml of gae/java:
<?xml version="1.0" encoding="UTF-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0"
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://kenai.com/projects/nbappengine/downloads/download/schema/appengine-web.xsd appengine-web.xsd'>
....
<static-files>
<include path="/favicon.ico" />
<include path="/robots.txt" />
<include path="/img/**.png" />
<include path="/img/**.gif" />
<include path="/css/**.css" />
</static-files>
Of course, you may just as well ignore the errors, they don't matter to anyone but yourself (no human is encountering the error).

Related

Getting Uncaught init() exception created by servlet [JAX-RS Servlet] in application [ABC_WSv2.1] in LIberty 21.0.0.6

we are getting below exception in liberty running in linux box for jax-rs based web service application. But while running in local windows version Liberty (21.0.0.6) , it works fine and no exception thrown. Also we tried various option available in stack overflow and google, nothing worked. can anyone help us on this
E SRVE0271E: Uncaught init() exception created by servlet [JAX-RS Servlet] in application [ABC_WSv2.1]: java.lang.ClassCastException: com.abc.occws.SearchingApplication incompatible with javax.ws.rs.core.Application
server.xml configuration below
<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">
<!-- Enable features -->
<featureManager>
<feature>webProfile-8.0</feature>
</featureManager>
<!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
<httpEndpoint httpPort="9080" httpsPort="9443" id="defaultHttpEndpoint" />
<dataSource id="ABCDataSource" jndiName="jdbc/ABCDS" queryTimeout="20m" type="javax.sql.DataSource">
<connectionManager agedTimeout="1000m" minPoolSize="1" numConnectionsPerThreadLocal="10"/>
<jdbcDriver libraryRef="OracleLib"/>
<properties.oracle URL="jdbc:oracle:thin:#//10.135.157.5:1565/DOABC_APP" password="xxx" user="xxxx"/>
</dataSource>
<!-- Define JDBC Drivers -->
<library id="OracleLib">
<file name="C:/dev/Liberty/ojdbc8-19.3.0.0.jar"/>
</library>
<applicationMonitor updateTrigger="mbean" />
<application id="ABC_WSv2.1" location="C:\Dev\Liberty\ABC_WSv2.1.ear" name="ABC_WSv2.1" type="ear" context-root="/abc-ws">
<classloader commonLibraryRef="OracleLib"/>
</application>
<webContainer uppressHtmlRecursiveErrorOutput="true"/>
</server>
On the surface this looks like this problem is classloader related. On Windows I suspect you are running this application is isolation whereas on Linux it is running in concert with other things and likely Parent-Last classloading is involved.
I would suggest collecting Liberty classloader trace to see where the affected classes are being loaded from. Here are some instructions for doing that: Liberty Classloader Mustgather
Note: This is assuming that you are running the same version of your application on both Windows and Linux and in both cases your application class extends javax.ws.rs.core.Application. If that is not the case then that is certainly causing the problem.

SOLR 7.4.0 exception: java.lang.NoClassDefFoundError: org/apache/solr/handler/dataimport/FieldStreamDataSource

I am trying to implement a custom SOLR FieldStreamDataSource. This is the code of my Java class:
package MySOLR;
import org.apache.solr.handler.dataimport.*;
public class MyFieldStreamDataSource extends FieldStreamDataSource {
}
My SOLR is installed in C:\solr\solr-7.4.0. So I added the following jar to my NetBeans project
C:\solr\solr-7.4.0\dist\solr-dataimporthandler-7.4.0.jar
and compiled it to MySOLR.jar
Then I placed MySOLR.jar into C:\solr\solr-7.4.0\server\lib\ext and added the following to my SOLR DIH config file:
...
<dataSource name="fieldStreamDataSource" type="MySOLR.MyFieldStreamDataSource" />
...
<entity name="tika_RTF_NOTES" onError="continue" processor="TikaEntityProcessor" dataField="ts0_tika.RTF_NOTES" dataSource="fieldStreamDataSource">
<field name="text" column="text" />
</entity>
...
I added the following entries to my SOLR core's solrconfig.xml file:
<lib dir="C:/solr/solr-7.4.0/contrib/dataimporthandler/lib" regex=".*\.jar" />
<lib dir="C:/solr/solr-7.4.0/dist/" regex="solr-dataimporthandler-\d.*\.jar" />
<!--lib path="C:/solr/solr-7.4.0/dist/solr-dataimporthandler-7.4.0.jar" /-->
<lib dir="C:/solr/solr-7.4.0/contrib/dataimporthandler-extras/lib" regex=".*\.jar" />
<lib dir="C:/solr/solr-7.4.0/dist/" regex="solr-dataimporthandler-extras-\d.*\.jar" />
After re-starting my SOLR instance (Windows service) I try to run the DIH via the SOLR web interface. I get the following exception in the solr.log file (and in the web interface):
2019-03-18 11:08:12.164 ERROR (qtp1986417638-24) [ x:iET] o.a.s.s.HttpSolrCall null:java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/apache/solr/handler/dataimport/FieldStreamDataSource
at org.apache.solr.servlet.HttpSolrCall.sendError(HttpSolrCall.java:662)
at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:530)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:377)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:323)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1634)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
...
I am pretty sure that my entries in solrconfig.xml are correct as when I remove the entries I see that SOLR is picking up less libraries. I can see that in the solr.log file when looking at
o.a.s.c.SolrResourceLoader [...] Added ... libs to classloader, from paths: ...
What am I missing?
Many thanks in advance,
Michael
By chance I found the solution. There are 2 alternatives (for me):
Place MySOLR.jar in c:\solr\solr-7.4.0\contrib\dataimporthandler\lib
Place MySOLR.jar in c:\solr\solr-7.4.0\dist and add a reference to it in solrconfig.xml

vaadin superdevmode can't find custom widget classes

I'm trying to debug a Vaadin custom widgetset using superdevmode. In "normal" mode the custom widget shows up correctly in the browser. When using superdevmode though, it shows the following text instead of the custom widget:
Widgetset xxx does not contain implementation for yyy
Tried all the usual things such as recompile from command line, restart superdevmode server, to no avail.
The weird thing is that the class in the error message (yyy above) is a server side class, used in the client side code only in #Connect(yyy.class), in the client side Connector. Obviously compiled widgetsets do not contain server side classes. So why would it complain about this class?
Also the fact that it works in normal mode makes me wonder what can be wrong. Many similar questions throughout the forums are unanswered. Any help would be appreciated.
Using Vaadin 7.6.6
Contents of widgetset.gwt.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN"
"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd">
<module>
<set-configuration-property name="devModeRedirectEnabled" value="true" />
<add-linker name="xsiframe" />
<inherits name="com.vaadin.DefaultWidgetSet" />
<inherits name="..." />
<source path='client' />
<source path='shared' />
<stylesheet src="resetbuttonfortextfield/styles.css" />
</module>
Solved it eventually by adding -src ${project_loc}/src/main/java to my superdevmode run configuration. Beats me why it wasn't able to figure that for itself.

vaadin 7: Widgetset does not contain implementation of my custom widget

I'm using vaadin 7.5.6 to create a custom GWT widget and use it in my application, but when I run it, my custom component is not shown and I get the message "Widgetset does not contain an implementation for ...".
I know there are several questions related to the same issue but I've already tried all the "solutions" like:
Re-compile the widgetset
Clear all caches from Ivy
Clean the project
Check the annotation #VaadinServletConfiguration, which already contains widgetset = "com.example.myapp.widgetset.MyAppWidgetset")
But nothing works... Any suggestions of what might be the problem?
To create the widget I followed the instructions given in Vaadin's Wiki.
My widgetset looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Uncomment the following to compile the widgetset for one browser only.
Multiple browsers can be specified as a comma separated list. The
supported user agents at the moment of writing were:
ie8,ie9,gecko1_8,safari,opera
The value gecko1_8 is used for Firefox and safari is used for webkit
based browsers including Google Chrome.
-->
<!-- <set-property name="user.agent" value="safari"/> -->
<!--
To enable SuperDevMode, uncomment this line.
See https://vaadin.com/wiki/-/wiki/Main/Using%20SuperDevMode for more
information and instructions.
-->
<!-- <set-configuration-property name="devModeRedirectEnabled" value="true" /> -->
<inherits name="com.lexaden.business.chart.widgetset.OrganisationWidgetset" />
<inherits name="com.vaadin.addon.touchkit.gwt.TouchKitWidgetSet" />
<inherits name="org.vaadin.alump.beforeunload.gwt.BeforeUnloadWidgetSet" />
<inherits name="com.example.fieldcustomcomponents.FieldcustomcomponentsWidgetset" />
Thanks in advance,
Matías

appengine-web.xml - XML error validating

when I try to deploy my App Engine Project, the following Valditation Error is shown:
An internal error occurred during: "Deploying Guestbook to Google".
XML error validating C:\Users\Adrian\workspace\Guestbook\war\WEB-INF\appengine-web.xml against C:\eclipse\plugins\com.google.appengine.eclipse.sdkbundle_1.5.0.r36v201105092302\appengine-java-sdk-1.5.0\docs\appengine-web.xsd
Here is my appengine-web.xml:
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>adrianschaeferandroid</application>
<version>1</version>
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties" />
</system-properties>
<static-files>
<include path="/favicon.ico" />
</static-files>
<static-files>
<include path="stylesheets/main.css" />
</static-files>
</appengine-web-app>
Can anyone see the Validation Error? Shall I post the appengine-web.xsd?
you can only have 1 static-files element. if you have multiple include, you should nest them all within a static-files element.
thus the correct appengine-web.xml should be:
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>adrianschaeferandroid</application>
<version>1</version>
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties" />
</system-properties>
<static-files>
<include path="/favicon.ico" />
<include path="stylesheets/main.css" />
</static-files>
</appengine-web-app>
You will find it a lot easier to not make such errors if you configure your app GAE/Java app using an app.yaml file to generate both the web.xml and appengine-web.xml: https://developers.google.com/appengine/docs/java/configyaml/appconfig_yaml

Categories

Resources