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

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>

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".

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.

How to define a package that uninstalls old code in CQ5?

Has anybody been able to successfully use the Replace dependency filter in the CQ5 Package Manager to uninstall/delete old code? http://dev.day.com/docs/en/crx/current/how_to/package_manager.html
I've recently restructured my directories and I'm trying to find an easy way to uninstall the old branches.
In other words, I am currently working with:
/apps/myproject/old_directory
but want to transition to:
/apps/myproject/new_directory
Like I said, I tried setting the Replace Dependency Filter with the old package name. It appears to be working because it says "Replaces my_packages:oldPackage:1" which is a valid link. However, running the install does nothing to the pre-existing code base.
I realize that I can just uninstall the original package manually, but this will be added to the Package Share, so I'd like to ensure that any current users can just install the upgrade without worrying about unused code.
I'm currently using CQ 5.4
To remove a content branch using a CQ5 package you need a package:
with a filter definition pointing at the content branch to be removed
without any content in that branch
In other words, you can create an empty package with filter definition pointing to areas you want removed. You can do that either on an empty instance, or by manually editing the filter.xml entry to something like:
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="/apps/myproject/new_directory"/>
</workspaceFilter>
Installing such package wipes content under the specified path(s). This operation cannot be undone. This works consistently on all CQ5 versions.

Setup Jetty default webapp folder

Apologies for the newbie question, I am trying to start using Jetty servlet container for a Scala/Ajax application.
I want to change the default webapp directory to a custom one, say /home/myuser/project/ and let jetty serve the index of that page.
a doctype, head and body is literally all I need as all the layout will be controlled via Ajax/REST/Scala with DOM generated entirely in JavaScript.
How can I get jetty to serve a custom index.html file from a specified folder?
I am using Jetty 9 Debian Distribution on a 64 bit Ubuntu 12.10, if that makes a difference in any way.
I believe you should be able to add a file called root.xml to your $JETTY_HOME/contexts directory with the content:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://\
jetty.mortbay.org/configure.dtd">
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<Set name="contextPath">/</Set>
<Set name="resourceBase">
/home/myuser/project/
</Set>
</Configure>
You may also need to remove any existing wars in $JETTY_HOME/webapps that respond to the same context.

Eclipse Content is not allowed in prolog

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)