Портлет Spring MVC неправильно развертывается в среде glassfish-webspace: java.lang.IllegalArgumentException
У меня настоящая странная проблема при попытке развернуть мой портлет.
Ошибка, показанная в журнале:
Context initialization failed
java.lang.IllegalArgumentException: class myPackage.SqlTimestampPropertyEditor is not assignable to interface java.beans.PropertyEditor
at org.springframework.util.Assert.isAssignable(Assert.java:368)
at org.springframework.util.Assert.isAssignable(Assert.java:351)
at org.springframework.beans.factory.config.CustomEditorConfigurer.postProcessBeanFactory(CustomEditorConfigurer.java:199)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:681)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:664)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:446)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
Это мой редактор недвижимости:
package myPackage;
import myPackage.util.Util;
import java.beans.PropertyEditorSupport;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
public class SqlTimestampPropertyEditor extends PropertyEditorSupport {
public static final String TIMESTAMP_BATCH_PATTERN = "yyyy-MM-dd HH:mm:ss.SSS";
private final SimpleDateFormat sdf;
/**
* uses default pattern yyyy-MM-dd for date parsing.
*/
public SqlTimestampPropertyEditor() {
this.sdf = new SimpleDateFormat(SqlTimestampPropertyEditor.TIMESTAMP_BATCH_PATTERN);
}
/**
* Uses the given pattern for dateparsing, see {@link SimpleDateFormat} for
* allowed patterns.
*
* @param pattern the pattern describing the date and time format
* @see SimpleDateFormat#SimpleDateFormat(String)
*/
public SqlTimestampPropertyEditor(SimpleDateFormat dateFormat) {
this.sdf = dateFormat;
}
/**
* @see java.beans.PropertyEditorSupport#setAsText(java.lang.String)
*/
@Override
public final void setAsText(String text) throws IllegalArgumentException {
try {
if (!Util.emptyString(text)) {
setValue(new Timestamp(this.sdf.parse(text).getTime()));
}
} catch (ParseException ex) {
throw new IllegalArgumentException("Non se pudo parsear o timestamp: " + ex.getMessage(), ex);
}
}
/**
* Format the Timestamp as String, using the specified DateFormat.
*/
@Override
public final String getAsText() {
Timestamp value = (Timestamp) getValue();
return (value != null ? this.sdf.format(value) : "");
}
}
Самое странное, что это иногда случается, и это решается само собой, а в журнале говорится "Сообщение PortalPack: успешно развернуто". но я не могу добавить портлет в веб-пространство, хотя я вижу его развернутым в консоли glassfish.
это не имеет никакого смысла для меня, и я очень признателен за любую помощь в этом вопросе... Заранее спасибо!