WebSphere 6.1 Change Class loader order - websphere-6.1

I want to change the class loader delegation order on a web module deployed to WAS6.1 from it's default of parent first to parent last. The reason is I would like to use JSF 1.2 etc and WAS6.1 doesn't normally support it.
In the integrated solutions console for the locally deployed instance, under Enterprise Applications > MyAppEAR > Manage Modules > MyApp.war the Class loader order drop down is greyed out.
Why is it greyed out?
How can I ungrey it out?
Would it be better to put a directive in the deployment descriptor?
If the answer to (3) is anything other than No, please can you specify exactly the code to do this.
I can't for the life of me find the answers to these questions on the web.

I had the same thing. I needed to set the classloader to PARENT_LAST but the setting was greyed out. I 'solved' it by manually putting a deployment.xml file (contents below) in META-INF/ibmconfig/cells/defaultCell/applications/defaultApp/deployments/defaultApp of your ear project.
<?xml version="1.0" encoding="UTF-8"?>
<appdeployment:Deployment xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:appdeployment="http://www.ibm.com/websphere/appserver/schemas/5.0/appdeployment.xmi" xmi:id="Deployment_1212499072929">
<deployedObject xmi:type="appdeployment:ApplicationDeployment" xmi:id="ApplicationDeployment_1212499072929" startingWeight="10">
<modules xmi:type="appdeployment:WebModuleDeployment" xmi:id="WebModuleDeployment_1212499072929" startingWeight="10000" uri="yourwarproject.war" classloaderMode="PARENT_LAST"/>
<classloader xmi:id="Classloader_1212499072929" mode="PARENT_LAST"/>
</deployedObject>
</appdeployment:Deployment>
Hope this helps.

I had the same problem!
I needed to change:
enable reload of classes: reloadEnabled="true"
update interval: ??? (still searching, any help appreciated)
here my deployment xml file:
<?xml version="1.0" encoding="UTF-8"?>
<appdeployment:Deployment xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:appdeployment="http://www.ibm.com/websphere/appserver/schemas/5.0/appdeployment.xmi" xmi:id="Deployment_1310499119656">
<deployedObject xmi:type="appdeployment:ApplicationDeployment" xmi:id="ApplicationDeployment_1310499119656" startingWeight="10" warClassLoaderPolicy="SINGLE" reloadEnabled="true">
<modules xmi:type="appdeployment:WebModuleDeployment" xmi:id="WebModuleDeployment_1310499119656" startingWeight="10000" uri="tcm_portal_web_six.war" classloaderMode="PARENT_LAST"/>
<modules xmi:type="appdeployment:WebModuleDeployment" xmi:id="WebModuleDeployment_1310499119657" startingWeight="10000" uri="tcm_portal_lib.war" classloaderMode="PARENT_LAST"/>
<classloader xmi:id="Classloader_1310499119656" mode="PARENT_LAST"/>
</deployedObject>
</appdeployment:Deployment>
BR
Dirk

Related

Shipping logs to Logz.io with NLog fails

I'm just trying to ship some error logs from my ASP.NET MVC 5 app to Logz.io
I'm using NLog to ship my logs.
I've installed NLog and NLog.Web packages
I have the following nlog.config file :
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
throwExceptions="true"
internalLogLevel="ERROR"
internalLogFile="C:\Temp\nlog-internal.log">
<extensions>
<add assembly="Logzio.DotNet.NLog"/>
</extensions>
<targets async="true">
<target name="file" type="File"
fileName="<pathToFileName>"
archiveFileName="<pathToArchiveFileName>"
keepFileOpen="false"
layout="<long layout patten>"/>
<target name="logzio"
type="Logzio"
token="LRK......"
logzioType="nlog"
listenerUrl="https://listener.logz.io:8071"
bufferSize="1"
bufferTimeout="00:00:05"
retriesMaxAttempts="3"
retriesInterval="00:00:02"
debug="false" />
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="logzio" />
</rules>
</nlog>
Then, each of my C# controller have this line :
private static Logger logger = LogManager.GetCurrentClassLogger();
and then I try to ship my logs using something like :
logger.Fatal("Something bad happens");
However, when I writeTo="file" in the nlog.config file, I can find a log file on my local disk with "Something bad happens", so everything is fine.
However, nothing appear on my LogzIo web interface when I writeTo="logzio", no logs are shipped there.
What did I miss ?
Answering my own question after I found how to solve this.
Actually, my whole project use HTTPS.
In internal Nlog logs, I had this error
Error : System.Net.WebException : The request was aborted: Could not create SSL/TLS secure channel
I've just added this line of code at the very beginning of ApplicationStart in Global.asax.cs
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
After testing the whole project during some days, it seems it doesn't affect the other parts of the project.
However, just be careful as it is a global setting
I had the same issue, and it turned out that in my published app the logzio dlls were missing. I added them and it resolved the issue.
Check if you're missing these files in your bin folder:
Logzio.DotNet.NLog.dll
Logzio.DotNet.Core.dll

Ant tasks don't run IN IzPack installer

.
Hello, everyone
I'm studying IzPack as a tool to be used in a future project and I'm really enjoying it. It's as flexible as I need and makes the process much more easy. I have even submmited a silly pull request at github with a modification I needed to my purposes. Who knows?
Although I don't find it particularly complicated, I've been stuck trying to use a resource for some days. I need that certain Ant Tasks to be executed in certain points of the installation process (right before everything is unpacked is the really one that matters) and that is not working, besides all the efford. :(
My current state, that seems right looking at examples, is the following:
[ My current use of this is based on an example I found here (the docs don't clear too much when It cames to these kind of Actions.]
In my definitions xml file, I included some things:
First, the AntActionsSpect.xml and the .jars, followed by the listeners:
<resources>
...
<res id="AntActionsSpec.xml" src="specs/AntActionsSpec.xml" />
...
</resources>
<jar src="libs/ant/ant.jar" stage="both" />
<jar src="libs/ant/ant-launcher.jar" stage="both" />
<listeners>
<listener classname="AntActionInstallerListener" stage="install" />
<listener classname="AntActionUninstallerListener" stage="uninstall" />
</listeners>
<pack name="test_app" required="yes" installGroups="Application Core">
...
In the specs/AntActionsSpec.xml file, I have the following:
<pack name="test_app">
<antcall order="beforepacks" quiet="no" verbose="yes" buildfile="$INSTALL_PATH/ant-tasks.xml">
<property name="INSTALL_PATH" value="$INSTALL_PATH" />
<target name="touch_beforepacks" />
</antcall>
</pack>
And the ant-tasks.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<project>
<target name="touch_beforepacks">
<touch file="$INSTALL_PATH/beforepacks.txt"/>
</target>
</project>
Nothing special here, just creating a dumb file.
The ant-tasks.xml is unpacked right before anyone else. Everything builds with no error, even if I create one "mistake" at AntActionsSpec or ant-tasks.xml, what suggests me that they aren't even been loaded, though if I mess with the path where the definitions file has them, the build will fail.
I would like some help addressing that. I'm probably making some stupid little error and just can't see it by myself. If any of you could provide an example of a running build, that would be sweet.
If I can give any more information, please, let me known so I can update the question.
Thank you very much.
Just found it using a forum on a Google Groups discussion: [izpack-user] Quick question on variable substitution.
Unfortunattly the I will conclude that the docs are misleading. The docs in
"AntActionInstallerListener and AntActionUninstallerListener" until this date are stating that I should use this listener configuration:
<listeners>
<listener classname="AntActionInstallerListener" stage="install" />
<listener classname="AntActionUninstallerListener" stage="uninstall" />
</listeners>
That is what is up there, in the question. Comparing my XML code with the one in the Google Groups discussion, I found a different use of it:
<listeners>
<listener installer="AntActionInstallerListener"
uninstaller="AntActionUninstallerListener" />
</listeners>
In fact, that is the instruction given in the other wiki: Ant Actions (InstallerListener and UninstallerListener), what points out that I something can be wrong under the hood, but that is a story to another episode.
That just works. The Ant tasks are executed properly. :)
I just could not find where freaking Codehaus will allow me to grab a login and edit the docs wiki. >:( . If someone could endorse-me with some testing and then adjust the wiki for future happiness or just give a link to this tired programmer, I'd be happy.

How to work with AndroidManifest and Assembly

Base on Xamarin Studio instruction, I follow it to create the AndroidManifest which looks as below.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1"
android:versionName="1.0"
package="HelloMultiScreen.HelloMultiScreen">
<uses-sdk />
<application android:label="HelloMultiScreen">
<application>
<manifest>
I have these questions:
1) How come it DOES NOT list out all the control or widget like the google manifest?
2) Do I need to edit it whenever I add additional control or widget like textView ?
3) Do I need to care about the order of the control or widget of which I add first or later?
4) Do I need to manually add the below or it is self generated?
[assembly: UsesPermission(Manifest.Permission.AccessFineLocation)]
[assembly: UsesPermission(Manifest.Permission.AccessCoarseLocation)]
thanks
Quite a lot of your questions are answered in this page - http://docs.xamarin.com/guides/android/advanced_topics/working_with_androidmanifest.xml
In general, Xamarin auto-generates much of the file for you, using hints in the code like [Activity] attributes.
I recommend you read that document above, experiment a little and then come back here if you have specific questions/problems.

NLog internal log not working with ASP.Net MVC

I have a problem with NLog for logging its internal logs with this configuration
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
throwExceptions="true"
internalLogFile="${basedir}/App_Data/NLog.log"
internalLogLevel="Trace">
<targets>
<target name="debug"
xsi:type="File"
fileName="${basedir}/App_Data/Site.log" />
</targets>
<rules>
<logger name="*"
writeTo="debug" />
</rules>
</nlog>
The target "debug" is working well, but the internalLogFile is only working if I set it for exemple to "D:/NLog.log".
Any idea why this happening?
You can't use layout renderers ${...} in the internalLogFile property. They are for a target's layout only:
<target layout="${...}" />
Try to use relative path like "..\App_Data\NLog.log"
Update NLog 4.6 enables some simple layouts.
The internalLogFile attribute needs to be set to an absolute path and the executing assembly needs to have permission to write to that absolute path.
The following worked for me.
Create a folder somewhere - e.g. the route of your c: drive, e.g. c:\logs
Edit the permissions of this folder and give full control to everyone
Set your nlog config: internalLogFile="C:\logs\nlog.txt"
Remember to clean up after yourself and not leave a directory with those sorts of permissions on
NLog ver. 4.6 add support for environment-variables like %appdata% or %HOME%, and using these basic layouts in internalLogFile=:
${currentdir}
${basedir}
${tempdir}
NLog ver. 4.7 also adds this:
${processdir}
See also: https://github.com/NLog/NLog/wiki/Internal-Logging
from this link I think the path is absolute

NLog throws configuration exception on all aspnet layout renderers

I have been working to set up NLog v2 on my ASP.NET MVC 3 application and it has worked very well so far. (I'm using the package from the offical nuGet repository) However, when I try to change the log layout to include any of the aspnet-* layout renderers, I get a configuration error. I've reduced the problem to the following minimum use case:
In the configSections block:
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
The Nlog block:
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" throwExceptions="true">
<variable name="logDirectory" value="C:\Logs" />
<targets>
<target name="logFile" xsi:type="File" fileName="${logDirectory}\app.log"
layout="${aspnet-user-identity}" />
</targets>
<rules>
<logger name="*" minlevel="Info" writeTo="logfile" />
</rules>
If I change layout use any combination of renderers that are not part of the aspnet* family, this works well (I haven't tested every one, but I've looked at quite a few). The error I get is here:
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: An error occurred creating the configuration section handler for nlog: Exception occurred when loading configuration from C:\..[snip]..\web.config
Source Error:
Line 16: </configSections>
Line 17:
Line 18: <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
Line 19: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" throwExceptions="true">
Line 20:
I have really no idea what's going on. I'm not sure what about that renderer causes the configuration to become invalid. I've been banging around at it most of the day and have gotten nowhere, so I'm hoping someone here can help.
Thank you!
Make sure you have referenced the NLog.Extended assembly which is where those layouts are defined and which must have been added by the NuGet package as well to the references:
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
throwExceptions="true">
<extensions>
<add assembly="NLog.Extended" />
</extensions>
<variable name="logDirectory" value="C:\Logs" />
<targets>
<target name="logFile"
xsi:type="File"
fileName="${logDirectory}\app.log"
layout="${aspnet-user-identity} ${message}" />
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="logfile" />
</rules>
</nlog>
As of NLog 4.0 the ASP.NET renderes are now in Nlog.Web
http://nlog-project.org/2015/06/13/NLog-Extended_NLog-Web_and_NLog-Windows-Forms.html
Alternative solution if Darin's doesn't work
You must have NLog.Extended referenced as Darin mentions
http://nuget.org/packages/NLog.Extended
As of NLog 2.0 you do not need to add reference in the configuration XML.
My problem was that I had no hard references to NLog.Extended in my web layer (where my web.config is) so the compiler wasn't copying the file where it needed to be.
This can be easily fixed by adding a hard reference to NLog.Extended that is a no-op wherever you are configuring your logging:
//forces the compiler to include NLog.Extensions in all downstream output directories
private static AspNetApplicationValueLayoutRenderer blank = new AspNetApplicationValueLayoutRenderer();
In my case I was using extension of le_nlog and for a reason, it was not installed in the app !
so I installed *le_nlog* by doing so :
PM> Install-Package le_nlog

Resources