composite component ending up in wrong directory with jboss jsf tools and m2eclipse? - jsf-2

When using JBOSS Tools, M2E and M2E-WTP creating a new composite component wants to put the newly created component in the wrong directory. It also looks for components in the wrong directory.
It should be putting it in the directory:
src/main/webapp/resources/components/group-name/tagname.xhtml
but instead it is looking for it (and a quick fix creates file) in:
target/m2e-wtp/web-resources/resources/components/group-name/tagname.xhtml
Here are the versions I am using:
JBoss Tools RichFaces for Eclipse Version:
3.2.1.v20110730-1214-H169-Final
M2E - Maven Integration for Eclipse
Version: 1.0.0.20110607-2117
Maven Integration for WTP
Version: 0.13.1.20110728-1800
Update:
Seems to pick the first path in .settings/org.eclipse.wst.common.component file. Changing the non m2e to be first seems to make it want to put it in the right place.
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="hcbb">
<wb-resource deploy-path="/" source-path="/src/main/webapp"/>
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="context-root" value="hcbb"/>
<property name="java-output-path" value="/hcbb/target/classes"/>
</wb-module>
</project-modules>
However, it is still complaining about missing or invalid attributes and not doing auto completion on the custom components.. Not sure if JSF Tools even does that though.

I believe this issue is fixed in later release of joss tools 3.3.x.
If not please open bug and we'll look at it.

Related

Separate logging using LOG4J2

I have a requirement to maintain separate logging files EAR1.log and EAR2.log for 2 Java EE applications EAR1 and EAR2 respectively using LOG4J2 v2.1. Going through the internet, I could see help specific to LOG4J v1.x, but couldn’t find any for LOG4J2.
EAR1 (need to use “EAR1-log4j2.xml”):
1. Web project “web1”
2. EJB project “ejb1”
3. Java project “java1”
4. Java project “java2”
5. Java project “java3”
EAR2 (need to use “EAR2-log4j2.xml”):
1. Web project “web2”
2. EJB project “ejb2”
3. Java project “java1” (same as above)
4. Java project “java2” (same as above)
5. Java project “java3” (same as above)
http://logging.apache.org/log4j/2.x/manual/migration.html
http://logging.apache.org/log4j/2.x/manual/logsep.html
what is working now:
my log4j2.xml is placed in ApplicationServer classpath & a single log is successfully getting written for both the EAR’s
my completed attempts to maintain separate log files for both EAR’s:
• Modifying web.xml only applies the logging change to the web project alone
• I tried the following code, but this applies only to current class
LoggerContext loggerCtx = Configurator.initialize("mrpst", null, PathOfMyLog4j2XmlPath );
Logger log = loggerCtx.getLogger("MyClassName");
I’m trying to check if it is possible to complete this requirement by editing log4j2.xml alone(without code change). Appreciate if a documentation link can be provided or any alternate approach.
My suggestion is to inject context into your log event and filter on that context using a logger route, which directs to an appropriate appender.
At the point of logging:
String routeKey = SOME_FIELD_THAT_IDENTIFIES_CONTAINER;
ThreadContext.put( "myEARroute", routeKey );
In your log4j2.xml config:
<Routing name="myEARroute">
<Routes pattern="$${ctx:myEARroute}">
<!-- if you forget to inject context, the routing key will be empty -->
<Route
key="$${ctx:myEARroute}"
ref="STDOUT" />
<Route
key="EAR1"
ref="myEAR1Appender" />
<Route
key="EAR2"
ref="myEAR2Appender" />
</Routes>
</Routing>
Now you just have to create appenders matching your appender names:
<RollingRandomAccessFile
name="myEAR1Appender"
filename="logs/Ear1.log"
<!-- fill in the rest of your appender config, as desired -->
</RollingRandomAccessFile>
repeat for other appenders.

How to specify multiple binding files in gradle for ant xjc task

I have multiple bindings(xjb files) in the gradle project. When generating JAXB classes for a xsd(C.xsd). I want to use the previously generated binding files for A.xjb & B.xjb since C.xsd refers to A.xsd & B.xsd
The below ant xjc task works if I don't have anyother bindings in same path but I want specify explicity A.xjb & B.xjb bindings. How to go about same, I tried various options but nothing seems working. Any help greatly appreciated.
ant.xjc(destdir : '${jaxbDest}', removeOldOutput:'yes', extension:'true') {
arg(line:'-Xequals -XhashCode -XtoString -Xcopyable')
schema(dir:'src/main/schema', includes:'C.xsd')
binding(dir:'src/main/schema', includes:'*.xjb)
}
Thanks
Ravi
According to this documentation for the ant xjc task -
"To specify more than one external binding file at the same time, use a nested element, which has the same syntax as fileset."
In gradle it would look like this:
binding(dir:'src/main/schema'){
include(name:'A.xjb')
include(name:'B.xjb')
}
I think this would also work:
binding(dir:'src/main/schema', includes:'A.xjb,B.xjb')

Don't want to make application.xml file while making EAR file using ANT

I don't want to include or make application.xml in ear tag
How can i off this parameter
<ear earfile="${builddir}/myapp.ear"
appxml="ear_deploy_descriptor/application.xml"
basedir="${builddir}"
includes="*.jar,*.war"/>
Please see earTask documentation at http://ant.apache.org/manual/Tasks/ear.html.
If you specify update="true" then the appxml attribute is not required.
A Java EE 5 application is not required to provide an application.xml file in the EAR file.
There seems to an issue with ANT when dealing with this. This was reported here: https://issues.apache.org/bugzilla/show_bug.cgi?id=51761
Try using the jar task instead of the ear and it should work.
<jar destfile="${builddir}/myapp.ear"
basedir="${builddir}"
includes="*.jar,*.war"/>

Grails - Batik.jar interaction

An external Library need the Batik.jar Library.
But on Loading it outputs:
java.lang.LinkageError: loader constraint violation: loader (instance of ) previously initiated loading for a different type with name "org/xml/sax/SAXParseException"
I tried modifying the build config.groovy file to exclude xml-apis but it didnt work. Any workaround for using batik?
I faced the same problem , I've manually looked for all ivy*.xml files in %User%\.ivy2\cache\org.apache.xmlgraphics and deleted the following entry :
<dependency org="xml-apis" name="xml-apis" rev="1.3.04" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
I had the same issue with the selenium libraries, which have contain some xml-libraries. I extracted these newer/outdated versions from selenium and then it worked.
I had a look into "batik" and in the lib folder there are xalan, xerces and xml-apis. Try to remove them and hope, that the api-versions provided from grails are compatible.

PartCover browser not opening code files

We're generating PartCover reports via the command line tool along with our CruiseControl.Net unit tests. This generates an xml file that displays the results nicely on the cruisecontrol dashboard. The xslt transforms that are included only show you the percentage of coverage in an individual class. We want to know exactly what lines are not being covered. The problem ist when we open the report in the PartCover browser and double click a method it doesn't show us our cs files. I know the PartCover browser is capable of showing you the files because of the following.
Here's a screenshot of PartCover browser with the lines of code showing: http://kjkpub.s3.amazonaws.com/blog/img/partcover-browse.png.
The information looks like it should be available to the browser because the report contains this:
<Method name="get_DeviceType" sig="Cathexis.IDBlue.DeviceType ()" bodysize="19" flags="0" iflags="0">
<pt visit="2" pos="0" len="1" fid="82" sl="35" sc="13" el="35" ec="14" />
<pt visit="2" pos="1" len="4" fid="82" sl="36" sc="17" el="36" ec="39" />
<pt visit="2" pos="5" len="2" fid="82" sl="37" sc="13" el="37" ec="14" />
</Method>
and this:
<File id="66" url="D:\sandbox\idblue\idblue\trunk\software\code\driver\dotnet\Common\AsyncEventQueue.cs" />
All I want to be able to do is view what lines of code are not being covered in my test cases without having to figure out what the xml above is trying to tell me.
Thanks to anyone in advance who replies.
I figured out why the cs files were not displaying. The paths were incorrect in the xml file because our test project was being built on a different machine than the one partcover was on. (partcover must generate the .cs file paths from pdb files maybe?) Once I search and replaced the file switching the base directory of our subversion location to the one on the other machine all was well.

Resources