I am working with NVelocity, I developed a project with C# and I download the sources of Nvelocity, I referenced Nvelocity Project in my C# project. When I execute my solution, i have this error :
"It appears that no class was specified as the ResourceManager. Please ensure that all configuration information is correct."
this is the method where i obtain the error :
private void initializeResourceManager() {
/*
* Which resource manager?
*/
if (rm != null && rm.Length > 0) {
/*
* if something was specified, then make one.
* if that isn't a ResourceManager, consider
* this a huge error and throw
*/
System.Object o = null;
//UPGRADE_NOTE: Exception 'java.lang.ClassNotFoundException' was converted to ' ' which has different behavior. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1100"'
try {
//UPGRADE_TODO: Format of parameters of method 'java.lang.Class.forName' are different in the equivalent in .NET. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1092"'
Type rmType = System.Type.GetType(rm);
o = System.Activator.CreateInstance(rmType);
} catch (System.Exception cnfe) {
System.String err = "The specified class for Resourcemanager (" + rm + ") does not exist (or is not accessible to the current classlaoder.";
error(err);
throw new System.Exception(err);
}
if (!(o is ResourceManager)) {
System.String err = "The specified class for ResourceManager (" + rm + ") does not implement org.apache.runtime.resource.ResourceManager." + " Velocity not initialized correctly.";
System.String err = "It appears that no class was specified as the" + " ResourceManager. Please ensure that all configuration" + " information is correct.";
error(err);
throw new System.Exception(err);
}
}
Somebody have a solution for this problem please.
Thank you
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I am working with NVelocity, I developed a project with C# and I download the sources of Nvelocity, I referenced Nvelocity Project in my C# project. When I execute my solution, i have this error :
"It appears that no class was specified as the ResourceManager. Please ensure that all configuration information is correct."
this is the method where i obtain the error :
private void initializeResourceManager() {
/*
* Which resource manager?
*/
System.String rm = getString(NVelocity.Runtime.RuntimeConstants_Fields.RESOURCE_MANAGER_CLASS);
if (rm != null && rm.Length > 0) {
/*
* if something was specified, then make one.
* if that isn't a ResourceManager, consider
* this a huge error and throw
*/
System.Object o = null;
//UPGRADE_NOTE: Exception 'java.lang.ClassNotFoundException' was converted to ' ' which has different behavior. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1100"'
try {
//UPGRADE_TODO: Format of parameters of method 'java.lang.Class.forName' are different in the equivalent in .NET. 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="jlca1092"'
Type rmType = System.Type.GetType(rm);
o = System.Activator.CreateInstance(rmType);
} catch (System.Exception cnfe) {
System.String err = "The specified class for Resourcemanager (" + rm + ") does not exist (or is not accessible to the current classlaoder.";
error(err);
throw new System.Exception(err);
}
if (!(o is ResourceManager)) {
System.String err = "The specified class for ResourceManager (" + rm + ") does not implement org.apache.runtime.resource.ResourceManager." + " Velocity not initialized correctly.";
error(err);
throw new System.Exception(err);
}
resourceManager = (ResourceManager) o;
resourceManager.initialize(this);
} else {
/*
* someone screwed up. Lets not fool around...
*/
System.String err = "It appears that no class was specified as the" + " ResourceManager. Please ensure that all configuration" + " information is correct.";
error(err);
throw new System.Exception(err);
}
}
Somebody have a solution for this problem please.
Thank you
Hi-
You need to initialize it with a set of properties, and normally you just need to tell it where the nvelocity.properties file is, e.g.
String absolutepath=@"D:\Path\To\nvelocity.properties";
Velocity.Init(absolutepath);
Cheers!
-Mike
Hello,
Thank you a lot for your response, I tryed your solution and it works.
cheers
Med