I am trying to support UTF-8 characters in my ANT script.
As long as the character string are made up of 2-byte UTF-8 characters, such as:
Lògìñ
Ùsèr ÌÐ
Then things work fine.
When I use Unicode Han Character:
我
Which, according to this site:
http://www.fileformat.info/info/unicode/char/6211/index.htm
Has a UTF-8 encoding of 0xE6 0x88 0x91
I can see in UltraEdit, my input properties file has the values "E6 88 91" all in a row, so I'm fairly confident that my input is correct. And When I open the same file in Notepad++ I can see all the characters correctly.
Here is my Build Script:
<?xml version="1.0" encoding="UTF-8" ?>
<project
name="utf8test"
default="all"
basedir=".">
<target name="all">
<loadproperties encoding="UTF-8" srcfile="./apps.properties.all.txt" />
<echo>No encoding ${common.app.name}</echo>
<echo encoding="UTF-8">UTF-8 ${common.app.name}</echo>
<echo encoding="UnicodeLittle">UnicodeLittle ${common.app.name}</echo>
<echo encoding="UnicodeLittleUnmarked">UnicodeLittleUnmarked ${common.app.name}</echo>
<echo>${common.app.ServerName}</echo>
<echo>${bb.vendor}</echo>
<echo>No encoding ${common.app.UserIdText}</echo>
<echo encoding="UTF-8">UTF-8 ${common.app.UserIdText}</echo>
<echo encoding="UnicodeLittle">UnicodeLittle ${common.app.UserIdText}</echo>
<echo encoding="UnicodeLittleUnmarked">UnicodeLittleUnmarked ${common.app.UserIdText}</echo>
<echoproperties />
</target>
</project>
And here is my properties file:
common.app=VrvPsLTst
common.app.name=我們
common.app.description=Pseudo Loc Test App for Build Script testing
common.app.ServerName=http://Vèrìvò.com
bb.vendor=Vèrìvò
common.app.PasswordText=Pàsswòrð
bb.override.list=MP_COPYRIGHTTEXT, "Çòpÿrìght 2012 Vèrívó Bùîlð TéàM"
common.app.LoginButtonText=Lògìñ
common.app.UserIdText=Ùsèr ÌÐ
bb.SMSSuccess=Mèssàgéß Sùççêssfúllÿ Sëñt
common.app.LoginScreenMessage=WèlçòMé Mêssàgë
common.app.LoginProgressMessage=Àùthèñtìçàtíòñ îñ prógréss...
ios.RegistrationText=Règìstràtíòñ Téxt
ios.RegistrationURL=http://www.josscrowcroft.com/2011/code/utf-8-multibyte-characters-in-url-parameters-%E2%9C%93/
Here is what the output looks like:
Buildfile: C:\Temp\utf8\build.xml
all:
[echo] No encoding ??
[echo] UTF-8 ??
[echo] ÿþU n i c o d e L i t t l e ? ?
[echo] U n i c o d e L i t t l e U n m a r k e d ? ?
[echo] http://Vèrìvò.com
[echo] Vèrìvò
[echo] No encoding Ùsèr ÌÐ
[echo] UTF-8 Ùsèr Ì�
[echo] ÿþU n i c o d e L i t t l e Ù s è r Ì Ð
[echo] U n i c o d e L i t t l e U n m a r k e d Ù s è r Ì Ð
[echoproperties] #Ant properties
[echoproperties] #Mon Jun 18 15:25:13 EDT 2012
[echoproperties] ant.core.lib=C\:\\ant\\lib\\ant.jar
[echoproperties] ant.file=C\:\\Temp\\utf8\\build.xml
[echoproperties] ant.file.type=file
[echoproperties] ant.file.type.utf8test=file
[echoproperties] ant.file.utf8test=C\:\\Temp\\utf8\\build.xml
[echoproperties] ant.home=c\:\\ant\\bin\\..
[echoproperties] ant.java.version=1.6
[echoproperties] ant.library.dir=C\:\\ant\\lib
[echoproperties] ant.project.default-target=all
[echoproperties] ant.project.invoked-targets=all
[echoproperties] ant.project.name=utf8test
[echoproperties] ant.version=Apache Ant version 1.8.1 compiled on April 30 2010
[echoproperties] awt.toolkit=sun.awt.windows.WToolkit
[echoproperties] basedir=C\:\\Temp\\utf8
[echoproperties] bb.SMSSuccess=M\u00E8ss\u00E0g\u00E9\u00DF S\u00F9\u00E7\u00E7\u00EAssf\u00FAll\u00FF S\u00EB\u00F1t
[echoproperties] bb.override.list=MP_COPYRIGHTTEXT, "\u00C7\u00F2p\u00FFr\u00ECght 2012 V\u00E8r\u00EDv\u00F3 B\u00F9\u00EEl\u00F0 T\u00E9\u00E0?"
[echoproperties] bb.vendor=V\u00E8r\u00ECv\u00F2
[echoproperties] common.app=VrvPsLTst
[echoproperties] common.app.LoginButtonText=L\u00F2g\u00EC\u00F1
[echoproperties] common.app.LoginProgressMessage=\u00C0\u00F9th\u00E8\u00F1t\u00EC\u00E7\u00E0t\u00ED\u00F2\u00F1 \u00EE\u00F1 pr\u00F3gr\u00E9ss...
[echoproperties] common.app.LoginScreenMessage=W\u00E8l\u00E7\u00F2?\u00E9 M\u00EAss\u00E0g\u00EB
[echoproperties] common.app.PasswordText=P\u00E0ssw\u00F2r\u00F0
[echoproperties] common.app.ServerName=http\://V\u00E8r\u00ECv\u00F2.com
[echoproperties] common.app.UserIdText=\u00D9s\u00E8r \u00CC\u00D0
[echoproperties] common.app.description=Pseudo Loc Test App for Build Script testing
[echoproperties] common.app.name=??
[echoproperties] file.encoding=Cp1252
[echoproperties] file.encoding.pkg=sun.io
[echoproperties] file.separator=\\
[echoproperties] ios.RegistrationText=R\u00E8g\u00ECstr\u00E0t\u00ED\u00F2\u00F1 T\u00E9xt
[echoproperties] ios.RegistrationURL=http\://www.josscrowcroft.com/2011/code/utf-8-multibyte-characters-in-url-parameters-%E2%9C%93/
[echoproperties] java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
[echoproperties] java.awt.printerjob=sun.awt.windows.WPrinterJob
[echoproperties] java.class.path=c\:\\ant\\bin\\..\\lib\\ant-launcher.jar;C\:\\Temp\\utf8\\.\\;C\:\\Program Files (x86)\\Java\\jre7\\lib\\ext\\QTJava.zip;C\:\\ant\\lib\\ant-antlr.jar;C\:\\ant\\lib\\ant-apache-bcel.jar;C\:\\ant\\lib\\ant-apache-bsf.jar;C\:\\ant\\lib\\ant-apache-log4j.jar;C\:\\ant\\lib\\ant-apache-oro.jar;C\:\\ant\\lib\\ant-apache-regexp.jar;C\:\\ant\\lib\\ant-apache-resolver.jar;C\:\\ant\\lib\\ant-apache-xalan2.jar;C\:\\ant\\lib\\ant-commons-logging.jar;C\:\\ant\\lib\\ant-commons-net.jar;C\:\\ant\\lib\\ant-contrib-1.0b3.jar;C\:\\ant\\lib\\ant-jai.jar;C\:\\ant\\lib\\ant-javamail.jar;C\:\\ant\\lib\\ant-jdepend.jar;C\:\\ant\\lib\\ant-jmf.jar;C\:\\ant\\lib\\ant-jsch.jar;C\:\\ant\\lib\\ant-junit.jar;C\:\\ant\\lib\\ant-launcher.jar;C\:\\ant\\lib\\ant-netrexx.jar;C\:\\ant\\lib\\ant-nodeps.jar;C\:\\ant\\lib\\ant-starteam.jar;C\:\\ant\\lib\\ant-stylebook.jar;C\:\\ant\\lib\\ant-swing.jar;C\:\\ant\\lib\\ant-testutil.jar;C\:\\ant\\lib\\ant-trax.jar;C\:\\ant\\lib\\ant-weblogic.jar;C\:\\ant\\lib\\ant.jar;C\:\\ant\\lib\\bb-ant-tools.jar;C\:\\ant\\lib\\xercesImpl.jar;C\:\\ant\\lib\\xml-apis.jar;C\:\\Program Files\\Java\\jre7\\lib\\tools.jar
[echoproperties] java.class.version=51.0
[echoproperties] java.endorsed.dirs=C\:\\Program Files\\Java\\jre7\\lib\\endorsed
[echoproperties] java.ext.dirs=C\:\\Program Files\\Java\\jre7\\lib\\ext;C\:\\Windows\\Sun\\Java\\lib\\ext
[echoproperties] java.home=C\:\\Program Files\\Java\\jre7
[echoproperties] java.io.tmpdir=C\:\\Users\\efelton\\AppData\\Local\\Temp\\
[echoproperties] java.library.path=C\:\\Windows\\SYSTEM32;C\:\\Windows\\Sun\\Java\\bin;C\:\\Windows\\system32;C\:\\Windows;C\:\\Windows\\SYSTEM32;C\:\\Windows;C\:\\Windows\\SYSTEM32\\WBEM;C\:\\Windows\\SYSTEM32\\WINDOWSPOWERSHELL\\V1.0\\;C\:\\PROGRAM FILES\\INTEL\\WIFI\\BIN\\;C\:\\PROGRAM FILES\\COMMON FILES\\INTEL\\WIRELESSCOMMON\\;C\:\\PROGRAM FILES (X86)\\MICROSOFT SQL SERVER\\100\\TOOLS\\BINN\\;C\:\\PROGRAM FILES\\MICROSOFT SQL SERVER\\100\\TOOLS\\BINN\\;C\:\\PROGRAM FILES\\MICROSOFT SQL SERVER\\100\\DTS\\BINN\\;C\:\\PROGRAM FILES (X86)\\MICROSOFT SQL SERVER\\100\\TOOLS\\BINN\\VSSHELL\\COMMON7\\IDE\\;C\:\\PROGRAM FILES (X86)\\MICROSOFT SQL SERVER\\100\\DTS\\BINN\\;C\:\\Program Files\\ThinkPad\\Bluetooth Software\\;C\:\\Program Files\\ThinkPad\\Bluetooth Software\\syswow64;C\:\\Program Files (x86)\\QuickTime\\QTSystem\\;C\:\\Program Files (x86)\\AccuRev\\bin;C\:\\Program Files\\Java\\jdk1.7.0_04\\bin;C\:\\Program Files (x86)\\IDM Computer Solutions\\UltraEdit\\;.
[echoproperties] java.runtime.name=Java(TM) SE Runtime Environment
[echoproperties] java.runtime.version=1.7.0_04-b22
[echoproperties] java.specification.name=Java Platform API Specification
[echoproperties] java.specification.vendor=Oracle Corporation
[echoproperties] java.specification.version=1.7
[echoproperties] java.vendor=Oracle Corporation
[echoproperties] java.vendor.url=http\://java.oracle.com/
[echoproperties] java.vendor.url.bug=http\://bugreport.sun.com/bugreport/
[echoproperties] java.version=1.7.0_04
[echoproperties] java.vm.info=mixed mode
[echoproperties] java.vm.name=Java HotSpot(TM) 64-Bit Server VM
[echoproperties] java.vm.specification.name=Java Virtual Machine Specification
[echoproperties] java.vm.specification.vendor=Oracle Corporation
[echoproperties] java.vm.specification.version=1.7
[echoproperties] java.vm.vendor=Oracle Corporation
[echoproperties] java.vm.version=23.0-b21
[echoproperties] line.separator=\r\n
[echoproperties] os.arch=amd64
[echoproperties] os.name=Windows 7
[echoproperties] os.version=6.1
[echoproperties] path.separator=;
[echoproperties] sun.arch.data.model=64
[echoproperties] sun.boot.class.path=C\:\\Program Files\\Java\\jre7\\lib\\resources.jar;C\:\\Program Files\\Java\\jre7\\lib\\rt.jar;C\:\\Program Files\\Java\\jre7\\lib\\sunrsasign.jar;C\:\\Program Files\\Java\\jre7\\lib\\jsse.jar;C\:\\Program Files\\Java\\jre7\\lib\\jce.jar;C\:\\Program Files\\Java\\jre7\\lib\\charsets.jar;C\:\\Program Files\\Java\\jre7\\lib\\jfr.jar;C\:\\Program Files\\Java\\jre7\\classes
[echoproperties] sun.boot.library.path=C\:\\Program Files\\Java\\jre7\\bin
[echoproperties] sun.cpu.endian=little
[echoproperties] sun.cpu.isalist=amd64
[echoproperties] sun.desktop=windows
[echoproperties] sun.io.unicode.encoding=UnicodeLittle
[echoproperties] sun.java.command=org.apache.tools.ant.launch.Launcher -cp .;C\:\\Program Files (x86)\\Java\\jre7\\lib\\ext\\QTJava.zip
[echoproperties] sun.java.launcher=SUN_STANDARD
[echoproperties] sun.jnu.encoding=Cp1252
[echoproperties] sun.management.compiler=HotSpot 64-Bit Tiered Compilers
[echoproperties] sun.os.patch.level=Service Pack 1
[echoproperties] user.country=US
[echoproperties] user.dir=C\:\\Temp\\utf8
[echoproperties] user.home=C\:\\Users\\efelton
[echoproperties] user.language=en
[echoproperties] user.name=efelton
[echoproperties] user.script=
[echoproperties] user.timezone=
[echoproperties] user.variant=
BUILD SUCCESSFUL
Total time: 1 second
Thank you for your help
EDIT\UPDATE 6/19/2012
I am developing in a Windows environment.
I have installed a TTF from:
http://freedesktop.org/wiki/Software/CJKUnifonts/Download
I have updated UltraEdit to use the TTF and I can see the Chinese characters.
<?xml version="1.0" encoding="UTF-8" ?>
<project name="utf8test" default="all" basedir=".">
<target name="all">
<echo>我們</echo>
<echo encoding="ISO-8859-1">ISO-8859-1 我們</echo>
<echo encoding="UTF-8">UTF-8 我們</echo>
<echo file="echo_output.txt" append="true" >我們 ${line.separator}</echo>
<echo file="echo_output.txt" append="true" encoding="ISO-8859-1">ISO-8859-1 我們 ${line.separator}</echo>
<echo file="echo_output.txt" append="true" encoding="UTF-8">UTF-8 我們 ${line.separator}</echo>
<echo file="echo_output.txt" append="true" encoding="UnicodeLittle">UnicodeLittle 我們 ${line.separator}</echo>
<echo file="echo_output.txt" append="true" encoding="UnicodeLittleUnmarked">UnicodeLittleUnmarked 我們 ${line.separator}</echo>
</target>
</project>
The output captured by running inside UltraEdit is:
Buildfile: E:\temp\utf8\build.xml
all:
[echo] ??
[echo] ISO-8859-1 ??
[echo] UTF-8 ??
BUILD SUCCESSFUL
Total time: 1 second
And the echo_output.txt file shows up like this:
??
ISO-8859-1 ??
UTF-8 ??
ÿþU n i c o d e L i t t l e ? ?
U n i c o d e L i t t l e U n m a r k e d ? ?
So there appears to be somehting fundamentally wrong with how my ANT environment is set up since I cannot simply echo the character to the screen or to a file.
The java.util.Properites class uses the ISO 8859-1 encoding. The following worked when tested with Ant 1.8.2.
build.xml
<?xml version="1.0" encoding="UTF-8" ?>
<project name="utf8test" default="all" basedir=".">
<target name="all">
<loadproperties encoding="ISO-8859-1" srcfile="./apps.properties.all.txt" />
<echo>No encoding ${common.app.name}</echo>
<echo encoding="ISO-8859-1">ISO-8859-1 ${common.app.name}</echo>
</target>
</project>
Output
all:
[echo] No encoding æå
[echo] ISO-8859-1 我們
BUILD SUCCESSFUL
I solved my problem on Windows and MacOS by passing all input (properties files) through this encoder first. ANT can then correctly read, and then write, the values when the input is escaped in this manner.
StringBuffer buffer = new StringBuffer();
try
{
FileInputStream fis = new FileInputStream(input);
InputStreamReader isr = new InputStreamReader(fis, "UTF8");
Reader in = new BufferedReader(isr);
int ch;
while ((ch = in.read()) > -1)
{
if (ch > 127 || ch < 0)
{
String hex = Integer.toHexString(ch);
switch (hex.length())
{
case 1:
buffer.append("\\u000");
break;
case 2:
buffer.append("\\u00");
break;
case 3:
buffer.append("\\u0");
break;
case 4:
default:
buffer.append("\\u");
break;
}
buffer.append(hex);
}
else if (ch != 0)
{
buffer.append((char) ch);
}
}//while
in.close();
//System.out.println(buffer.toString());
}//try
catch (IOException e)
{
//e.printStackTrace();
throw new BuildException(e.getMessage() );
}
try
{
FileOutputStream fos = new FileOutputStream(dest);
Writer out = new OutputStreamWriter(fos, "windows-1252");
out.write(buffer.toString());
out.close();
}
catch (IOException e)
{
throw new BuildException(e.getMessage() );
}
Related
I'm using the below property to generate JaCoCo XML report
<property name="sonar.coverage.jacoco.xmlReportPaths" value="${basedir}/sonar-task/reports/jacoco.xml" />
When I invoke this ANT Task from Jenkins, I'm seeing the below exception in Jenkins logs and so I don't see the Code Coverage value in SonarQube
15:09:49 [sonar:sonar] Apache Ant(TM) version 1.10.7 compiled on September 1 2019
15:09:49 [sonar:sonar] SonarQube Ant Task version: 2.6.0.1426
.
.
.
15:14:55 [sonar:sonar] Sensor JavaSquidSensor [java] (done) | time=262215ms
15:14:55 [sonar:sonar] Sensor JaCoCo XML Report Importer [jacoco]
15:14:55 [sonar:sonar] Coverage report 'C:\Softwares\Jenkins\workspace\MYA_DevOps_PIPELINE\.\sonar-task\reports\jacoco.xml' could not be read/imported. Error: {}
15:14:55 [sonar:sonar] java.lang.IllegalStateException: Failed to parse JaCoCo XML report: C:\Softwares\Jenkins\workspace\MYA_DevOps_PIPELINE\.\sonar-task\reports\jacoco.xml
15:14:55 [sonar:sonar] at org.sonar.plugins.jacoco.XmlReportParser.parse(XmlReportParser.java:96)
I can see the HTML reports and I can see the jacoco.xml file is getting generated as well. But the content inside this file is not XML.
Just add the below line while you generate an XML JaCoCo report
<xml destfile="${sonar.coverage.jacoco.xmlReportPaths}"/>
I use maven-assembly-plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
</configuration>
</plugin>
assembly file:
<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<id>rules</id>
<formats>
<format>jar</format>
</formats>
<baseDirectory>xxx-xxx-xxxFramework-rules</baseDirectory>
<fileSets>
<fileSet>
<outputDirectory></outputDirectory>
<directory>${basedir}</directory>
<excludes>
<exclude>target</exclude>
</excludes>
</fileSet>
</fileSets>
</assembly>
I have at root directory a folder named règle. I use mvn clean deploy. On my Windows 10 device, I have restult OK with règle folder in my jar file final but if I build on my Jenkins Unix Docker, I have a success build but without my folder named règle in my jar file final.
EDIT logs in Jenkins Docker:
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T18:29:23+01:00)
Maven home: /usr/local/share/maven
Java version: 1.8.0_191, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "3.10.0-1127.el7.x86_64", arch: "amd64", family: "unix"
EDIT 2 (add -X on Maven command):
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-assembly-plugin:2.6:single' with basic configurator -->
[DEBUG] (s) appendAssemblyId = true
[DEBUG] (f) attach = true
[DEBUG] (s) basedir = /home/jenkins/workspace/xxx_Common_xxxGenerate/xxx-xxx-xxxframework/xxx-xxx-xxxFramework-xxx
[DEBUG] (s) descriptor = assembly.xml
[DEBUG] (f) dryRun = false
[DEBUG] (f) encoding = Cp1252
EDIT 3:
[DEBUG] (f) encoding = UTF-8
[DEBUG] All known ContainerDescriptorHandler components: [file-aggregator, metaInf-spring, plexus, metaInf-services]
[DEBUG] FileSet[] dir perms: -1 file perms: -1
[DEBUG] The archive base directory is 'null'
[DEBUG] NOT reformatting any files in /home/jenkins/workspace/xxx_Common_xxxGenerate/xxx-xxx-xxxframework/xxx-xxx-xxxFramework-rules/.
[DEBUG] Adding file-set in: /home/jenkins/workspace/xxx_Common_xxxGenerate/xxx-xxx-xxxframework/xxx-xxx-xxxFramework-rules/. to archive location: xxx-xxx-xxxFramework-rules/
[DEBUG] adding directory xxx-xxx-xxxFramework-rules/
[DEBUG] adding directory xxx-xxx-xxxFramework-rules/.settings/
[DEBUG] adding directory xxx-xxx-xxxFramework-rules/bom/
[DEBUG] adding directory xxx-xxx-xxxFramework-rules/ressources/
[DEBUG] adding directory xxx-xxx-xxxFramework-rules/ressources/xom-libraries/
[DEBUG] adding directory xxx-xxx-xxxFramework-rules/target/
[DEBUG] adding directory xxx-xxx-xxxFramework-rules/target/archive-tmp/
EDIT 4:
I try add this but do not work:
<fileMode>0755</fileMode>
<directoryMode>0755</directoryMode>
EDIT 5:
I add this:
withMaven(globalMavenSettingsConfig: 'empty-global-settings', mavenSettingsConfig: Constants.CONFIG_SETTINGS_ID) {
sh "pwd"
sh "ls -lrt"
sh "ls -lrt /home/jenkins/workspace/xxx_Common_xxxGenerate/xxx-xxx-commonutility/xxx-xxx-CommonUtility-rules"
sh "ls -lrt /home/jenkins/workspace/xxx_Common_xxxGenerate/xxx-xxx-commonutility/xxx-xxx-CommonUtility-rules/règles"
sh "$MVN_CMD deploy -X"
}
and my result is:
+ ls -lrt /home/jenkins/workspace/xxx_Common_xxxGenerate/xxx-xxx-commonutility/xxx-xxx-CommonUtility-rules
total 8
drwxr-xr-x. 2 jenkins root 125 Jul 15 21:32 bom
-rw-r--r--. 1 jenkins root 657 Jul 15 21:32 assembly.xml
drwxr-xr-x. 3 jenkins root 27 Jul 15 21:32 ressources
-rw-r--r--. 1 jenkins root 1492 Jul 15 21:32 pom.xml
drwxr-xr-x. 2 jenkins root 57 Jul 15 21:32 data
drwxr-xr-x. 3 jenkins root 23 Jul 15 21:32 règles
drwxr-xr-x. 3 jenkins root 82 Jul 15 21:32 target
[Pipeline] sh
+ ls -lrt $'/home/jenkins/workspace/xxx_Common_xxxGenerate/xxx-xxx-commonutility/xxx-xxx-CommonUtility-rules/r\303\250gles'
total 0
I convert my comment to an answer:
The problem seems to be the strange encoding of the Docker image:
platform encoding: ANSI_X3.4-1968
I'm creating an ant script to do some integration testing for a small project. The application in question is a web application packaged as a WAR. Currently, my ant script generates a WAR file, launches Jetty with the packaged WAR file, and then runs my Selenium based unit tests against the server application. Everything is working so far.
My problem is that the Jetty ant plugin generates a huge amount of logging output to the terminal. I'd really like to change the logging level for Jetty, but I can't figure out how. I've tried changing jetty logging system properties in two different ways, and neither worked. First by including <systemproperty> elements in the ant file, and second by setting them using ant_opts (That is, I've set ANT_OPTS="-Dorg.eclipse.jetty.LEVEL=WARN -Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StrErrLog")
I'm running the server in daemon mode so that it will run alongside my testing targets. So, although I was able to turn off logging in the jetty.run target itself, that also turned off logging in the test target, and if I turned it back on in the test target, then all jetty output during the test is still written to the terminal. Also, all Jetty output during the test target is labelled as [junit], since it's being output during the test target.
I want to lower the logging level for Jetty to WARN (which really ought to be the default for the plugin) and I cannot figure out how. I've included the relevant parts of the build script.
<target name="jetty.run" depends="build-and-package">
<typedef name="webApp" classname="org.eclipse.jetty.ant.AntWebAppContext" classpathref="classpath" loaderref="jetty.loader" onerror="ignore" />
<taskdef classpathref="classpath" resource="tasks.properties" loaderref="jetty.loader" />
<jetty.run daemon="true">
<systemProperties>
<systemProperty name="org.eclipse.jetty.LEVEL" value="WARN" />
<systemProperty name="org.eclipse.jetty.util.log.class" value="org.eclipse.jetty.util.log.StrErrLog" />
</systemProperties>
<webApp war="${artifacts}/${warfilename}" contextPath="/" />
</jetty.run>
</target>
<target name="test" depends="compile-tests, jetty.run">
<mkdir dir="${junit.output.dir}" />
<junit fork="yes" printsummary="withOutAndErr" haltonfailure="yes" haltonerror="yes">
<formatter type="xml" />
<batchtest todir="${junit.output.dir}">
<fileset dir="${compiled-tests.dir}">
<include name="**/*Test*" />
</fileset>
</batchtest>
<classpath refid="classpath" />
<classpath path="${compiled-classes.dir}" />
<classpath path="${compiled-tests.dir}" />
</junit>
</target>
Edit Here is some (very trimmed) sample output starting from the jetty.run task. I am trying to eliminate all or most of the non-junit output
jetty.run:
[jetty.run] Daemon=true
[jetty.run] 2015-02-02 14:47:47.671:INFO::main: Logging initialized #2789ms
[jetty.run] Configuring Jetty for project: Build script for Vaadin 7 projects
[jetty.run] Setting property 'org.eclipse.jetty.LEVEL' to value 'WARN'
[jetty.run] Setting property 'org.eclipse.jetty.util.log.class' to value 'org.eclipse.jetty.util.log.StrErrLog'
[jetty.run] 2015-02-02 14:47:47.757:INFO:oejs.Server:main: jetty-9.2.7.v20150116
[jetty.run] 2015-02-02 14:47:47.769: Starting web application null
[jetty.run] 2015-02-02 14:47:48.759:INFO:oejw.StandardDescriptorProcessor:main: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
[jetty.run] 2015-02-02 14:47:48.794:INFO:oejsh.ContextHandler:main: Started o.e.j.a.AntWebAppContext#cad498c{/,file:/tmp/jetty-0.0.0.0-8080-card_trainer.war-_-any-2642472331853673434.dir/webapp/,AVAILABLE}{build/card_trainer.war}
[jetty.run] 2015-02-02 14:47:48.795:WARN:oejsh.RequestLogHandler:main: !RequestLog
[jetty.run] 2015-02-02 14:47:48.807:INFO:oejs.ServerConnector:main: Started ServerConnector#6c5a7edc{HTTP/1.1}{0.0.0.0:8080}
[jetty.run] 2015-02-02 14:47:48.808:INFO:oejs.Server:main: Started #3929ms
[jetty.run] Jetty AntTask Started
test:
[junit] WARNING: multiple versions of ant detected in path for junit
[junit] jar:file:/usr/share/ant/lib/ant.jar!/org/apache/tools/ant/Project.class
[junit] and jar:file:/home/dyule/git/card_trainer/ivy_libs/nodeploy/ant.jar!/org/apache/tools/ant/Project.class
[junit] Running com.example.card_trainer.CardSourceTest
[junit] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.126 sec
[junit] Running com.example.card_trainer.Card_trainerTest
[junit] Feb 02, 2015 2:47:51 PM
[junit] Feb 02, 2015 2:47:51 PM org.atmosphere.cpr.AtmosphereFramework addAtmosphereHandler
[junit] INFO: Installed AtmosphereHandler com.vaadin.server.communication.PushHandler$1 mapped to context-path: /*
[junit] Feb 02, 2015 2:47:51 PM org.atmosphere.cpr.AtmosphereFramework addAtmosphereHandler
[junit] INFO: Installed the following AtmosphereInterceptor mapped to AtmosphereHandler com.vaadin.server.communication.PushHandler$1
[junit] Feb 02, 2015 2:47:51 PM org.atmosphere.cpr.AtmosphereFramework doInitParams
[junit] WARNING: SessionSupport error. Make sure you define org.atmosphere.cpr.SessionSupport as a listener in web.xml instead
[junit] Feb 02, 2015 2:47:51 PM org.atmosphere.cpr.AtmosphereFramework autoConfigureService
[junit] INFO: Atmosphere is using org.atmosphere.cpr.DefaultAnnotationProcessor for processing annotation
[junit] Feb 02, 2015 2:47:51 PM org.atmosphere.cpr.DefaultAnnotationProcessor configure
[junit] INFO: AnnotationProcessor class org.atmosphere.cpr.DefaultAnnotationProcessor$ServletContainerInitializerAnnotationProcessor being used
[junit] Feb 02, 2015 2:47:51 PM org.atmosphere.cpr.DefaultAnnotationProcessor fallbackToManualAnnotatedClasses
[junit] WARNING: Unable to detect annotations. Application may fail to deploy.
[junit] Feb 02, 2015 2:47:51 PM org.atmosphere.cpr.AtmosphereFramework autoDetectWebSocketHandler
[junit] INFO: Auto detecting WebSocketHandler in /WEB-INF/classes/
[junit] Feb 02, 2015 2:47:51 PM org.atmosphere.cpr.AtmosphereFramework initWebSocket
[junit] INFO: Installed WebSocketProtocol org.atmosphere.websocket.protocol.SimpleHttpProtocol
From ant script - Its true that you are using Default Logging for Jetty
StdErrLog.
Of course, this will throws all the logging to Terminal (STDOUT, STDERR)
You can capture its content to a file -
Capturing Console Output to File
logging module in Jetty distribution that is capable of performing simple capturing of all STDOUT and STDERR output to a file.
add "--module=logging" to $JETTY_HOME/start.ini file
For More info: Default Logging with Jetty's StdErrLog
Configuring StdErrLog
The recommended way to configure StdErrLog is to create a ${jetty.home}/resources/jetty-logging.properties file, specify the Log implementation to StdErrLog and then setup your logging levels.
-Hope this may be helpful
I was finally able to create a server instance within my java app that uses the embedded database as explained here. This works properly while I'm running it from Eclipse, but this is not actually my purpose (my app, between other things, feeds the database with new nodes and relationships). I have a Neo4j box which is supposed to be my server instance and I want to deploy my app there as a JAR file. In that way, I would like to access the web interface from there. I have already tested it: while running the java app in my development machine any machine in the same private network can access the interface without problems. The issue comes when trying to package everything into a JAR for server distribution.
The concrete error stack is as follows:
<!-- bean initialization stuff -->
Apr 11, 2013 1:14:30 PM org.neo4j.kernel.impl.transaction.xaframework.XaLogicalLog doInternalRecovery
INFO: Non clean shutdown detected on log [/data/production/graph.db/nioneo_logical.log.2]. Recovery started ...
Apr 11, 2013 1:14:32 PM org.neo4j.kernel.impl.transaction.xaframework.XaLogicalLog doInternalRecovery
INFO: Non clean shutdown detected on log [/data/production/graph.db/index/lucene.log.2]. Recovery started ...
2013-04-11 13:14:34,787 INFO [org.springframework.transaction.jta.JtaTransactionManager] - Using JTA UserTransaction: org.neo4j.kernel.impl.transaction.UserTransactionImpl#1b2fde11
2013-04-11 13:14:34,787 INFO [org.springframework.transaction.jta.JtaTransactionManager] - Using JTA TransactionManager: org.neo4j.kernel.impl.transaction.SpringTransactionManager#639c3c08
Apr 11, 2013 1:14:35 PM org.neo4j.server.logging.Logger log
INFO: Starting Neo Server on port [7474] with [40] threads available
Logger not configured, logging to std out instead: [FINE] Adding JAXRS packages [org.neo4j.server.rest.discovery] at [/]
Apr 11, 2013 1:14:35 PM org.neo4j.server.logging.Logger log
INFO: Mounted discovery module at [/]
Logger not configured, logging to std out instead: [FINE] Adding JAXRS packages [org.neo4j.server.rest.web] at [/db/data]
Apr 11, 2013 1:14:35 PM org.neo4j.server.logging.Logger log
INFO: Mounted REST API at [/db/data]
Logger not configured, logging to std out instead: [FINE] Adding JAXRS packages [org.neo4j.server.webadmin.rest] at [/db/manage]
Apr 11, 2013 1:14:35 PM org.neo4j.server.logging.Logger log
INFO: Mounted management API at [/db/manage]
Apr 11, 2013 1:14:35 PM org.neo4j.server.logging.Logger log
INFO: Mounted webadmin at [/webadmin]
2013-04-11 13:14:35,494 INFO [org.mortbay.log] - Logging to org.slf4j.impl.Log4jLoggerAdapter(org.mortbay.log) via org.mortbay.log.Slf4jLog
Apr 11, 2013 1:14:35 PM org.neo4j.server.logging.Logger log
INFO: Mounting static content at [/webadmin] from [webadmin-html]
Logger not configured, logging to std out instead: [FINE] Found [jar:file:/home/jaranda/cicerone/cicerone-crawlers/target/cicerone-crawlers-0.0.1-SNAPSHOT.jar!/webadmin-html]
Logger not configured, logging to std out instead: [FINE] Mounting static content from [jar:file:/home/jaranda/cicerone/cicerone-crawlers/target/cicerone-crawlers-0.0.1-SNAPSHOT.jar!/webadmin-html] at [/webadmin]
Logger not configured, logging to std out instead: [FINE] Mounting servlet at [/db/manage]
Logger not configured, logging to std out instead: [FINE] Mounting servlet at [/db/data]
Logger not configured, logging to std out instead: [FINE] Mounting servlet at [/]
2013-04-11 13:14:35,556 INFO [org.mortbay.log] - jetty-6.1.x
2013-04-11 13:14:35,915 INFO [org.mortbay.log] - NO JSP Support for /webadmin, did not find org.apache.jasper.servlet.JspServlet
Apr 11, 2013 1:14:36 PM com.sun.jersey.api.core.PackagesResourceConfig init
INFO: Scanning for root resource and provider classes in the packages:
org.neo4j.server.webadmin.rest
Apr 11, 2013 1:14:39 PM com.sun.jersey.api.core.ScanningResourceConfig logClasses
INFO: Root resource classes found:
class org.neo4j.server.webadmin.rest.JmxService
class org.neo4j.server.webadmin.rest.ConsoleService
class org.neo4j.server.webadmin.rest.MonitorService
class org.neo4j.server.webadmin.rest.RootService
Apr 11, 2013 1:14:39 PM com.sun.jersey.api.core.ScanningResourceConfig init
INFO: No provider classes found.
Apr 11, 2013 1:14:39 PM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.9 09/02/2011 11:17 AM'
Apr 11, 2013 1:14:40 PM com.sun.jersey.api.core.PackagesResourceConfig init
INFO: Scanning for root resource and provider classes in the packages:
org.neo4j.server.rest.web
Apr 11, 2013 1:14:43 PM com.sun.jersey.api.core.ScanningResourceConfig logClasses
INFO: Root resource classes found:
class org.neo4j.server.rest.web.ResourcesService
class org.neo4j.server.rest.web.RestfulGraphDatabase
class org.neo4j.server.rest.web.DatabaseMetadataService
class org.neo4j.server.rest.web.ExtensionService
class org.neo4j.server.rest.web.CypherService
class org.neo4j.server.rest.web.BatchOperationService
Apr 11, 2013 1:14:43 PM com.sun.jersey.api.core.ScanningResourceConfig init
INFO: No provider classes found.
Apr 11, 2013 1:14:43 PM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.9 09/02/2011 11:17 AM'
Apr 11, 2013 1:14:43 PM com.sun.jersey.api.core.PackagesResourceConfig init
INFO: Scanning for root resource and provider classes in the packages:
org.neo4j.server.rest.discovery
Apr 11, 2013 1:14:46 PM com.sun.jersey.api.core.ScanningResourceConfig logClasses
INFO: Root resource classes found:
class org.neo4j.server.rest.discovery.DiscoveryService
Apr 11, 2013 1:14:46 PM com.sun.jersey.api.core.ScanningResourceConfig init
INFO: No provider classes found.
Apr 11, 2013 1:14:46 PM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.9 09/02/2011 11:17 AM'
2013-04-11 13:14:46,751 INFO [org.mortbay.log] - Started SelectChannelConnector#172.20.100.33:7474
Apr 11, 2013 1:14:46 PM org.neo4j.server.logging.Logger log
INFO: Server started on [http://172.20.100.33:7474/]
2013-04-11 13:14:47,616 INFO [org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler] - Initializing ExecutorService 'taskScheduler'
2013-04-11 13:14:47,714 INFO [com.twitter.hbc.httpclient.BasicClient] - New connection executed: Hosebird-Client-02, endpoint: /1.1/statuses/filter.json?delimited=length&stall_warnings=true
2013-04-11 13:14:48,346 INFO [com.twitter.hbc.httpclient.ClientBase] - Hosebird-Client-02 Establishing a connection
Apr 11, 2013 1:14:48 PM com.sun.jersey.spi.container.ContainerResponse write
SEVERE: A message body writer for Java class [B, and Java type class [B, and MIME media type application/json was not found
Apr 11, 2013 1:14:48 PM com.sun.jersey.spi.container.ContainerResponse write
SEVERE: The registered message body writers compatible with the MIME media type are:
*/* ->
com.sun.jersey.server.impl.template.ViewableMessageBodyWriter
Apr 11, 2013 1:14:48 PM com.sun.jersey.spi.container.ContainerResponse logException
SEVERE: Mapped exception to response: 500 (Internal Server Error)
javax.ws.rs.WebApplicationException: com.sun.jersey.api.MessageException: A message body writer for Java class [B, and Java type class [B, and MIME media type application/json was not found
at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:285)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1437)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:926)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: com.sun.jersey.api.MessageException: A message body writer for Java class [B, and Java type class [B, and MIME media type application/json was not found
... 22 more
I must say I'm pretty new to Spring, Maven and Neo4j itself. I'm quite lost how to get rid of this issue. The web interface actually loads but without any kind of functionality. See attached shot:
.
The backend of my app works fine despite of this issue and actually new nodes/relationships are created.
I think this issue (or kind of) was discussed here but the answer is not clear to me.
Any suggestions? Thank you in advance!
I finally found a solution, which did the trick. I just share it, in case anyone else experiences the same issue. The problem was that some files under META-INF/services were being overwritten during the jar packaging process, since by default their content is not merged. According to the maven-shade plugin reference:
JAR files providing implementations of some interfaces often ship with
a META-INF/services/ directory that maps interfaces to their
implementation classes for lookup by the service locator. To merge
multiple implementations of the same interface into one service entry,
the ServicesResourceTransformer can be used.
So adding this transformer in my pom just worked, e.g.:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
...
</project>
Hope it helps!
When I'm trying to connect to tfs I got the following error:
---------------------------
Microsoft Visual Studio
---------------------------
Team Foundation Server
TF31001: Team Foundation cannot retrieve the list of team projects from Team Foundation Server UGSERVER. The Team Foundation Server returned the following error: Team Foundation services are not available from the server.
Technical information (for administrator):
TF30059: Fatal error while initializing web service.
Then, I checked the event viewer and it has the following details:
Event Type: Error
Event Source: TFS Services
Event Category: None
Event ID: 3017
Date: 2/2/2010
Time: 9:38:31 AM
User: N/A
Computer: UGSERVER
Description:
TF53010: The following error has occurred in a Team Foundation component or extension:
Date (UTC): 2/2/2010 4:38:31 AM
Machine: UGSERVER
Application Domain: /LM/W3SVC/738167904/Root/Services-11-129095591107656250
Assembly: Microsoft.TeamFoundation.Server, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v2.0.50727
Process Details:
Process Name: w3wp
Process Id: 408
Thread Id: 6020
Account name: NT AUTHORITY\LOCAL SERVICE
Detailed Message: TF53013: A crash report is being prepared for Microsoft. The following information is included in that report:
System Values
OS Version Information=Microsoft Windows NT 5.2.3790 Service Pack 2, v.2845
CLR Version Information=2.0.50727.1433
Machine Name=UGSERVER Processor Count=2
Working Set=52858880
System Directory=C:\WINDOWS\system32
Process Values
ExitCode=0
Interactive=False
Has Shutdown Started=False
Process Environment Variables
Path = C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;D:\Program Files\Microsoft SQL Server\90\DTS\Binn\;D:\Program Files\Microsoft SQL Server\90\Tools\binn\;D:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;C:\Program Files\Microsoft Team Foundation Server 2008 Power Tools\;C:\Program Files\Microsoft Team Foundation Server 2008 Power Tools\Best Practices Analyzer\
TEMP = C:\WINDOWS\TEMP
PATHEXT = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE = x86
SystemDrive = C:
windir = C:\WINDOWS
TMP = C:\WINDOWS\TEMP
ALLUSERSPROFILE = C:\Documents and Settings\All Users
TFSPowerToolDir = C:\Program Files\Microsoft Team Foundation Server 2008 Power Tools\
USERPROFILE = C:\Documents and Settings\Default User
ProgramFiles = C:\Program Files
FP_NO_HOST_CHECK = NO
COMPUTERNAME = UGSERVER
APP_POOL_ID = Microsoft Team Foundation Server Application Pool
NUMBER_OF_PROCESSORS = 2
PROCESSOR_IDENTIFIER = x86 Family 15 Model 4 Stepping 1, GenuineIntel
ClusterLog = C:\WINDOWS\Cluster\cluster.log
SystemRoot = C:\WINDOWS
ComSpec = C:\WINDOWS\system32\cmd.exe
CommonProgramFiles = C:\Program Files\Common Files
PROCESSOR_LEVEL = 15
PROCESSOR_REVISION = 0401
lib = C:\Program Files\SQLXML 4.0\bin\
BPADir = C:\Program Files\Microsoft Team Foundation Server 2008 Power Tools\Best Practices Analyzer\
VS90COMNTOOLS = d:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\
OS = Windows_NT
Request Details
Url=http://ugserver:8080/Services/v1.0/ServerStatus.asmx [method = POST]
User Agent=Team Foundation (devenv.exe, 9.0.21022.8)
Headers=Content-Length=354&Content-Type=text%2fxml%3b+charset%3dutf-8&Accept-Encoding=gzip%2cgzip%2cgzip&Accept-Language=en-US&Authorization=NTLM+TlRMTVNTUAADAAAAAAAAAEgAAAAAAAAASAAAAAAAAABIAAAAAAAAAEgAAAAAAAAASAAAAAAAAABIAAAANcKI4gUCzg4AAAAP&Expect=100-continue&Host=ugserver%3a8080&User-Agent=Team+Foundation+(devenv.exe%2c+9.0.21022.8)&X-TFS-Version=1.0.0.0&X-TFS-Session=8d9f4a30-16f3-4fc6-8daa-3aaefd2a8ea6&SOAPAction=%22http%3a%2f%2fschemas.microsoft.com%2fTeamFoundation%2f2005%2f06%2fServices%2fServerStatus%2f03%2fCheckAuthentication%22
Path=/Services/v1.0/ServerStatus.asmx
Local Request=True
User Host Address=192.168.1.186
User=UGSERVER\Administrator [auth = NTLM]
Application Provided Information
Team Foundation Application Information
Event Log Source = TFS Services
Configured Team Foundation Server = http://UGSERVER:8080
License Type = EnterpriseLicense
Server Culture = en-US
Activity Logging Name = Integration
Component Name = CS
Initialized = No
Requests Processed = 0
Exception: SqlException
Message: Cannot open database "TfsIntegration" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\LOCAL SERVICE'.
SQL Exception Class: 11
SQL Exception Number: 4060
SQL Exception Server: UGSERVER\UGSERVER
SQL Exception Source: .Net SqlClient Data Provider
SQL Exception State: 1
SQL Exception Procedure:
SQL Exception Line Number: 65536
SQL Error: System.Data.SqlClient.SqlError: Login failed for user 'NT AUTHORITY\LOCAL SERVICE'.
Class: 14
Number: 18456
Server: UGSERVER\UGSERVER
Source: .Net SqlClient Data Provider
State: 1
Procedure:
Line Number: 65536
Exception Data Dictionary follows
HelpLink.ProdName = Microsoft SQL Server
HelpLink.EvtSrc = MSSQLServer
HelpLink.EvtID = 4060
HelpLink.BaseHelpUrl = http://go.microsoft.com/fwlink
HelpLink.LinkId = 20476
Stack Trace:
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at Microsoft.TeamFoundation.RegistrationDataAccessor.GetRegisteredTools(String toolId, String connectionString)
at Microsoft.TeamFoundation.RegistrationDataAccessor.GetRegistrationEntries(String toolId, String connectionString)
at Microsoft.TeamFoundation.Server.RegistrationEventSchemaProvider..ctor(String applicationPath)
at Microsoft.TeamFoundation.Server.CombinationEventSchemaProvider..ctor(String applicationPath)
at Microsoft.TeamFoundation.Server.Global.Initialize()
at Microsoft.TeamFoundation.Server.TeamFoundationApplication.Init()
Application Domain Information
Assembly Name=mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Assembly CLR Version=v2.0.50727
Assembly Version=2.0.0.0
Assembly Location=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll
Assembly File Version:
File: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll
InternalName: mscorlib.dll
OriginalFilename: mscorlib.dll
FileVersion: 2.0.50727.1433 (REDBITS.050727-1400)
FileDescription: Microsoft Common Language Runtime Class Library
Product: Microsoft® .NET Framework
ProductVersion: 2.0.50727.1433
Debug: False
Patched: False
PreRelease: False
PrivateBuild: False
SpecialBuild: False
Language: English (United States)
Assembly Name=System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Assembly CLR Version=v2.0.50727
Assembly Version=2.0.0.0
Assembly Location=C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll
Assembly File Version:
File: C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll
InternalName: System.Web.dll
OriginalFilename: System.Web.dll
FileVersion: 2.0.50727.1433 (REDBITS.050727-1400)
FileDescription: System.Web.dll
Product: Microsoft® .NET Framework
ProductVersion: 2.0.50727.1433
Debug: False
Patched: False
PreRelease: False
PrivateBuild: False
SpecialBuild: False
Language: English (United States)
Assembly Name=System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Assembly CLR Version=v2.0.50727
Assembly Version=2.0.0.0
Assembly Location=C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll
Assembly File Version:
File: C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll
InternalName: System.dll
OriginalFilename: System.dll
FileVersion: 2.0.50727.1433 (REDBITS.050727-1400)
FileDescription: .NET Framework
Product: Microsoft® .NET Framework
ProductVersion: 2.0.50727.1433
Debug: False
Patched: False
PreRelease: False
PrivateBuild: False
SpecialBuild: False
Language: English (United States)
Assembly Name=System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Assembly CLR Version=v2.0.50727
Assembly Version=2.0.0.0
Assembly Location=C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll
Assembly File Version:
File: C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll
InternalName: System.Xml.dll
OriginalFilename: System.Xml.dll
FileVersion: 2.0.50727.1433 (REDBITS.050727-1400)
FileDescription: .NET Framework
Product: Microsoft® .NET Framework
ProductVersion: 2.0.50727.1433
Debug: False
Patched: False
PreRelease: False
PrivateBuild: False
SpecialBuild: False
Language: English (United States)
Assembly Name=System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Assembly CLR Version=v2.0.50727
Assembly Version=2.0.0.0
Assembly Location=C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll
Assembly File Version:
File: C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll
InternalName: System.Configuration.dll
OriginalFilename: System.Configuration.dll
FileVersion: 2.0.50727.1433 (REDBITS.050727-1400)
FileDescription: System.Configuration.dll
Product: Microsoft® .NET Framework
ProductVersion: 2.0.50727.1433
Debug: False
Patched: False
PreRelease: False
PrivateBuild: False
SpecialBuild: False
Language: English (United States)
Assembly Name=System.Web.RegularExpressions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Assembly CLR Version=v2.0.50727
Assembly Version=2.0.0.0
Assembly Location=C:\WINDOWS\assembly\GAC_MSIL\System.Web.RegularExpressions\2.0.0.0__b03f5f7f11d50a3a\System.Web.RegularExpressions.dll
Assembly File Version:
File: C:\WINDOWS\assembly\GAC_MSIL\System.Web.RegularExpressions\2.0.0.0__b03f5f7f11d50a3a\System.Web.RegularExpressions.dll
InternalName: System.Web.RegularExpressions.dll
OriginalFilename: System.Web.RegularExpressions.dll
FileVersion: 2.0.50727.1433 (REDBITS.050727-1400)
FileDescription: System.Web.RegularExpressions.dll
Product: Microsoft® .NET Framework
ProductVersion: 2.0.50727.1433
Debug: False
Patched: False
PreRelease: False
PrivateBuild: False
SpecialBuild: False
Language: English (United States)
Assembly Name=Microsoft.JScript, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Assembly CLR Version=v2.0.50727
Assembly Version=8.0.0.0
Assembly Location=C:\WINDOWS\assembly\GAC_MSIL\Microsoft.JScript\8.0.0.0__b03f5f7f11d50a3a\Microsoft.JScript.dll
Assembly File Version:
File: C:\WINDOWS\assembly\GAC_MSIL\Microsoft.JScript\8.0.0.0__b03f5f7f11d50a3a\Microsoft.JScript.dll
InternalName: Microsoft.JScript.dll
OriginalFilename: Microsoft.JScript.dll
FileVersion: 8.0.50727.1433
FileDescription: Microsoft.JScript.dll
Product: Microsoft (R) Visual Studio (R) 2005
ProductVersion: 8.0.50727.1433
Debug: False
Patched: False
PreRelease: False
PrivateBuild: False
SpecialBuild: False
Language: Language Neutral
Assembly Name=CppCodeProvider, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Assembly CLR Version=v2.0.50727
Assembly Version=8.0.0.0
Assembly Location=C:\WINDOWS\assembly\GAC_MSIL\CppCodeProvider\8.0.0.0__b03f5f7f11d50a3a\CppCodeProvider.dll
Assembly File Version:
File: C:\WINDOWS\assembly\GAC_MSIL\CppCodeProvider\8.0.0.0__b03f5f7f11d50a3a\CppCodeProvider.dll
InternalName: CppCodeProvider.dll
OriginalFilename: CppCodeProvider.dll
FileVersion: 8.0.50727.813
FileDescription: CppCodeProvider.dll
Product: Microsoft (R) Visual Studio (R) 2005
ProductVersion: 8.0.50727.813
Debug: False
Patched: False
PreRelease: False
PrivateBuild: False
SpecialBuild: False
Language: Language Neutral
Assembly Name=App_global.asax.3iyvjmrk, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
Assembly CLR Version=v2.0.50727
Assembly Version=0.0.0.0
Assembly Location=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\services\a8a490c5\21badae0\App_global.asax.3iyvjmrk.dll
Assembly File Version:
File: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\services\a8a490c5\21badae0\App_global.asax.3iyvjmrk.dll
InternalName: App_global.asax.3iyvjmrk.dll
OriginalFilename: App_global.asax.3iyvjmrk.dll
FileVersion: 0.0.0.0
FileDescription:
Product:
ProductVersion: 0.0.0.0
Debug: False
Patched: False
PreRelease: False
PrivateBuild: False
SpecialBuild: False
Language: Language Neutral
Assembly Name=Microsoft.TeamFoundation.Server, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Assembly CLR Version=v2.0.50727
Assembly Version=9.0.0.0
Assembly Location=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\services\a8a490c5\21badae0\assembly\dl3\c371c214\00f59c0d_7422c801\Microsoft.TeamFoundation.Server.DLL
Assembly File Version:
File: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\services\a8a490c5\21badae0\assembly\dl3\c371c214\00f59c0d_7422c801\Microsoft.TeamFoundation.Server.DLL
InternalName: Microsoft.TeamFoundation.Server.dll
OriginalFilename: Microsoft.TeamFoundation.Server.dll
FileVersion: 9.0.21022.8
FileDescription: Microsoft.TeamFoundation.Server.dll
Product: Microsoft (R) Visual Studio (R) 2008
ProductVersion: 9.0.21022.8
Debug: False
Patched: False
PreRelease: False
PrivateBuild: False
SpecialBuild: False
Language: Language Neutral
Assembly Name=Microsoft.TeamFoundation.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Assembly CLR Version=v2.0.50727
Assembly Version=9.0.0.0
Assembly Location=C:\WINDOWS\assembly\GAC_32\Microsoft.TeamFoundation.Common\9.0.0.0__b03f5f7f11d50a3a\Microsoft.TeamFoundation.Common.dll
Assembly File Version:
File: C:\WINDOWS\assembly\GAC_32\Microsoft.TeamFoundation.Common\9.0.0.0__b03f5f7f11d50a3a\Microsoft.TeamFoundation.Common.dll
InternalName: Microsoft.TeamFoundation.Common.dll
OriginalFilename: Microsoft.TeamFoundation.Common.dll
FileVersion: 9.0.21022.8
FileDescription: Microsoft.TeamFoundation.Common.dll
Product:
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
If you check the above details then you would have seen the following:
Exception: SqlException
Message: Cannot open database "TfsIntegration" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\LOCAL SERVICE'.
The database server has got the user. Then, why?
I tried to repair it from Add/Remove and got the following error:
---------------------------
Microsoft Visual Studio 2008 Team Foundation Server Setup
---------------------------
Error 29002.The Team Foundation databases could not be repaired. For more information, see the Microsoft Windows Installer (MSI) log.
---------------------------
Retry Cancel
---------------------------
**I checked the event viewer it has:**
Event Type: Error
Event Source: MsiInstaller
Event Category: None
Event ID: 10005
Date: 2/2/2010
Time: 10:21:57 AM
User: UGSERVER\Administrator
Computer: UGSERVER
Description:
Product: Microsoft Visual Studio 2008 Team Foundation Server - ENU -- Error 29002.The Team Foundation databases could not be repaired. For more information, see the Microsoft Windows Installer (MSI) log.
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Data:
0000: 7b 33 35 45 44 37 38 38 {35ED788
0008: 42 2d 44 41 36 42 2d 33 B-DA6B-3
0010: 33 37 33 2d 42 42 32 42 373-BB2B
0018: 2d 41 36 38 43 31 34 39 -A68C149
0020: 45 41 38 31 41 7d EA81A}
Exception: SqlException
Message: Cannot open database "TfsIntegration" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\LOCAL SERVICE'.
This sounds like the root of the problem. Check that's nothing changed on your network, and that nobody has gone in to meddle with the database permissions. Also check that Windows authentication is still enabled (not SQL Server).
Typically, TFS does not run as NT AUTHORITY/LOCAL USER, rather as \TFSSERVICE.