5
我正在首次構建一個使用EclipseLink的新應用程序。添加轉換器的EclipseLink會間歇性地導致ValidationException
一切都還好,直到我添加了一個使用JSR310 Instant的實體作爲時間戳列。
所以我創建了一個轉換器類,並將其映射到相關的領域,像這樣:
@Convert(converter = JSR310InstantTypeConverter.class)
private Instant pwdChangeCodeExpiresOn = null;
但是因爲我補充說,轉換器的應用程序已經開始拋出以下異常:
SEVERE: Servlet.service() for servlet [APIJerseyServlet] in context with path [/Sclera] threw exception [org.glassfish.jersey.server.ContainerException: java.lang.ExceptionInInitializerError] with root cause
Local Exception Stack:
Exception [EclipseLink-7351] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.ValidationException
Exception Description: The converter class [com.sclera.utils.JSR310InstantTypeConverter] specified on the mapping attribute [pwdChangeCodeExpiresOn] from the class [com.sclera.entity.Admin] was not found. Please ensure the converter class name is correct and exists with the persistence unit definition.
at org.eclipse.persistence.exceptions.ValidationException.converterClassNotFound(ValidationException.java:2317)
at org.eclipse.persistence.internal.jpa.metadata.converters.ConvertMetadata.process(ConvertMetadata.java:248)
這將在代碼更改(Eclipse重新啓動服務器時)後開始發生。我必須手動停止並啓動(和/或重新啓動)服務器幾次,直到它再次開始工作。然後,它會正常工作,直到代碼更改或兩次後,它將再次開始拋出異常。
這是一個巨大的痛苦。任何人都知道原因以及如何解決它?
似乎我們在閱讀錯誤消息之前去Google了......我也這樣做了。在我們的防守中,異常嘔吐很長。 – Fuhrmanator