Eclipse Content is not allowed in prolog - eclipse

I'm having trouble opening my main in my eclipse project. It keeps coming up with:
"content is not allowed in prolog"
I haven't altered my code or anything.
I have no idea what has gone wrong, anybody seen this before?

I had the same error and figured it out.
When I tried to create a new string resource, I tried to paste the new resource value on the "Android Resources" screen. To my surprise, the paste operation (using CTRL + V) does not work on that screen, and I tried it several times.
After that I started getting the error. When I switched from the "Android Resources" screen to the raw XML screen of the Strings.xml file, I noticed that all the text that I tried to paste was at the beginning of the file, like this:
Image content description. Image content description.<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">My App</string>
</resources>
And that was causing the error for me.

This error is generated during parsing of an XML document. Here is one writeup:
http://www.mkyong.com/java/sax-error-content-is-not-allowed-in-prolog/
You didn't provide sufficient information in your question to know which file might be corrupted, but search for xml files in your project and see if they look ok.

Restarting Eclipse and Cleaning the problem dint help.
I opened the .xml file in a XML editor and did a Validate on that error alone. this solved my problem. Hope this helps for people who still got the problem

Its most likely an encoding problem: (edit in notepad++ and select) encoding utf-8 -BOM

I had the same problem, It may be because of XML parser issue,
I restarted the eclipse it started working fine.

I also had the same error.Check your Xml files.There may be syntax error in xml files.

Having incorrect encoding information might cause this.
<?xml version="1.0" encoding="utf-16"?>
at the top of an ascii or utf-8 encoded file for example.

Yeah, I had the same, and the first line in strings.xml:
<?xml version="1.0" encoding="utf-8"?>
was marked with this error. Though I also didn't alter any code, yesterday, when I closed Eclipse, everything was fine, no errors (though some warnings were present, but that doesn't matter, I think)
All I did now is Selecting this line, Ctrl+X (Cut) it, Ctrl+S to save, Ctrl+V (Paste) it back and Ctrl+S again, and the error is gone. Not sure if it will work for everybody, but it did for me 8)

Check: that you have no any additional wrong text before in the beginning of file.

In my case I was seeing those error in java classes i.e. NOT XML and, the problem was related to a hidden file called .springBeans in the main project directory. I had a section "configs" and "autoconfigs" like:
java:org.DDDDDDDDDD.config.PersistenceConfig
java:org.DDDDDDDDDD.core.Application
When i moved everything to autoconfigs it all worked for me

In my case, server.xml got corrupted.
Go to pivotal/tomcat server location.
Path : base-instance\conf
File Name: server.xml
So i tried replacing below content in that file and it worked fine.
Sample content:-
<?xml version="1.0" encoding="UTF-8"?>
<Server port="${base.shutdown.port}" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
<Listener className="com.springsource.tcserver.serviceability.deploy.TcContainerDeployer"/>
<Listener accessFile="${catalina.base}/conf/jmxremote.access" address="127.0.0.1" authenticate="true" className="com.springsource.tcserver.serviceability.rmi.JmxSocketListener" passwordFile="${catalina.base}/conf/jmxremote.password" port="${base.jmx.port}" useSSL="false"/>
<GlobalNamingResources>
<Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
</GlobalNamingResources>
<Service name="Catalina">
<Executor maxThreads="300" minSpareThreads="50" name="tomcatThreadPool" namePrefix="tomcat-http--"/>
<Engine defaultHost="localhost" name="Catalina">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
</Realm>
<Host appBase="webapps" autoDeploy="true" deployOnStartup="true" deployXML="true" name="localhost" unpackWARs="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log." suffix=".txt"/>
</Host>
</Engine>
<Connector acceptCount="100" connectionTimeout="20000" executor="tomcatThreadPool" maxKeepAliveRequests="15" port="${nio.http.port}" protocol="org.apache.coyote.http11.Http11NioProtocol" redirectPort="${nio.https.port}"/>
</Service>
</Server>

I had a similar issue and wanted to make a note, in case other had the same root cause that I did.
My issue was related to the xsi:schemaLocation. The url stated was no longer being served. Via googling, I got a copy of the actual xsd file, which I included locally then updated the reference. This solved my issue.
e.g. http://dozer.sourceforge.net/schema/beanmapping.xsd became beanmapping.xsd in the snippet below, after adding the .xsd file to the same folder.
<?xml version="1.0" encoding="UTF-8"?>
<mappings xmlns="http://dozer.sourceforge.net" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://dozer.sourceforge.net beanmapping.xsd">

i delete the c:/users/your_computer/appdata/.gradle/cache and it went go to normal

I fix it with a non - xml file by clearing the file in the text editor, save the empty file and paste it back. (CTRL+A, CTRL+X, CTRL+S, CTRL+V, CTRL+S)

Related

External Annotations for ReSharper

I'm trying to create external annotations for System.IO.StreamReader.ReadToEndAsync. I've been looking at other questions on the topic, and tried to decipher what to do from those, and from how already existing external annotations look.
Right now I have:
A file named 4.0.0.0.Annotations.xml, located in;
[user]\AppData\Local\JetBrains\Installations\ReSharperPlatformVs14\ExternalAnnotations\mscorlib
The contents of the annotation file is:
<?xml version="1.0" encoding="utf-8"?>
<assembly name="mscorlib, Version=4.0.0.0">
<member name="M:System.IO.StreamReader.ReadToEndAsync()">
<attribute ctor="M:JetBrains.Annotations.NotNullAttribute.#ctor" />
</member>
</assembly>
I want to convince the code inspection that ReadToEndAsync will not return null, but it doesn't seem to be working (still getting warnings). Tried different naming, restarted Visual Studio and stuff, but to no avail.
What am I doing wrong?
I didn't realize that there may be several ExternalAnnotations folders with the ReSharper installation. In my case, the solution was to move the mscorlib folder I created for the 4.0.0.0.Annotations.xml file to:
[user]\AppData\Local\JetBrains\Installations\
ReSharperPlatformVs14_000 \ExternalAnnotations
Also, the syntax for annotating a method without parameters does not seem to include parentheses, so I also removed those, changing name="M:System.IO.StreamReader.ReadToEndAsync()" to name="M:System.IO.StreamReader.ReadToEndAsync".

NuGet.Config is malformed, Please check NuGet.Config - solution

After installing Update1 for VS 2015 I had a problem when trying to add local path for Nuget Manager.
Message was:
"NuGet.Config is malformed, Please check NuGet.Config"
In my case it was enough to find a nuget.config in path:
C:\Users\_my_user_name_\AppData\Roaming\NuGet\
Nuget.config file was empty (but size was 1KB).
I just filled it with content:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
</configuration>
And problem in VS didn't appear again.
In my case, %appdata%\nuget\nuget.config existed and was populated,... but its xml header claimed utf-8 when the file was really encoded fully-Unicode. Saving as utf-8 bom got me going again.

AEM (CQ5.6.1) local maven deployment only works sometimes

I've gotten some weird effects lately, where sometimes when I deploy my CQ application via Maven to my local AEM Server, it would't update correctly.
E.g. when changing something in a dialog of a component, I have to delete the /app/myapp folder in CRX and deploy again to get changes to appear.
I'm also having a hard time reproducing the effect. It happens seemingly in random intervals.
Please check your filter.xml file. This descriptor should contain all the root paths for your application so most probably: /app/myapp, /etc/designs/myapp and maybe couple others.
For more information please check vault documentation (section using filters). This file is used by CQ package manager to install the content.
In previous CQ versions there was a behaviour that filters were almost ignored. Starting from CQ 5.6 if any content path does not match filter.xml regexps it won't be installed. This does not match exactly your issue but kindly check if updating filter.xml file helps.
Here is what I use for our project and has worked flawlessly on AEM6 but should also work perfectly on CQ 5.6. Replace "ourProject" with whatever is appropriate and let me know if you still have issues.
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="/apps/ourProject">
<exclude pattern=".*install" />
</filter>
<filter root="/etc/ourProject"/>
<filter root="/etc/designs/ourProject" />
<filter root="/etc/widgets" />
<filter root="/etc/workflows" mode="update"/>
</workspaceFilter>

Jenkins Plugin for Writing to the Change Log?

Does anyone know of a Jenkins plugin which will allow you to easily set your own values for the "Changes" portion of a build?
We're manually performing our own SCM syncs, and so we don't currently have access to or know how to change the "Changes" portion of the build status.
Thank you for your help!
There is no specific plugin to do it.
Each builds change log is saved in a location like "C:\Program Files (x86)\Jenkins\jobs\BuildJobName\builds\2014-09-11_21-30-25\changelog.xml"
You can manually edit it or write an app which edits the changelog.xml
The format of the changelog.xml is as follows.
<?xml version="1.0" encoding="UTF-8"?>
<log>
<logentry revision="16349">
<author>LeoN</author>
<date>2014-10-24T08:33:57.708042Z</date>
<paths>
<path action="M" localPath="Binaries\Plugins\product.wxs" kind="file">/trunk/Project Phases/Development/Binaries/Plugins/product.wxs</path>
<path action="M or D or A" localPath="LocalPath From repo" kind="dir or File">Svn Path</path>
</paths>
<msg> Fixed Issues.</msg>
</logentry>
</log>
Action attribute can have values such as M,D,A
M - Modifications
D - Deletes
A - File or folder additions
I suggest you write an app to do this.

.NET 2.0 app on Windows Server 2003 doesn’t load a .config file

I can’t made my .NET 2.0 applications (and services) to load their appname.exe.config files on Windows Server 2003 Standard Edition SP2,
I tried to create manifest like this but it didn’t worked
EDIT:
Appname.config is located in the same dir,
App works without any changes on Windows XP, once we move files or use setup to install it on 2003 it fails to load .config file.
The "working directory" of the executable IS the same as it's path! We didn’t change anything while moving it from XP to 2003
I’ve tried process monitor, it says for operations CreateFile and QueryOpen: name not fount, like this file would not exists, but I assure, it is!
I think it might be something wit manifest files under 200, according to this thred on MS Connect
but I don’t know how to solve the problem.
This might be the solution:
http://blogs.msdn.com/junfeng/archive/2006/08/09/692996.aspx
To workaround the bug, add an assemblyIdentity to the SxS manifest.
<?xml version="1.0" encoding="utf-8"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
name="Foo"
type="win32"
/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
Two things come to mind:
First, is the config file located in the same directory as the executable?
Second, is the "working directory" of the executable the same as it's path? If the working directory isn't correct, then it won't be able to locate the file.
One more thing to do would be to get a copy of sysinternals, specifically the process explorer tool to see what file (and path) it's trying to load.
What do you mean by cannot load? Any exception message .Net throws at you? Or it just dies silently?
Your app should load yourexe.exe.config, i.e., mainform.exe.config, where mainform.exe is your app name.