replacing umbraco TinyMCE spellchecker causing log4net issues - tinymce

There is a known issue with the TinyMCE spellchecker in umbraco which I am trying to resolve: http://issues.umbraco.org/issue/U4-2060
While attempting to install the recommended replacement solution HunSpellChecker(http://our.umbraco.org/projects/backoffice-extensions/hunspellchecker). I get a different error entirely on trying to use it:
<html> <head> <title>Could not load file or assembly 'log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.</title> <meta name="viewport" content="width=device-width" /> <style> body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } #media screen and (max-width: 639px) { pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; } } #media screen and (max-width: 479px) { pre { width: 280px; } } </style> </head> <body bgcolor="white"> <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1> <h2> <i>Could not load file or assembly 'log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.</i> </h2></span> <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "> <b> Description: </b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. <br><br> <b> Exception Details: </b>System.IO.FileNotFoundException: Could not load file or assembly 'log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.<br><br> <b>Source Error:</b> <br><br> <table width=100% bgcolor="#ffffcc"> <tr> <td> <code> An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</code> </td> </tr> </table> <br> <b>Assembly Load Trace:</b> The following information can be helpful to determine why the assembly 'log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=null' could not be loaded.<br><br> <table width=100% bgcolor="#ffffcc"> <tr> <td> <code><pre> WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. </pre></code> </td> </tr> </table> <br> <b>Stack Trace:</b> <br><br> <table width=100% bgcolor="#ffffcc"> <tr> <td> <code><pre> [FileNotFoundException: Could not load file or assembly 'log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.] Usc.Plugins.HunSpellChecker.HunSpellChecker..cctor() +0 [TypeInitializationException: The type initializer for 'Usc.Plugins.HunSpellChecker.HunSpellChecker' threw an exception.] Usc.Plugins.HunSpellChecker.HunSpellChecker..ctor() +0 [TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +113 System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +232 System.Activator.CreateInstance(Type type, Boolean nonPublic) +83 System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1136 System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +128 System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +18 System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +60 System.Web.Configuration.HandlerFactoryCache..ctor(String type) +46 System.Web.HttpApplication.GetFactory(String type) +86 System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +262 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155 </pre></code> </td> </tr> </table> <br> <hr width=100% size=1 color=silver> <b>Version Information:</b> Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18045 </font> </body> </html> <!-- [FileNotFoundException]: Could not load file or assembly 'log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. at Usc.Plugins.HunSpellChecker.HunSpellChecker..cctor() [TypeInitializationException]: The type initializer for 'Usc.Plugins.HunSpellChecker.HunSpellChecker' threw an exception. at Usc.Plugins.HunSpellChecker.HunSpellChecker..ctor() [TargetInvocationException]: Exception has been thrown by the target of an invocation. at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) at System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) at System.Web.Configuration.HandlerFactoryCache..ctor(String type) at System.Web.HttpApplication.GetFactory(String type) at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) -->
I installed the 0.2.0 version of hunspellchecker as this site is running umbraco 4.7.1 I attempted to find and install a log4net package and the error message was similar but changed slightly for the second sentence to: The located assembly's manifest definition does not match the assembly reference.
I believe somewhere there may be a reference to 1.2.11.0 that I need to change to 1.2.10.0 but I do not see where any such reference is occurring.
What must I change to get log4net to load correctly?

I guess its expecting version 1.2.11.0 as that's the version distributed with the later versions of Umbraco - and the one the plugin was built against.
You could always try getting the 1.2.11.0 DLL from a later version of Umbraco and using that. I doubt there would be issues in compatibility with using the later version?
Alternately you could try a binding redirect in the web.config file. e.g. I think you would need something like
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="" />
<bindingRedirect oldVersion="1.2.0.0-1.3.0.0" newVersion="1.2.10.0" />
</dependentAssembly>
(I used the free JetBrains DotPeek to find the publicKeyToken and it says its null - so I assume "" will do?)

Related

Why am I getting an error when trying to call a post webservice with flutter chopper library?

I am trying to pass a few parameters to a web service through flutter chopper library which is otherwise working fine but returns error with flutter chopper. Here is the code.
//This is the chopper client class code
import 'dart:typed_data';
import 'package:chopper/chopper.dart';
import 'package:flutter/cupertino.dart';
part "staff_webservice.chopper.dart";
#ChopperApi(baseUrl: "/StaffWebservice.asmx")
abstract class StaffWebService extends ChopperService {
#Post(path:"/StaffLogin",headers: {
"Content-Type": "application/x-www-form-urlencoded"
})
Future<Response> login(
#Field("UserName") String UserName,
#Field("Password") String Password,
#Field("DOB") String DOB,
);
static StaffWebService create() {
final client = ChopperClient(
baseUrl: "http://epunjabschool.gov.in/Webservice",
services: [
_$StaffWebService()
],
converter: JsonConverter(),
);
return _$StaffWebService(client);
}
}
Here is the generated class code.
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'staff_webservice.dart';
// **************************************************************************
// ChopperGenerator
// **************************************************************************
class _$StaffWebService extends StaffWebService {
_$StaffWebService([ChopperClient client]) {
if (client == null) return;
this.client = client;
}
final definitionType = StaffWebService;
Future<Response> login(String UserName, String Password, String DOB) {
final $url = '/StaffWebservice.asmx/StaffLogin';
final $headers = {'Content-Type': 'application/x-www-form-urlencoded'};
final $body = {'UserName': UserName, 'Password': Password, 'DOB': DOB};
final $request =
Request('POST', $url, client.baseUrl, body: $body, headers: $headers);
return client.send<dynamic, dynamic>($request);
}
}
And this is how I am trying to call this method but I am always getting an error.
try {
final response = await staffWebService.login(
"8146166001","gurjot85","15-sep-1985");
print(response.body.toString());
setState(() {
});
}
catch(error)
{
}
This is the error:
<!DOCTYPE html>
<html>
<head>
<title>Only Web services with a [ScriptService] attribute on the class definition can be called from script.</title>
<meta name="viewport" content="width=device-width" />
<style>
body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}
.marker {font-weight: bold; color: black;text-decoration: none;}
.version {color: gray;}
.error {margin-bottom: 10px;}
.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
#media screen and (max-width: 639px) {
pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }
}
#media screen and (max-width: 479px) {
pre { width: 280px; }
}
</style>
</head>
<body bgcolor="white">
<span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>
<h2> <i>Only Web services with a [ScriptService] attribute on the class definition can be called from script.</i> </h2></span>
<font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">
<b> Description: </b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
<br><br>
<b> Exception Details: </b>System.InvalidOperationException: Only Web services with a [ScriptService] attribute on the class definition can be called from script.<br><br>
<b>Source Error:</b> <br><br>
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code>
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</code>
</td>
</tr>
</table>
<br>
<b>Stack Trace:</b> <br><br>
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code><pre>
[InvalidOperationException: Only Web services with a [ScriptService] attribute on the class definition can be called from script.]
System.Web.Script.Services.WebServiceData..ctor(Type type, Boolean pageMethods) +719604
System.Web.Script.Services.WebServiceData.GetWebServiceData(HttpContext context, String virtualPath, Boolean failIfNoData, Boolean pageMethods, Boolean inlineScript) +301
System.Web.Script.Services.RestHandler.CreateHandler(HttpContext context) +136
System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +89
System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +516
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288
</pre></code>
</td>
</tr>
</table>
<br>
<hr width=100% size=1 color=silver>
<b>Version Information:</b> Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34009
</font>
</body>
</html>
<!--
[InvalidOperationException]: Only Web services with a [ScriptService] attribute on the class definition can be called from script.
at System.Web.Script.Services.WebServiceData..ctor(Type type, Boolean pageMethods)
at System.Web.Script.Services.WebServiceData.GetWebServiceData(HttpContext context, String virtualPath, Boolean failIfNoData, Boolean pageMethods, Boolean inlineScript)
at System.Web.Script.Services.RestHandler.CreateHandler(HttpContext context)
at System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)
at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
--><!--
This error page might contain sensitive information because ASP.NET is configured to show verbose error messages using <customErrors mode="Off"/>. Consider using <customErrors mode="On"/> or <customErrors mode="RemoteOnly"/> in production environments.-->

Why Does My FAMILY Query Fail?

Please have a look at the following code wherein I have a method that searches by family name and another that searches by system. Following the code I have provided the results that were produced by invoking each of these two methods. You can see that the system search returned three patients, the third one having the family name Vaessen. But, when I search for the family name Vaessen a timeout results. Would someone please help me to understand why this is happening?
Note: As you can see from the timeout exception, I am querying the public fhir server http://fhirtest.uhn.ca/baseDstu3
public void findPatientsInFamily(String family) {
System.out.printf("\n\nFinding patients in family %s\n", family);
findPatients(Patient.FAMILY.matches().value(family));
}
public void findPatientsInSystem(String system) {
System.out.printf("\n\nFinding patients in system %s\n", system);
findPatients(Patient.IDENTIFIER.hasSystemWithAnyCode(system));
}
#SuppressWarnings("rawtypes")
public void findPatients(ICriterion criterion) {
try {
Bundle bundle = client.search().forResource(Patient.class).where(criterion).returnBundle(Bundle.class).execute();
for (BundleEntryComponent entry : bundle.getEntry()) {
if (entry.getResource().getResourceType() == ResourceType.Patient) {
Patient patient = (Patient) entry.getResource();
System.out.printf("%s\n", parser.encodeResourceToString(patient));
}
}
}
catch(Exception e) {
System.out.printf("Cannot find patients\n%s\n", e.getMessage());
}
}
Results for the findPatientsInSystem(String system) method:
Finding patients in system http://dmw.levy.com/mrn
<Patient xmlns="http://hl7.org/fhir">
<id value="4172808"></id>
<meta>
<versionId value="1"></versionId>
<lastUpdated value="2018-06-07T14:10:52.336+00:00"></lastUpdated>
</meta>
<text>
<status value="generated"></status>
<div xmlns="http://www.w3.org/1999/xhtml">
<div class="hapiHeaderText">Rachael
<b>LANEHART </b>
</div>
<table class="hapiPropertyTable">
<tbody>
<tr>
<td>Identifier</td>
<td>12345</td>
</tr>
<tr>
<td>Date of birth</td>
<td>
<span>30 December 1985</span>
</td>
</tr>
</tbody>
</table>
</div>
</text>
<identifier>
<system value="http://dmw.levy.com/mrn"></system>
<value value="12345"></value>
</identifier>
<name>
<family value="Lanehart"></family>
<given value="Rachael"></given>
</name>
<gender value="female"></gender>
<birthDate value="1985-12-30"></birthDate>
</Patient>
<Patient xmlns="http://hl7.org/fhir">
<id value="4149602"></id>
<meta>
<versionId value="1"></versionId>
<lastUpdated value="2018-06-06T20:52:11.831+00:00"></lastUpdated>
</meta>
<text>
<status value="generated"></status>
<div xmlns="http://www.w3.org/1999/xhtml">
<div class="hapiHeaderText">Ravi
<b>THAKKAR </b>
</div>
<table class="hapiPropertyTable">
<tbody>
<tr>
<td>Identifier</td>
<td>12345</td>
</tr>
<tr>
<td>Date of birth</td>
<td>
<span>14 April 1962</span>
</td>
</tr>
</tbody>
</table>
</div>
</text>
<identifier>
<system value="http://dmw.levy.com/mrn"></system>
<value value="12345"></value>
</identifier>
<name>
<family value="Thakkar"></family>
<given value="Ravi"></given>
</name>
<gender value="male"></gender>
<birthDate value="1962-04-14"></birthDate>
</Patient>
<Patient xmlns="http://hl7.org/fhir">
<id value="4013201"></id>
<meta>
<versionId value="1"></versionId>
<lastUpdated value="2018-06-01T18:30:23.902+00:00"></lastUpdated>
</meta>
<text>
<status value="generated"></status>
<div xmlns="http://www.w3.org/1999/xhtml">
<div class="hapiHeaderText">Robert Jozef
<b>VAESSEN </b>
</div>
<table class="hapiPropertyTable">
<tbody>
<tr>
<td>Identifier</td>
<td>12345</td>
</tr>
<tr>
<td>Date of birth</td>
<td>
<span>30 January 1954</span>
</td>
</tr>
</tbody>
</table>
</div>
</text>
<identifier>
<system value="http://dmw.levy.com/mrn"></system>
<value value="12345"></value>
</identifier>
<name>
<family value="Vaessen"></family>
<given value="Robert"></given>
<given value="Jozef"></given>
</name>
<gender value="male"></gender>
<birthDate value="1954-01-30"></birthDate>
</Patient>
Results for the findPatientsInFamily(String family) method:
Finding patients in family Vaessen
Cannot find patients
Failed to parse response from server when performing GET to URL http://fhirtest.uhn.ca/baseDstu3/Patient?family=Vaessen - java.net.SocketTimeoutException: Read timed out
The way in which your code queries the FHIR Server should be fine for a Patient search by system or family name.
I tried the public test server through the UI at http://fhirtest.uhn.ca/ and everything appears to be down currently. Every request returns an error. There is already an issue posted here on GIT https://github.com/jamesagnew/hapi-fhir/issues/998.
It is also possible that when the server is back up, there may be so much patient data that your request will still error unless a large connection timeout is set, or more filter criteria is provided.

How do I use form beans in Spring MVC?

I'm new to Spring MVC (3.1.1). Coming from a Rails and Struts1 world that is.
In Struts, our FormBeans automatically map to our controllers. For example:
# JS file
ExtJS.ajax({action:'update', value:42});
Then our controller can:
bean.getAction(); // 'update'
bean.getValue(); // 42
We instantiate the bean like:
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
MyBean bean = (MyBean) form;
....
}
Please forgive my ignorance, but how would I do the same thing in Spring MVC?
In jsp do something like this :
<%# taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<form:form name="frmFoo" id="frmFoo" action="/FormSubmitUrl" method="POST" modelAttribute="foo">
<form:select path="myField">
<form:errors path="myField" />
</form:form>
And just add the backing object to the model in your controller method :
#RequestMapping(value = "/MyFooForm", method = RequestMethod.GET)
public String getFoo(final Model model)
{
model.addAttribute("foo", foo);
return "fooForm.jsp";
}
Am going from, Spring MVC - Rails. I like Rails lot better :-). There are lot of start up tutorials for Spring MVC. But spring has a good tutorial that you can follow. But to begin with you will have to start with the spring-dispatch-servlet.xml. There you will define your association between views, controller and form. For example in this following snippet:
<bean name="/priceincrease.htm" class="springapp.web.PriceIncreaseFormController">
<property name="sessionForm" value="true"/>
<property name="commandName" value="priceIncrease"/>
<property name="commandClass" value="springapp.service.PriceIncrease"/>
<property name="validator">
<bean class="springapp.service.PriceIncreaseValidator"/>
</property>
<property name="formView" value="priceincrease"/>
<property name="successView" value="hello.htm"/>
<property name="productManager" ref="productManager"/>
</bean
Controller is the PriceIncreaseFormController and the priceIncrease is the equivalent command object. The corresponding view i.e. JSP will have
<form:form method="post" commandName="priceIncrease">
<table width="95%" bgcolor="f8f8ff" border="0" cellspacing="0" cellpadding="5">
<tr>
<td align="right" width="20%">Increase (%):</td>
<td width="20%">
<form:input path="percentage"/>
</td>
<td width="60%">
<form:errors path="percentage" cssClass="error"/>
</td>
</tr>
</table>
But I think you might get a complete picture from this place where I picked up the code from
http://static.springsource.org/docs/Spring-MVC-step-by-step/part4.html#step4.5 and the place where you can get Spring MVC's example code base is https://src.springframework.org/svn/spring-samples/mvc-basic
I was looking for this answer today based on some code in a project I inherited. What I found was that the if you create a controller action on a multiActionController. The form values can be mapped to a bean that would be the third paarameter on your handler action.
In my case I had a controller like this
public void submit(HttpServletRequest request,
HttpServletResponse response, SomeBean sb) {
{
//do something with sb - SomeBean
}
My issue was in figuring out how the values in my form were mapped to the controller action. There was no reference at all to the SomeBean within my jsp form. As it turns out Spring works the magic based on the controller action parameters and the names used in the form. It basically maps the values in the form to a bean that is used as the third parameter in the action method.
For example my SomeBean has some fields named byday and bymonth. It also has the corresponding byday and bymonth setters and getters (i.e. getBymonth(), setBymonth). In my for my submit action is mapped on submit and I have input values for byday and by month like so:
<select id="weekly_option" name="byday">
<option value="MON">Monday</option>
<option value="TUE">Tuesday</option>
<option value="WED">Wednesday</option>
<option value="THU">Thursday</option>
<option value="FRI">Friday</option>
<option value="SAT">Saturday</option>
<option value="SUN">Sunday</option>
</select>
I had to do some digging on how exactly the mappings were being done. I peeked into the MultiActionController source code to see that if does the following:
The controller figures out if you have a third parameter in your action (it must not be of the type HttpSession).
The MultiActionController then news up an instance of the third parameter (SomeBean). Based on the http request values it pushes over all the values from the HttpServleRequest over to the SomeBean object.
At this point it seems like it only works with properties that are strings. I imagine that you would have to extend MVC somehow if you wanted to work with properties other than strings within your bean.

Spring form:radiobuttons : map<Object, Enum>: reference key in radiobutton-path in order to set value?

I have a Map<Course, Role> courses belonging to the command object user and I want to select a role from roles[enum array] = Role.values for each course in the keyset. I populate the entries with all the courses I want and a default role and put this in the user in the model. Below is my form, but I can't figure out how to refer to the key (which is "course") for the map
<form:form method="POST" commandName="user">
<table>
<tr>
<td>User Name:</td>
<td><form:input path="name" /></td>
</tr>
<c:forEach var="course" items="${courseChoices}">
<tr>
<form:radiobuttons path="courses['${course}']" items="${roles}"/>
</tr>
</c:forEach>
</table>
<input type="submit" value="save changes">
<form:errors path="*" />
</form:form>
I have a propertyeditor bound to convert Course to String and back, which simply uses the entity id.
I am getting
InvalidPropertyException:
Invalid property 'courses[com.example.app.Course#7]' of bean class [com.example.app.User]:
Invalid index in property path 'courses[com.example.app.Course#7]';
nested exception is org.springframework.beans.TypeMismatchException:
Failed to convert property value of type 'java.lang.String' to required type 'com.example.app.Course' for property 'null';
nested exception is java.lang.NumberFormatException: For input string: "com.example.app.Course#7"
I don't know what is null, because I can see the Course with id 7 in my database.
Fundamentally, what is evaluating the path attribute and how does it understand the jsp context? Is this Spring expression language? I've been looking for resources to figure out how to pick values for my map keys from my set of roles, but I haven't found much.
I suppose you have a getter getId() or something similar in courses so instead of path="courses['${course}']" in the radiobuttons tag write path="courses['${course.id}']" (or course.whateverTheIdIsCalled for an id getter getWhateverTheIdIsCalled())

hibernate class not found exception

before reading my problem this work in a normal dynamic web project
i create a web service like this methode:
http://www.youtube.com/watch?v=o2Vjs8ylmFM
using CFX 2.4 and with the 2.5 dynamic web model version and when i run hibernate in this current client web project generated by the web service i get an exception
this is it:
Etat HTTP 500 -
--------------------------------------------------------------------------------
type Rapport d''exception
message
description Le serveur a rencontré une erreur interne () qui l'a empêché de satisfaire la requête.
exception
org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.ExceptionInInitializerError
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:531)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
cause mère
javax.servlet.ServletException: java.lang.ExceptionInInitializerError
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:901)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:830)
org.apache.jsp.index_jsp._jspService(index_jsp.java:112)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
cause mère
java.lang.ExceptionInInitializerError
org.apache.jsp.index_jsp._jspService(index_jsp.java:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
cause mère
java.lang.RuntimeException: Problème de configuration : persistent class not found
Base.HibernateUtil.<clinit>(HibernateUtil.java:16)
org.apache.jsp.index_jsp._jspService(index_jsp.java:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
cause mère
net.sf.hibernate.MappingException: persistent class not found
net.sf.hibernate.cfg.Binder.bindClass(Binder.java:76)
net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:165)
net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1095)
net.sf.hibernate.cfg.Configuration.add(Configuration.java:230)
net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252)
net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:841)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:792)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:732)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:719)
Base.HibernateUtil.<clinit>(HibernateUtil.java:14)
org.apache.jsp.index_jsp._jspService(index_jsp.java:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
cause mère
java.lang.ClassNotFoundException: Favorieensei
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1671)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:169)
net.sf.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:268)
net.sf.hibernate.cfg.Binder.bindClass(Binder.java:73)
net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:165)
net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1095)
net.sf.hibernate.cfg.Configuration.add(Configuration.java:230)
net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:252)
net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:273)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:841)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:792)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:732)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:719)
Base.HibernateUtil.<clinit>(HibernateUtil.java:14)
org.apache.jsp.index_jsp._jspService(index_jsp.java:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
note La trace complète de la cause mère de cette erreur est disponible dans les fichiers journaux de Apache Tomcat/7.0.5.
--------------------------------------------------------------------------------
Apache Tomcat/7.0.5
and my class hibernateUtil is :
package DBase;
import net.sf.hibernate.*;
import net.sf.hibernate.cfg.*;
public class HibernateUtil {
private static final SessionFactory sessionFactory;
static {
try {
// Crée la SessionFactory
sessionFactory =
new Configuration().configure().buildSessionFactory();
} catch (HibernateException ex) {
throw new RuntimeException("Problème de configuration : "
+ ex.getMessage(), ex);
}
}
public static final ThreadLocal session = new ThreadLocal();
public static Session currentSession()
throws HibernateException {
Session s = (Session) session.get();
// Ouvre une nouvelle Session, si ce Thread n'en a aucune
if (s == null) {
s = sessionFactory.openSession();
session.set(s);
}
return s;
}
and my hibernate.cfg.xml page is:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory >
<!-- local connection properties -->
<property name="hibernate.connection.url">jdbc:mysql://localhost/ebook</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">162826</property>
<!-- property name="hibernate.connection.pool_size"></property -->
<!-- dialect for MySQL -->
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<property name="current_session_context_class">thread</property>
<mapping resource="DBase/Favorieensei.hbm" />
<mapping resource="DBase/Ajouter.hbm" />
<mapping resource="DBase/Favorie.hbm" />
<mapping resource="DBase/Enseignant.hbm" />
and this is my page jsp
<%#page import="DBase.HibernateUtil"%>
<%# page import="java.io.*" %>
<%# page import="java.util.*" %>
<%# page import="DBase.*" %>
<%# page import="net.sf.hibernate.*" %>
<%# page import="net.sf.hibernate.cfg.*" %>
<HTML>
<HEAD>
<title>Greetings!</title>
</HEAD>
<BODY>
<%
Session hibernateSession = HibernateUtil.currentSession();
Transaction tx = hibernateSession.beginTransaction();
Etudinat etudiant = new Etudinat();
etudiant.setUserName("davido");
etudiant.setPassword("mioo");
etudiant.setQuestion("best music");
etudiant.setAnswer("rock");
etudiant.setEmail("david#live.fr");
etudiant.setNom(".....");
etudiant.setPrenom("....");
etudiant.setSexe("Homme");
etudiant.setIDFilliere(Filliere.INFORMATIQUE);
hibernateSession.save(etudiant);
tx.commit();
HibernateUtil.closeSession();
%>
<br>
<br>
<br>
<br>
<table width="400" border="0" cellspacing="1" cellpadding="0" align="center" class="tableBox">
<tr>
<td CLASS="bluebanner" align="center"> Greetings, </TD>
</tr>
</table>
</BODY>
</HTML>
this is my screan shot
plz help us we are running on time i have 3 left to finish it
The stack trace clearly states that class Favorieensei is missing. You need to check your project structure.