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
Related
I want to generate a MSI package which contains only one feature.
I have a wxi file which is generated automatically. I cannot change this process.
wxi file looks like this:
<?xml version="1.0" encoding="UTF-8" ?>
<Include>
<!-- components -->
<Feature Id="DefaultFeature" Title="Main Feature" Level="1">
<ComponentRef Id="comp0" />
<ComponentRef Id="comp1" />
<ComponentRef Id="comp2" />
<ComponentRef Id="comp3" />
<ComponentRef Id="CleanupMainApplicationFolder" />
</Feature>
</Include>
I have a wxs file which I can change:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product ...>
<!-- components -->
<?include bundle.wxi ?>
<UI/>
<FeatureRef Id="DefaultFeature">
<ComponentRef Id="comp999" />
</FeatureRef>
</Product>
</Wix>
When I compile the wxs to MSI package Light is stating this error:
error LGHT0095 : Multiple primary references were found for Feature 'DefaultFeature' in Product '{...}' and Product '{...}'.
How do I change my wxs file to add a component to the feature defined in wxi file?
Thanks in advance.
Use <ComponentGroup> in your include files instead of <Feature>. Then, define your features in one place, the main .wxs file with <Product> element.
For example, this is how include file might look:
<Fragment>
<Component Id="Comp1" Guid="{GUID-GOES-HERE}">
...
</Component>
<Component Id="Comp2" Guid="{GUID-GOES-HERE}">
...
</Component>
<Component Id="Comp3" Guid="{GUID-GOES-HERE}">
...
</Component>
<ComponentGroup Id="CG1">
<ComponentRef Id="Comp1"/>
<ComponentRef Id="Comp2"/>
<ComponentRef Id="Comp3"/>
</ComponentGroup>
</Fragment>
And the main product.wxs defines the feature, includes the component group in there and allows including more components:
<Feature Id="MainFeature" Title="..." Level="100">
<ComponentGroupRef Id="CG1"/>
<!-- More components can go here -->
<Component Id="..">
</Component>
</Feature>
Moreover, you can include wxs files instead of include, too. As long as the main wxs references at least one element from another wxs, the entire contents will be included.
I tried to create a little Java-web-project, while using Spring MVC Framework.
To build my project, I use ant.
The compiling process seems to work, but unfortunately my controller class( and method) is never been called.
Here are my solution files.
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>HelpMe</display-name>
<servlet>
<servlet-name>mvc</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc</servlet-name>
<url-pattern>/test/</url-pattern>
</servlet-mapping>
</web-app>
mvc-servlet.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="com.please.help.me" />
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
Controller-class:
package com.please.help.me;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
#Controller
public class WelcomeController {
#RequestMapping("/page1")
public String showWelcomePage1() {
System.out.println("show page 1...");
return "page1";
}
#RequestMapping("/page2")
public String showWelcomePage2() {
System.out.println("show page 2...");
return "page2";
}
}
ant-build-file: (build.xml)
<project name="HelpMeProject" default="compile" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<description>
Build file for not working project
</description>
<!-- set global properties for this build -->
<property name="src" location="src" />
<property name="build" location="build" />
<property name="lib" location="lib" />
<property name="classes" location="${build}\WEB-INF\classes" />
<path id="project-classpath">
<fileset dir="${build}\WEB-INF\lib" includes="*.jar" />
<fileset dir="${src}" />
</path>
<target name="compile" description="compile the source" >
<delete dir="${lib}" />
<delete dir="${build}" />
<mkdir dir="${lib}" />
<!-- Do ivy retrieve -->
<ivy:retrieve pattern="${lib}/[type]/[artifact]-[revision].[ext]" />
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
<mkdir dir="${build}\WEB-INF\lib" />
<mkdir dir="${classes}" />
<copy todir="${build}\WEB-INF\lib">
<fileset dir="${lib}\jar" />
<fileset dir="${lib}\bundle" />
</copy>
<copy todir="${build}">
<fileset dir="web" />
</copy>
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${classes}" classpathref="project-classpath" debug="true" />
</target>
</project>
and finally my tomcat deployment descriptor: (helpme.xml)
<?xml version='1.0' encoding='utf-8'?>
<Context crossContext="true" docBase="c:\..myPath..\HelpMe\build\" path="/helpme">
</Context>
After running the compile-ant-script, everything seems fine. Tomcat starts as it should do, but it doesn't matter which URL I call -the controller won't be touched.
This is what I tried:
localhost:8080/
localhost:8080/test
localhost:8080/test/page1
localhost:8080/page1
I looked for similiar topics, but did not find an solution for that problem. Maybe you can help me.
Thanks a lot.
In your case if you have any request mapping as /test/ in controller then
localhost:8080/test/
it will will work.
If you want any url after /test/ needs to be work like :
localhost:8080/test/page1
you need to map it in web.xml as :
/test/*
as I commented.
in url /test/*, the * means any thing after /test/
Change
<url-pattern>/test/</url-pattern>
to
<url-pattern>/</url-pattern>
then localhost:8080/page1 at least should work fine
is this a maven project? If so you can you show us the pom.xml ?
Most people start their webapp with Requestmapping "/"
If you want a quick start to Spring MVC Programming no junk or setup use STS (spring tools suite) although someone gave me a hard time because I like the tool saying it came with a pre-setup tomcat therefore lessening the experience while that is true but eventually you will need to near how to deploy manually to tomcat anyway.
I am using PMD plugin (version 4.0.2) for Eclipse (Eclipse Kepler Java EE). I have configured a naming rule: ShortVariable.
This works fine except for parameters like "id" and "e". I want PMD to ignore these. So I searched for a way to ignore certain parameters. I found this link (although it's for phpmd) and tried it, yet I can't seem to get it working. My config file looks like this (XML):
<?xml version="1.0"?>
<ruleset name="My PMD ruleset"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>
My PMD
</description>
<rule ref="rulesets/java/naming.xml/ShortVariable">
<property name="exceptions" value="id" />
</rule>
</ruleset>
When I try to import this ruleset using the eclipse plugin, it shows no possible rules to import.
Any ideas?
I found a solution to my problem here.
The resulting xml looks like this:
<?xml version="1.0"?>
<ruleset name="My PMD ruleset"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>
My PMD
</description>
<rule ref="rulesets/java/naming.xml/ShortVariable">
<properties>
<property name="xpath">
<value>
//VariableDeclaratorId[(string-length(#Image) < 3) and (not (#Image='id'))]
[not(ancestor::ForInit)]
[not((ancestor::FormalParameter) and (ancestor::TryStatement))]
</value>
</property>
</properties>
</rule>
</ruleset>
To be able to ignore more variable names, repeat the following part:
and (not (#Image='myVariableToIgnore'))
The folowing XML is valid for PHP tool PHPMD 2.2.3
<?xml version="1.0"?>
<!DOCTYPE ruleset>
<ruleset
name="My PMD ruleset for symfony 2.5"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd"
>
<rule ref="rulesets/unusedcode.xml" />
<rule ref="rulesets/codesize.xml" />
<rule ref="rulesets/cleancode.xml" />
<rule ref="rulesets/controversial.xml" />
<rule ref="rulesets/design.xml" />
<rule ref="rulesets/naming.xml">
<exclude name="ShortVariable" />
</rule>
<rule ref="rulesets/naming.xml/ShortVariable">
<properties>
<property name="exceptions" value="id,em" />
</properties>
</rule>
</ruleset>
Update xml
<rule ref="category/java/codestyle.xml/ShortVariable">
<properties>
<property name="xpath">
<value>
//VariableDeclaratorId[(string-length(#Image) < 3) and (not (#Name='id'))]
[not(ancestor::ForInit)]
[not((ancestor::FormalParameter) and (ancestor::TryStatement))]
</value>
</property>
</properties>
</rule>
I am an Ivy newbie and I need some help resolving an error. When I try to build my project using netbeans it gives me following error :
confs: [compile, runtime, compile-test, runtime-test]
C:\Users\Tejas\Documents\NetBeansProjects\LaitsV3\Laitsv3second\nbproject\ivy-impl.xml:92: impossible to resolve dependencies:
java.io.FileNotFoundException: C:\Users\Tejas\.netbeans\7.1.1\modules\ext\ivy-2.1.0.jar\cache\resolved-Laitsv3second-Laitsv3second-1.0.xml (The system cannot find the path specified)
where as this Laitsv3second-Laitsv3second-1.0 is being picked up by ivy from ivy.xml file's info tag as follows :
<ivy-module version="2.0">
<info organisation="Laitsv3second" module="Laitsv3second" revision="1.0" />
Can anybody help me identifying this problem? or any pointer for help?
I resolved this error by adding following to the ivysetting
<property name="ivy.default.ivy.user.dir" value="${user.home}/.ivy2" />
<caches resolutionCacheDir="${user.home}/.ivy2/cache" defaultCacheDir="${user.home}/.ivy2/cache"/>
this way it tries to find the cache in the specified directory. Otherwise it tries to find the cache in the ivy.jar file. This may sound stupid but it is what happens.
This is the same problem as reported on ivvybeans forum but it is unresolved yet. https://code.google.com/p/ivybeans/issues/detail?id=103
It works for me too, here is my ivysetting looks like:
<ivysettings>
<settings defaultResolver="main" >
<property name="ivy.default.ivy.user.dir" value="${user.home}/.ivy2" />
<caches resolutionCacheDir="${user.home}/.ivy2/cache" defaultCacheDir="${user.home}/.ivy2/cache"/>
</settings>
<resolvers>
<chain name="main">
<url name="repo" m2compatible="true">
<artifact pattern="http://reposserver/artifactory/repo/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]" />
<ivy pattern="http://reposerver/artifactory/repo/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).pom" />
</url>
<ibiblio name="compass" m2compatible="true" root="http://repo.compass-project.org"></ibiblio>
<ibiblio name="ibiblio" m2compatible="true"></ibiblio>
</chain>
</resolvers>
</ivysettings>
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).