mardi 3 mars 2015

ServletException: No adapter for handler just for one service

I'm getting this exception for just one service. I have two service in the controller and the other one works perfectly.



@Controller
@RequestMapping("/document")
public class DocumentController {

@Autowired
private PdfService pdfService;

@Autowired
private MailService mailService;

@Autowired
private TransaccionService transaccionService;

@Autowired
private UsuarioService usuarioService;

@RequestMapping(value = "/export", method = RequestMethod.GET)
public void exportAutorizacion(HttpServletRequest request){
TicketAutorizacionDto ticket = (TicketAutorizacionDto) request.getSession().getAttribute("ticketAutorizacion");
this.pdfService.createPdf(ticket);

}

@RequestMapping(value = "/email/{numeroAutorizacion}", method = RequestMethod.PUT)
public Boolean enviarMail(@PathVariable("numeroAutorizacion") Integer numeroAutorizacion,@ModelAttribute EmailsForm mails){

if(mails.getEmails().isEmpty() || numeroAutorizacion == null){
return false;
}

UsuarioForm usuarioForm = null;
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
try {
usuarioForm = this.usuarioService.getUsuarioByNombreUsuario(auth.getName());
TicketAutorizacionDto ticket = this.transaccionService.getTicketAutorizacion(numeroAutorizacion, usuarioForm.getIdBeneficiario());
return this.mailService.enviarOrdenMedica(ticket, mails.getEmails().toArray(new String[mails.getEmails().size()]));
} catch (NoExisteBeneficiarioException e) {
e.printStackTrace();
}

return false;
}
}


And the xml:



<mvc:annotation-driven />
<tx:annotation-driven />
<!-- <context:property-placeholder -->
<!-- properties-ref="deployProperties" /> -->

<!-- Activates various annotations to be detected in bean classes -->
<!-- <context:annotation-config /> -->

<!-- Scans the classpath for annotated components that will be auto-registered
as Spring beans. For example @Controller and @Service. Make sure to set the
correct base-package -->
<context:component-scan base-package="ar.com.conexia.salud.*" />

<jpa:repositories base-package="ar.com.conexia.salud.repository" />
<!-- Configures the annotation-driven Spring MVC Controller programming
model. Note that, with Spring 3.0, this tag works in Servlet MVC only! -->
<mvc:annotation-driven />
<!-- Imports datasource configuration -->
<!-- <import resource="spring-data.xml" /> -->

<mvc:resources mapping="/resources/**" location="/resources/" />
<!-- Imports logging configuration -->
<!-- <import resource="trace-context.xml" /> -->


<!-- <bean id="deployProperties" -->
<!-- class="org.springframework.beans.factory.config.PropertiesFactoryBean" -->
<!-- p:location="/WEB-INF/spring.properties" /> -->

<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
</bean>

<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basenames">
<list>
<value>messages</value>
</list>
</property>
</bean>
<bean id="localeChangeInterceptor" class="ar.com.conexia.salud.interceptors.LanguageInterceptor">
<property name="paramName" value="lang" />
</bean>
<bean id="userDetailsServiceImpl" class="ar.com.conexia.salud.security.UserServiceImpl">

</bean>
<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
<property name="defaultLocale" value="es" />
</bean>
<mvc:interceptors>
<bean class="ar.com.conexia.salud.interceptors.LanguageInterceptor">
<property name="paramName" value="lang" />
</bean>
</mvc:interceptors>


<bean id="transactionTrasmitter"
class="ar.com.conexia.salud.transmitter.COMEITransactionTransmitter">
<property name="serverPort" value="2012" />
<property name="timeout" value="300000" />
<property name="password" value="conexia" />
<property name="serverIP" value="192.168.0.97" />
<!-- <property name="serverIP" value="localhost"/> -->
<property name="msjKey" value="C:\\mySrvKeystore" />
<!-- <property name="msjKey" value="/usr/local/mySrvKeystore" /> -->
</bean>

<bean id="basePath" class="java.lang.String">
<constructor-arg
value="#{systemProperties['catalina.home']}/webapps/COMEI_Beneficiario" />
</bean>

<bean id="pdfGenerator" class="ar.com.conexia.generator.PdfGenerator">
<constructor-arg value="/WEB-INF/classes/reports/" />
<constructor-arg value="C://reports//" />
</bean>

<bean id="emailConfiguration" class="ar.com.conexia.salud.dto.EmailConfigurationDto">
<property name="port" value="25" />
<property name="auth" value="true" />
<property name="starttls" value="true" />
<property name="host" value="192.168.0.10" />
<property name="user" value="smtpcomei@conexia.com.ar" />
<property name="pass" value="" />
</bean>


Any ideas?


Thanks!


Aucun commentaire:

Enregistrer un commentaire