I have a class NotifyBuilderUtil, within which I am trying to create an object of another class CustomEmailNotification. However, while creating the object, I am getting an error:
java.lang.NoSuchMethodError: net.mail.CustomEmailNotification: method <init>()V not found
package org.module.definition.notify;
...
import net.mail.CustomEmailNotification;
...
public class NotifyBuilderUtil implements InitializingBean {
private static NotifyBuilderUtil instance;
public NotifyBuilderUtil() {
if(instance != null) throw new SingletonViolationException(NotifyBuilderUtil.class);
instance = this;
}
...
...
public static void buildElements(DefinableEntity entity, Element item, Notify notifyDef, Writer writer, NotifyVisitor.WriterType writerType, Map params, boolean processItem) {
...
String flagElementPath = "./notify";
Element flagElem = (Element) nextItem.selectSingleNode(flagElementPath);
Map oArgs = DefinitionUtils.getOptionalArgs(flagElem);
NotifyVisitor visitor = new NotifyVisitor(entity, notifyDef, customItem, writer, writerType, params);
CustomEmailNotification cen = new CustomEmailNotification();
cen.constructInternalWriter(entity, visitor, flagElem, oArgs);
...
}
}
The CustomEmailNotification :
public class CustomEmailNotification {
private static Map timeFieldMap = null;
public static Writer internalWriter = null;
public static Writer externalWriter = null;
Writer writer;
public CustomEmailNotification() {
timeFieldMap = new HashMap();
}
...
public static void constructInternalWriter(DefinableEntity entity, NotifyVisitor visitor, Element flagElement, Map oArgs) {
...
...
}
}
The error message is :
ERROR [http-8086-1] [org.kablink.teaming.spring.web.portlet.DispatcherPortlet] - Could not complete request
javax.portlet.PortletException: Error occured during request processing: net.mail.CustomEmailNotification: method <init>()V not found
at org.springframework.web.portlet.DispatcherPortlet.doActionService(DispatcherPortlet.java:662)
at org.springframework.web.portlet.FrameworkPortlet.processRequest(FrameworkPortlet.java:519)
at org.springframework.web.portlet.FrameworkPortlet.processAction(FrameworkPortlet.java:460)
at org.kablink.teaming.portletadapter.servlet.PortletAdapterController.handleRequestInternal(PortletAdapterController.java:105)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at org.kablink.teaming.portletadapter.servlet.PortletAdapterServlet.service(PortletAdapterServlet.java:74)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.kablink.teaming.web.servlet.filter.LoginFilter.doFilter(LoginFilter.java:155)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.kablink.teaming.web.servlet.filter.DefaultCharacterEncodingFilter.doFilter(DefaultCharacterEncodingFilter.java:60)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:278)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.basicauth.BasicProcessingFilter.doFilterHttp(BasicProcessingFilter.java:174)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.kablink.teaming.spring.security.LogoutFilter.doFilterHttp(LogoutFilter.java:73)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.kablink.teaming.asmodule.servlet.filter.ResponseHeaderFilter.doFilter(ResponseHeaderFilter.java:127)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.kablink.teaming.tomcat.valve.ZoneContextValve.invoke(ZoneContextValve.java:69)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:647)
at org.apache.catalina.valves.RequestFilterValve.process(RequestFilterValve.java:316)
at org.apache.catalina.valves.RemoteAddrValve.invoke(RemoteAddrValve.java:81)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NoSuchMethodError: net.mail.CustomEmailNotification: method <init>()V not found
at org.kablink.teaming.module.definition.notify.NotifyBuilderUtil.buildElements(NotifyBuilderUtil.java:203)
at org.kablink.teaming.module.definition.notify.NotifyBuilderUtil.buildElements(NotifyBuilderUtil.java:175)
at org.kablink.teaming.module.mail.impl.DefaultEmailFormatter.buildMessage(DefaultEmailFormatter.java:821)
at org.kablink.teaming.module.mail.MimeNotifyPreparator.prepare(MimeNotifyPreparator.java:334)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:352)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:344)
at org.kablink.teaming.module.mail.impl.MailModuleImpl.sendMail(MailModuleImpl.java:1139)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.kablink.teaming.module.interceptor.EventListenerManagerInterceptor.invoke(EventListenerManagerInterceptor.java:64)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.kablink.teaming.util.aopalliance.InvocationStatisticsInterceptor.invoke(InvocationStatisticsInterceptor.java:49)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at com.sun.proxy.$Proxy13.sendMail(Unknown Source)
at org.kablink.teaming.module.admin.impl.AbstractAdminModule.sendMail(AbstractAdminModule.java:1174)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.kablink.teaming.search.interceptor.IndexSynchronizationManagerInterceptor.invoke(IndexSynchronizationManagerInterceptor.java:67)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.kablink.teaming.module.interceptor.EventListenerManagerInterceptor.invoke(EventListenerManagerInterceptor.java:64)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.kablink.teaming.util.aopalliance.InvocationStatisticsInterceptor.invoke(InvocationStatisticsInterceptor.java:49)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at com.sun.proxy.$Proxy16.sendMail(Unknown Source)
at org.kablink.teaming.web.util.BinderHelper.sendMailOnEntryCreate(BinderHelper.java:3171)
at org.kablink.teaming.portlet.forum.ModifyEntryController.handleActionRequestAfterValidation(ModifyEntryController.java:202)
at org.kablink.teaming.web.portlet.SAbstractController.handleActionRequestInternal(SAbstractController.java:257)
at org.springframework.web.portlet.mvc.AbstractController.handleActionRequest(AbstractController.java:199)
at org.springframework.web.portlet.mvc.SimpleControllerHandlerAdapter.handleAction(SimpleControllerHandlerAdapter.java:64)
at org.springframework.web.portlet.DispatcherPortlet.doActionService(DispatcherPortlet.java:641)
... 70 more
I am not able to find a reason why this is happening. Can anybody can help me point out where I am going wrong?
I am using Apache Tomcat/6.0.35
JVM Version: 1.7.0_21-b11
(Answered in the comments. Converted to a community wiki answer. See Question with no answers, but issue solved in the comments (or extended in chat) )
The OP wrote:
The problem is fixed now. The error was due to SVN branching. In a separate branch, there is another java class EmailHelper.java within the same folder where CustomEmailNotification.java resides. So when I switched from that branch to my current one, I did not checkout that branch as I did not require the EmailHelper.java, hence the error. Just created a separate folder containing just CustomEmailNotification.java, and the error is gone. Thanks to all for taking their time in looking into this
Related
I have the following bean's code:
#ManagedBean
#SessionScoped
public class PlayersReportBean
private PlayerReportGeneratorList list = new PlayerReportGeneratorList();
public PlayerReportGeneratorList getList() {
return list;
}
}
public class PlayerReportGeneratorList extends
AbstractList<PlayerReportItem> {
private Integer pageSize;
private Integer currPage;
//GET, SET, OTHER STAFF
}
and markup:
<h:selectOneMenu value="#{playersReportBean.list.pageSize}">
<f:selectItems value="#{playersReportBean.rowsList}"/>
</h:selectOneMenu>
And I got the following exception:
java.lang.NumberFormatException: For input string: "pageSize"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:492)
at java.lang.Integer.parseInt(Integer.java:527)
at javax.el.ListELResolver.coerce(ListELResolver.java:163)
at javax.el.ListELResolver.getValue(ListELResolver.java:51)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at org.apache.el.parser.AstValue.getValue(AstValue.java:183)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:185)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
at javax.faces.component.UIOutput.getValue(UIOutput.java:170)
at javax.faces.component.UIInput.getValue(UIInput.java:284)
at com.sun.faces.renderkit.html_basic.MenuRenderer.getCurrentSelectedValues(MenuRenderer.java:647)
at com.sun.faces.renderkit.html_basic.MenuRenderer.renderOptions(MenuRenderer.java:748)
at com.sun.faces.renderkit.html_basic.MenuRenderer.renderSelect(MenuRenderer.java:843)
at com.sun.faces.renderkit.html_basic.MenuRenderer.encodeEnd(MenuRenderer.java:297)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:877)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:312)
at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185)
at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:129)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:847)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1778)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:847)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1778)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1781)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1781)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:452)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:286)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:277)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at ua.com.winforce.loto_partner.admin.filter.EncodingFilter.doFilter(EncodingFilter.java:14)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
What is the reason? Couldn't someone explain?
About the problem:jdk 7 doc
public class NumberFormatException extends IllegalArgumentException
Thrown to indicate that the application has attempted to convert a
string to one of the numeric types, but that the string does not have
the appropriate format.
Problem seems with your rowsList does not resolve for Integer, Verify this you are adding in right order i.e. rowsList.add(new SelectItem(ItemValue, ItemLabel));
MORE
How I do fill p:selectOneMenu
private List<SelectItem> rowsList= new ArrayList<>(); // Initilize
//Getter Setter
then fill from data base query;
void populateRowsList(){
rowsList=service.findAllRowsList(); // check for ItemValue,ItemLabel
}
I tried to write the following subqueries using hibernate:
I
Junction prototype = Restrictions.conjunction();
DetachedCriteria detachedCriteria = DetachedCriteria.forClass(RecipientRecipientGroup.class);
detachedCriteria.setProjection(Property.forName("recipientId"));
prototype.add(Property.forName("id").in(detachedCriteria));
and
II
Junction prototype = Restrictions.conjunction();
DetachedCriteria detachedCriteria = DetachedCriteria.forClass(RecipientRecipientGroup.class);
detachedCriteria.setProjection(Projections.property(getPlayerIdFieldName()));
prototype.add(Subqueries.in("id", detachedCriteria));
My mapping:
#Entity
#Table(name="mailing.recipient_recipient_group")
public class RecipientRecipientGroup {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
#Column(name = "id")
private int id;
#Column(name="recipient_group_id")
private int recipientGroupId;
#Column(name="recipient_id")
private int recipientId;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getRecipientGroupId() {
return recipientGroupId;
}
public void setRecipientGroupId(int recipientGroupId) {
this.recipientGroupId = recipientGroupId;
}
public int getRecipientId() {
return recipientId;
}
public void setRecipientId(int recipientId) {
this.recipientId = recipientId;
}
}
The thing is the first example works fine, but the second throws the following exception:
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
at org.hibernate.type.IntegerType.set(IntegerType.java:41)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:83)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:65)
at org.hibernate.loader.Loader.bindPositionalParameters(Loader.java:1698)
at org.hibernate.loader.Loader.bindParameterValues(Loader.java:1669)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1554)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2211)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
at org.hibernate.loader.Loader.list(Loader.java:2090)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:95)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:305)
at ua.com.winforce.online.admin.db.dao.PlayerDaoImpl.getRecipientCount(PlayerDaoImpl.java:358)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy73.getRecipientCount(Unknown Source)
at ua.com.winforce.online.admin.db.service.PlayerServiceImpl.getRecipientsCount(PlayerServiceImpl.java:352)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
at com.sun.proxy.$Proxy94.getRecipientsCount(Unknown Source)
at ua.com.winforce.casino.email.controller.MailingRecipientDynamicGroupListController.getDataList(MailingRecipientDynamicGroupListController.java:46)
at ua.com.winforce.casino.utils.controller.TableController$TableList.get(TableController.java:143)
at javax.faces.model.ListDataModel.getRowData(ListDataModel.java:151)
at javax.faces.model.ListDataModel.setRowIndex(ListDataModel.java:185)
at javax.faces.model.ListDataModel.setWrappedData(ListDataModel.java:219)
at javax.faces.model.ListDataModel.<init>(ListDataModel.java:78)
at org.richfaces.component.UISequence.createFacesModel(UISequence.java:91)
at org.richfaces.component.UISequence.createExtendedDataModel(UISequence.java:118)
at org.richfaces.component.UIDataTableBase.createExtendedDataModel(UIDataTableBase.java:211)
at org.richfaces.component.UIDataAdaptor.getExtendedDataModel(UIDataAdaptor.java:466)
at org.richfaces.component.UIDataAdaptor.getRowCount(UIDataAdaptor.java:517)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at javax.faces.component.UIComponentBase$AttributesMap.get(UIComponentBase.java:2344)
at org.richfaces.DataScrollerUtils.eval(DataScrollerUtils.java:86)
at org.richfaces.DataScrollerUtils.getRowCount(DataScrollerUtils.java:81)
at org.richfaces.event.DataTablePreRenderListener.processEvent(DataTablePreRenderListener.java:122)
at javax.faces.event.SystemEvent.processListener(SystemEvent.java:106)
at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2166)
at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2139)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:303)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:247)
at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:814)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:302)
at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185)
at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:129)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:847)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1778)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:847)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1778)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1781)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1781)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:452)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:286)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at ua.com.winforce.online.admin.http.filter.ReInitJSFSessionManagedBeanFilter.doFilter(ReInitJSFSessionManagedBeanFilter.java:44)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:277)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Couldn't someone explain that behavior?
Subqueries.in expects first parameter to be a literal object value to check. I.e. you create a subquery to filter results by "id" value, which is a mistake since you fetch a result set of integers. What you are looking for is probably Subqueries.propertyIn.
i want to store user feedback into this table
CREATE TABLE SITEWATCHER.HELPREQUESTS (
request_id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
customer_id INT(11) forgien key,
issue_type varchar(50),
phone_number numeric(10),
issue_description varchar(256),
date_created timestamp
);
in the model domain my setters and getters
#Column(name="PHONE_NUMBER", nullable = false)
private Number phoneNumber;
public Number getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(Number phoneNumber) {
this.phoneNumber = phoneNumber;
}
and in controller i am parsing phonenumber like this
helprequests.setPhoneNumber(Long.parseLong(phoneNumber.replaceAll( "[^\\d]", "" )));
while storing into DB I am getting the following stacktrace
May 24 11:34:06 ERROR ne.jdbc.spi.SqlExceptionHelper logExceptions || Incorrect decimal value: '\xAC\xED\x00\x05sr\x00\x0Ejava.lang.Long;\x8B\xE4\x90\xCC\x8F#\xDF\x02\x00\x01J\x00\x05valuexr\x00\x10java.lang.Number\x86\xAC\x' for column 'phone_number' at row 1
May 24 11:34:06 DEBUG itewatcher.web.LoginController saveUserHelp || org.hibernate.exception.GenericJDBCException: could not execute statement
org.hibernate.exception.GenericJDBCException: could not execute statement
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:112)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:190)
at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:96)
at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:58)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3032)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3556)
at org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:97)
at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:480)
at org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:191)
at org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:175)
at org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:210)
at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:324)
at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:288)
at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:194)
at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:125)
at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:209)
at org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:55)
at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:194)
at org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:49)
at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:90)
at org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:711)
at org.hibernate.internal.SessionImpl.save(SessionImpl.java:703)
at org.hibernate.internal.SessionImpl.save(SessionImpl.java:698)
at com.sitewatcher.dao.impl.CustomerDaoImpl.saveHelp(CustomerDaoImpl.java:156)
at com.sitewatcher.service.impl.CustomerManagerImpl.saveHelp(CustomerManagerImpl.java:162)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at $Proxy759.saveHelp(Unknown Source)
at com.sitewatcher.web.LoginController.saveUserHelp(LoginController.java:304)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:214)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:748)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:931)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:833)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:807)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:125)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.sql.SQLException: Incorrect decimal value: '\xAC\xED\x00\x05sr\x00\x0Ejava.lang.Long;\x8B\xE4\x90\xCC\x8F#\xDF\x02\x00\x01J\x00\x05valuexr\x00\x10java.lang.Number\x86\xAC\x' for column 'phone_number' at row 1
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2625)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2415)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2333)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2318)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:187)
... 102 more
Can any one help me how to resolve it?
See the exception properly,
java.lang.Thread.run(Thread.java:619) Caused by: java.sql.SQLException: Incorrect decimal value: '\xAC\xED\x00\x05sr\x00\x0E java.lang.Long ;\x8B\xE4\x90\xCC\x8F#\xDF\x02\x00\x01J\x00\x05valuexr\x00\x10 java.lang.Number \x86\xAC\x' for column 'phone_number' at row 1 at
Instead of Number try with Long data type like,
Column(name="PHONE_NUMBER", nullable = false)
private Long phoneNumber;
public Long getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(Long phoneNumber) {
this.phoneNumber = phoneNumber;
}
I am trying to implement a Java Spring application that will display SSRS reports. I have been following this tutorial: http://blogs.msdn.com/b/christophputz/archive/2010/05/07/accessing-ms-reporting-services-with-java.aspx. But at a certain point I ran onto a problem.
I downloaded the latest version of Metro wsimport (wsimport version "2.2.8").
I generate the webservices with the following commands:
wsimport -s -extension src http://devwin/reports/ReportExecution2005.asmx?wsdl
parsing WSDL...
[WARNING] SOAP port "ReportExecutionServiceSoap12": uses a non-standard SOAP 1.2 binding line 1885 of http://devwin/reports/ReportExecution2005.asmx?wsdl
Generating code...
Compiling code...
wsimport -s src -extension http://devwin/reports/ReportService2005.asmx?wsdl
parsing WSDL...
[WARNING] SOAP port "ReportingService2005Soap12": uses a non-standard SOAP 1.2 binding. line 5841 of http://devwin/reports/ReportService2005.asmx?wsdl
Generating code...
Compiling code...
I imported the generated source code (/src only because of the bug mentioned in the topic).
I used the following maven dependency
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.2.8</version>
</dependency>
Here is my class that calls the report:
import java.util.List;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Holder;
import com.iphos.rankingcheck.entity.Report;
import com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.ArrayOfParameterValue;
import com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.ArrayOfString;
import com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.ArrayOfWarning;
import com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.ExecutionHeader;
import com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.ExecutionInfo;
import com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.ParameterValue;
import com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.ReportExecutionService;
import com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.ReportExecutionServiceSoap;
import com.sun.xml.ws.developer.WSBindingProvider;
public class ReportServiceCaller {
public static void callReportWS(Report report) {
String reportPath = "/Path/Report";
String format = "HTML4.0";
String historyID = null;
String devInfo = "<DeviceInfo><Toolbar>False</Toolbar><HTMLFragment>True</HTMLFragment></DeviceInfo>";
String executionID = null;
Holder<String> extension = null;
Holder<String> mimeType = null;
Holder<String> encoding = null;
Holder<ArrayOfWarning> warnings = null;
Holder<ArrayOfString> streamIDs = null;
Holder<byte[]> result = new Holder<byte[]>();
ReportExecutionService res = new ReportExecutionService();
ReportExecutionServiceSoap ress = res.getReportExecutionServiceSoap();
BindingProvider bp = (BindingProvider)ress;
WSBindingProvider wsbp = (WSBindingProvider)ress;
// Sessions erlauben
bp.getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
ExecutionInfo execInfo = new ExecutionInfo();
// Parameterliste erzeugen
ArrayOfParameterValue apv = new ArrayOfParameterValue();
List<ParameterValue> apvList = apv.getParameterValue();
ParameterValue param0 = new ParameterValue();
param0.setName("Project");
param0.setValue(report.getProject().getProjectName());
apvList.add(param0);
// Report vorbereiten
execInfo = ress.loadReport(reportPath, historyID);
// ExecutionID für den nächsten Aufruf merken
executionID = execInfo.getExecutionID();
bp.getRequestContext().put("sessionID", executionID);
// ExecutionHeader Element erzeugen und es für den nächsten Aufruf
// and den WSBindingProvider übergeben
ExecutionHeader eh = new ExecutionHeader();
eh.setExecutionID(executionID);
wsbp.setOutboundHeaders(eh);
// Parameter an den Report übergeben
ress.setExecutionParameters(apv, "en-us");
// Report anfordern
ress.render(format, devInfo, result, extension, mimeType, encoding, warnings, streamIDs);
// Ergebnis des Aufrufs ausgeben
String resultString = new String(result.value);
}
}
When I try to run the report I get the following exception:
org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoSuchMethodError: com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(Ljava/lang/Object;Ljava/io/OutputStream;Ljavax/xml/namespace/NamespaceContext;)V
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:839)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:574)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
root cause
java.lang.NoSuchMethodError: com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(Ljava/lang/Object;Ljava/io/OutputStream;Ljavax/xml/namespace/NamespaceContext;)V
com.sun.xml.ws.db.glassfish.MarshallerBridge.marshal(MarshallerBridge.java:86)
com.sun.xml.bind.api.Bridge.marshal(Bridge.java:105)
com.sun.xml.ws.message.jaxb.JAXBHeader.writeTo(JAXBHeader.java:201)
com.sun.xml.ws.message.AbstractMessageImpl.writeTo(AbstractMessageImpl.java:148)
com.sun.xml.ws.api.message.MessageWrapper.writeTo(MessageWrapper.java:230)
com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:134)
com.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:242)
com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:223)
com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:143)
com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:110)
com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136)
com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050)
com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019)
com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877)
com.sun.xml.ws.client.Stub.process(Stub.java:464)
com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:174)
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:91)
com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:154)
com.sun.proxy.$Proxy93.setExecutionParameters(Unknown Source)
com.iphos.rankingcheck.util.ReportServiceCaller.callReportWS(ReportServiceCaller.java:79)
com.iphos.rankingcheck.controller.ReportController.display(ReportController.java:209)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:601)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:574)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
I figured out that probably the implementation of that method is missing so I tried to search for a dependency to provide it. I found a few, but I was able to move from that exception only with that one:
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.7</version>
</dependency>
When I added it I got the following exception:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is javax.xml.ws.WebServiceException: com.sun.istack.XMLStreamException2: javax.xml.bind.JAXBException: class com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.ExecutionHeader nor any of its super class is known to this context.
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:681)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:574)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
root cause
javax.xml.ws.WebServiceException: com.sun.istack.XMLStreamException2: javax.xml.bind.JAXBException: class com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.ExecutionHeader nor any of its super class is known to this context.
com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:137)
com.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:242)
com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:223)
com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:143)
com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:110)
com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136)
com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050)
com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019)
com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877)
com.sun.xml.ws.client.Stub.process(Stub.java:464)
com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:174)
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:91)
com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:154)
com.sun.proxy.$Proxy93.setExecutionParameters(Unknown Source)
com.iphos.rankingcheck.util.ReportServiceCaller.callReportWS(ReportServiceCaller.java:79)
com.iphos.rankingcheck.controller.ReportController.display(ReportController.java:209)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:601)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:574)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
root cause
com.sun.istack.XMLStreamException2: javax.xml.bind.JAXBException: class com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.ExecutionHeader nor any of its super class is known to this context.
com.sun.xml.ws.message.jaxb.JAXBHeader.writeTo(JAXBHeader.java:206)
com.sun.xml.ws.message.AbstractMessageImpl.writeTo(AbstractMessageImpl.java:148)
com.sun.xml.ws.api.message.MessageWrapper.writeTo(MessageWrapper.java:230)
com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:134)
com.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:242)
com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:223)
com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:143)
com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:110)
com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136)
com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050)
com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019)
com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877)
com.sun.xml.ws.client.Stub.process(Stub.java:464)
com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:174)
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:91)
com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:154)
com.sun.proxy.$Proxy93.setExecutionParameters(Unknown Source)
com.iphos.rankingcheck.util.ReportServiceCaller.callReportWS(ReportServiceCaller.java:79)
com.iphos.rankingcheck.controller.ReportController.display(ReportController.java:209)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:601)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:574)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
root cause
javax.xml.bind.JAXBException: class com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.ExecutionHeader nor any of its super class is known to this context.
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:593)
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:482)
com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:323)
com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:173)
com.sun.xml.ws.db.glassfish.MarshallerBridge.marshal(MarshallerBridge.java:86)
com.sun.xml.bind.api.Bridge.marshal(Bridge.java:145)
com.sun.xml.ws.message.jaxb.JAXBHeader.writeTo(JAXBHeader.java:201)
com.sun.xml.ws.message.AbstractMessageImpl.writeTo(AbstractMessageImpl.java:148)
com.sun.xml.ws.api.message.MessageWrapper.writeTo(MessageWrapper.java:230)
com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:134)
com.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:242)
com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:223)
com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:143)
com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:110)
com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136)
com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050)
com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019)
com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877)
com.sun.xml.ws.client.Stub.process(Stub.java:464)
com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:174)
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:91)
com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:154)
com.sun.proxy.$Proxy93.setExecutionParameters(Unknown Source)
com.iphos.rankingcheck.util.ReportServiceCaller.callReportWS(ReportServiceCaller.java:79)
com.iphos.rankingcheck.controller.ReportController.display(ReportController.java:209)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:601)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:574)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
I tried adding other dependencies like: webservices-rt, webservices-osgi and others, but I was unable to resolve the issue.
Any suggestions would be apprecieated.
None of these error messages seem to be coming from RS side. If your goal is just to show report in your Java App, have you considered URL access to show reports (in any kind of application) ?
If you really need to use web service, I would recommend enabling verbose logging and HTTP logging on RS side to see what is that RS is really complaining about the request.
Here is solution using axis.
build.gradle
dependencies {
compile('commons-discovery:commons-discovery:0.5')
compile('org.apache.axis:axis:1.4')
compile('org.apache.axis:axis-jaxrpc:1.4')
compile('org.apache.axis:axis-saaj:1.4')
compile('axis:axis-wsdl4j:1.5.1')
axisGenAntTask 'org.apache.axis:axis-ant:1.4',
'org.apache.axis:axis:1.4',
'org.apache.axis:axis-jaxrpc:1.4',
'axis:axis-wsdl4j:1.5.1',
'commons-codec:commons-codec:1.3',
'commons-logging:commons-logging:1.1.1',
'commons-discovery:commons-discovery:0.2'
}
task genWsdlClasses {
doLast {
def destDir = file("${buildDir}/generated/src/main/java")
ant.taskdef(name: 'genClassesFromWSDL',
classname: 'org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask',
classpath: configurations.axisGenAntTask.asPath)
destDir.mkdirs()
ant.genClassesFromWSDL(url: "pathOrUrlToWsdl", output: destDir, username: "optionalUsername", password: "optionalPwd");
}
}
sourceSets {
generated {
java.srcDirs "${buildDir}/generated/src/main/java"
}
main {
compileClasspath += generated.output
runtimeClasspath += generated.output
}
test {
compileClasspath += generated.output
runtimeClasspath += generated.output
}
}
compileGeneratedJava {
dependsOn(genWsdlClasses)
classpath = configurations.compile
}
compileJava{
dependsOn(compileGeneratedJava)
source += sourceSets.generated.java
}
java code
public String getHtml(String reportPath, Map<String, String> reportParameters) {
try {
ReportExecutionService reportExecution = new ReportExecutionServiceLocator();
ReportExecutionServiceSoapStub ress = (ReportExecutionServiceSoapStub) reportExecution.getReportExecutionServiceSoap();
final ExecutionInfo info = ress.loadReport(reportPath, null);
final String executionId = info.getExecutionID();
SOAPHeaderElement sessionHeader = new SOAPHeaderElement(
"http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices",
"ExecutionHeader");
SOAPElement addChildElement = sessionHeader.addChildElement("ExecutionID");
addChildElement.addTextNode(executionId);
ress.setHeader(sessionHeader);
final ParameterValue[] parameters = new ParameterValue[reportParameters != null ? reportParameters.size() : 0];
if (reportParameters != null && !reportParameters.isEmpty()) {
int i = 0;
for (final String name : reportParameters.keySet()) {
final String value = reportParameters.get(name);
ParameterValue parameterValue = new ParameterValue();
parameterValue.setName(name);
parameterValue.setValue(value);
parameters[i++] = parameterValue;
}
}
ress.setExecutionParameters(parameters, "en-us");
String format = "HTML4.0";
String devInfo = "<DeviceInfo><Toolbar>False</Toolbar><HTMLFragment>True</HTMLFragment></DeviceInfo>";
final ByteArrayHolder result = new ByteArrayHolder();
final StringHolder extension = new StringHolder();
final StringHolder mimeType = new StringHolder("text/html");
final StringHolder encoding = new StringHolder(StandardCharsets.UTF_8.name());
final ArrayOfWarningHolder warnings = new ArrayOfWarningHolder();
final ArrayOfStringHolder streamIds = new ArrayOfStringHolder();
ress.render(format, devInfo, result, extension, mimeType, encoding, warnings, streamIds);
return new String(result.value);
} catch (Exception e) {
throw new RuntimeException("Report generation error", e);
}
}
I solved the problem by using a different tool than Metro. The right tool for the job was axis, axis-wsdl4j.
I have asked this question in Hibernate forum for a week without an anwser - https://forum.hibernate.org/viewtopic.php?f=1&t=1011634. I am really stuck here and hopefully can get help here. I got NullPointerException from org.hibernate.engine.StatefulPersistenceContext.
My hibernate dependency is as follows:
org.hibernate
hibernate-entitymanager
3.5.6-Final
The exception stack is below:
2011-07-04 07:06:38,691 DEBUG [http-8080-2] mobi.esca.mobile.remoting.HttpInvokerServiceExporter (HttpInvokerServiceExporter.java:168) - java.lang.NullPointerException
java.lang.NullPointerException
at org.hibernate.engine.StatefulPersistenceContext.replaceDelayedEntityIdentityInsertKeys(StatefulPersistenceContext.java:1401)
at org.hibernate.action.EntityIdentityInsertAction.postInsert(EntityIdentityInsertAction.java:117)
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:89)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:267)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:259)
at org.hibernate.engine.ActionQueue.executeInserts(ActionQueue.java:169)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:287)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130)
at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:69)
at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:179)
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:135)
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:61)
at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:800)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:774)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:778)
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:668)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:365)
at $Proxy138.persist(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:240)
at $Proxy59.persist(Unknown Source)
at org.springframework.orm.jpa.JpaTemplate$5.doInJpa(JpaTemplate.java:264)
at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:183)
at org.springframework.orm.jpa.JpaTemplate.persist(JpaTemplate.java:262)
at mobi.esca.persistence.GenericJPARepository.persist(GenericJPARepository.java:153)
at mobi.esca.persistence.GenericJPARepository.persistAll(GenericJPARepository.java:161)
at mobi.esca.mars.application.UsageManager.logUsageStats(UsageManager.java:43)
at mobi.esca.mars.interfaces.mobile.EndUserController.reportStats(EndUserController.java:259)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196)
at $Proxy137.reportStats(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at mobi.esca.mobile.remoting.RemoteInvocationAdaptor.invoke(RemoteInvocationAdaptor.java:89)
at mobi.esca.mobile.remoting.RemoteInvocationAdaptor.proceed(RemoteInvocationAdaptor.java:54)
at mobi.esca.mobile.remoting.FilterChain.doFilter(FilterChain.java:59)
at mobi.esca.mobile.remoting.MethodInvocationRateFromUserProtection.doFilter(MethodInvocationRateFromUserProtection.java:56)
at mobi.esca.mobile.remoting.FilterChain.doFilter(FilterChain.java:56)
at mobi.esca.mobile.remoting.MethodInvocationRateFromIpProtection.doFilter(MethodInvocationRateFromIpProtection.java:57)
at mobi.esca.mobile.remoting.FilterChain.doFilter(FilterChain.java:56)
at mobi.esca.mars.interfaces.mobile.ClientVersionChecker.doFilter(ClientVersionChecker.java:41)
at mobi.esca.mobile.remoting.FilterChain.doFilter(FilterChain.java:56)
at mobi.esca.mobile.remoting.AuthenticationFilter.doFilter(AuthenticationFilter.java:37)
at mobi.esca.mobile.remoting.FilterChain.doFilter(FilterChain.java:56)
at mobi.esca.mobile.remoting.HttpInvokerServiceExporter.invokeAndCreateResult(HttpInvokerServiceExporter.java:201)
at mobi.esca.mobile.remoting.HttpInvokerServiceExporter.handleRequestInternal(HttpInvokerServiceExporter.java:128)
at mobi.esca.mobile.remoting.HttpInvokerServiceExporter.handleRequest(HttpInvokerServiceExporter.java:102)
at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:49)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
I am looking at the line 1401 of StatefulPersistenceContext.java file:
1396 public void replaceDelayedEntityIdentityInsertKeys(EntityKey oldKey, Serializable generatedId) {
1397 Object entity = entitiesByKey.remove( oldKey );
1398 EntityEntry oldEntry = ( EntityEntry ) entityEntries.remove( entity );
1399 parentsByChild.clear();
1400
1401 EntityKey newKey = new EntityKey( generatedId, oldEntry.getPersister(), getSession().getEntityMode() );
1402 addEntity( newKey, entity );
so the possible null object here could be oldEntry, right? Could anyone tell me when oldEntry can become null? What can i do to fix the problem?
Your help will be highly appreciated.
Many thanks,
Cheng Wei
Hi Moe,
Thanks for your reply. The exception are happening randomly in various methods in our system now, and i can not recreate it by unit test. I will give a simplest code from a method.
#Controller
public class EndUserController implements EndUserService, InvocationContextRequired
{
#Override
public void reportStats(UsageStatsDTO usageStatsDTO) throws ClientVersionOutOfDateException
{
log.debug("enter UsageReportController.reportStats()");
UsageStats usageStats = usageStatsDTO.asUsageStats(getEndUser());
usageManager.logUsageStats(usageStats);
if(usageStats.hasAppStartEvent())
{
endUserManager.updateClientVersion(getEndUser(), getClientVersion());
}
log.debug("exit UsageReportController.reportStats()");
}
......
}
#Service
public class UsageManager
{
#Autowired
private CallEventRepository callEventRepository;
#Autowired
private AppStartEventRepository appStartEventRepository;
#Autowired
private InviteEventRepository inviteEventRepository;
#Transactional
public void logUsageStats(UsageStats usageStats)
{
if (usageStats.hasCallEvent())
{
callEventRepository.persistAll(usageStats.getCallEvents());
}
if (usageStats.hasAppStartEvent())
{
appStartEventRepository.persistAll(usageStats.getAppStartEvents());
}
if (usageStats.hasInviteEvent())
{
inviteEventRepository.persistAll(usageStats.getInviteEvents());
}
}
......
}
public class GenericJPARepository<T, ID extends Serializable>
implements GenericRepository<T, ID>
{
#Override
public T persist(T entity)
{
getJpaTemplate().persist(entity);
return entity;
}
#Override
public void persistAll(Collection<T> entities)
{
for(T entity : entities)
{
persist(entity);
}
}
......
}
And all RepositoryImpl classes are the subclasses(CallEventRepository,AppStartEventRepository,InviteEventRepository) of GenericJPARepository.
Many thanks,
Cheng Wei
Can problem be caused by i detach an entity? endUserRepository.detach(detatchedEndUser); But UsageStats, the object to be persisted, does not reference to detatchedEndUser.
Thanks Moe and Maurice, Appreciate your help. I finally find the problem. the following code caused the problem:
EndUser toBePersistedEndUser = endUserRepository.persist(new EndUser(remoteEndUser));
endUserRepository.detach(toBePersistedEndUser );
return toBePersistedEndUser;
Also, i think i reveal a bug for hibernate here.
Problem solved, Many thanks,
Cheng Wei
Well, either oldEntry is null, or getSession() returns null.
Obviously, oldEntry will be null if the entityEntries doesn't contain the entry removed from entitiesByKey. It could also happen if the equals() method for EntityEntry is incorrectly implemented.