I have a multi-module EJB webapp, using Java 1.6, ejb 3.0, jsf 2.0 and two JAX WS webservices. The .ear package is deployed on Weblogic 11g two-node clustered server.
From the two JAX-WS webservices, only one is troubling, I only can test it on Test Environment wich is not a Cluster Environment (on test there are no problems). On the production(cluster) I get "Bean has been deleted" error on response from the webservice (in Server logs or Application logs are no errors) and then the webservice is down.
Response:
[5/22/17 14:45:05:698 EEST] 000034df E UOW=null source=WLE.wle org=null prod=null component=null thread=[WebContainer : 30]
CWLLG1405E: Exception javax.xml.ws.soap.SOAPFaultException: Bean has been deleted. occurred while trying to invoke a service: CreateFoccaInteractionPortBindingQSService, ServiceNS: http://createFoccaInteraction.cca.endava.com/, address: https://esblb.bcr.wan:5443/services/Focca/CreateFoccaInteraction, wsdlURL: file:///ibm/BPM/focca_ws/CreateFoccaInteraction.wsdl.
javax.xml.ws.soap.SOAPFaultException: Bean has been deleted.
at org.apache.axis2.jaxws.marshaller.impl.alt.MethodMarshallerUtils.createSystemException(MethodMarshallerUtils.java:1363)
at org.apache.axis2.jaxws.client.dispatch.BaseDispatch.getFaultResponse(BaseDispatch.java:851)
at org.apache.axis2.jaxws.client.dispatch.BaseDispatch.invoke(BaseDispatch.java:206)
at com.ibm.bpm.ws.soap.JAXWSSOAPMessageConnector.callWebService(JAXWSSOAPMessageConnector.java:142)
at com.ibm.bpm.ws.soap.SOAPMessageConnectorDelegate.callWebService(SOAPMessageConnectorDelegate.java:43)
at teamworks.SOAPMessageConnector.callWebService(SOAPMessageConnector.java:58)
at teamworks.SOAPMessageConnector.callWebService(SOAPMessageConnector.java:53)
at sun.reflect.GeneratedMethodAccessor660.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at teamworks.connector.JavaReflectionConnector$1.execute(JavaReflectionConnector.java:81)
at com.lombardisoftware.server.core.ManagedAssetClassLoaderUtil.executeWithManagedAssetClassLoader(ManagedAssetClassLoaderUtil.java:51)
at teamworks.connector.JavaReflectionConnector.execute(JavaReflectionConnector.java:49)
at com.lombardisoftware.component.javaconnector.worker.JavaConnectorWorker.invokeJavaMethod(JavaConnectorWorker.java:146)
at com.lombardisoftware.component.javaconnector.worker.JavaConnectorWorker.doJob(JavaConnectorWorker.java:79)
at com.lombardisoftware.component.common.workflow.ExecutionJob.doJob(ExecutionJob.java:453)
at com.lombardisoftware.server.ejb.workflow.EJBWorkflowManagerBean.doResumeWorkflowEngine(EJBWorkflowManagerBean.java:1366
at com.lombardisoftware.server.ejb.workflow.EJBWorkflowManagerBean.resumeTask(EJBWorkflowManagerBean.java:360)
at com.lombardisoftware.server.ejb.workflow.EJBWorkflowManagerBean.resumeTask(EJBWorkflowManagerBean.java:324)
at com.lombardisoftware.server.ejb.workflow.EJSRemoteStatefulEJBWorkflowManager_82478d70.resumeTask(Unknown Source)
at com.lombardisoftware.server.ejb.workflow._EJBWorkflowManagerInterface_Stub.resumeTask(_EJBWorkflowManagerInterface_Stub.java:287)
at com.ibm.bpm.rest.impl.coachflow.CallActivityServiceRunner.runService(CallActivityServiceRunner.java:62)
at com.ibm.bpm.rest.impl.coachflow.ServiceStartActionHandler.handleAction(ServiceStartActionHandler.java:185)
at com.ibm.bpm.rest.impl.coachflow.ServiceResource.postServiceActions(ServiceResource.java:231)
at sun.reflect.GeneratedMethodAccessor770.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.apache.wink.server.internal.handlers.InvokeMethodHandler.handleRequest(InvokeMethodHandler.java:63)
at org.apache.wink.server.handlers.AbstractHandler.handleRequest(AbstractHandler.java:33)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:75)
at org.apache.wink.server.internal.handlers.CreateInvocationParametersHandler.handleRequest(CreateInvocationParametersHandler.java:54)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:75)
at org.apache.wink.server.handlers.AbstractHandler.handleRequest(AbstractHandler.java:34)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:75)
at org.apache.wink.server.internal.handlers.FindResourceMethodHandler.handleSubResourceMethod(FindResourceMethodHandler.java:188)
at org.apache.wink.server.internal.handlers.FindResourceMethodHandler.handleRequest(FindResourceMethodHandler.java:110)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:75)
at org.apache.wink.server.internal.handlers.FindRootResourceHandler.handleRequest(FindRootResourceHandler.java:95)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:75)
at org.apache.wink.server.internal.handlers.HeadMethodHandler.handleRequest(HeadMethodHandler.java:53)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:75)
at org.apache.wink.server.internal.handlers.OptionsMethodWADLHandler.handleRequest(OptionsMethodWADLHandler.java:51)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:75)
at org.apache.wink.server.internal.handlers.SearchResultHandler.handleRequest(SearchResultHandler.java:33)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:75)
at org.apache.wink.server.internal.log.ResourceInvocation.handleRequest(ResourceInvocation.java:92)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:75)
at org.apache.wink.server.internal.log.Requests.handleRequest(Requests.java:76)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:75)
at org.apache.wink.server.handlers.AbstractHandlersChain.run(AbstractHandlersChain.java:60)
at org.apache.wink.server.internal.RequestProcessor.handleRequestWithoutFaultBarrier(RequestProcessor.java:207)
at org.apache.wink.server.internal.RequestProcessor.handleRequest(RequestProcessor.java:154)
at org.apache.wink.server.internal.servlet.RestServlet.service(RestServlet.java:124)
Webservice:
#WebService(serviceName = "createFoccaInteraction")
#Stateless()
public class CreateFoccaInteraction {
#EJB
private TaskManager taskManager;
#EJB
private CampaignImportManager cim;
#EJB
private ProspectManager prosManager;
#EJB
private ProspectPersistenceManager prosPersisManager;
#EJB
private TaskPersistenceManager taskPersisManager;
#EJB
private AuditPersistenceManager auditPersisManager;
#EJB
private InteractionManager interactionManager;
#EJB
private SystemSupportManager systemSupportManager;
#EJB
private ReasonCodePersistanceManager reasonCodePersistanceManager;
private static final Logger GENERAL = LoggingFacade.getLogger(ServiceHandler.class);
#WebMethod(operationName = "addInteraction")
public ServiceReplyType addInteraction(#WebParam(name = "request") ServiceRequestType request) throws DatatypeConfigurationException {
ServiceHandler sh = new ServiceHandler();
System.setProperty("com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace", "false");
ServiceReplyType srt = sh.handleRequest(request, cim, prosManager, prosPersisManager, taskPersisManager, auditPersisManager, taskManager, interactionManager, systemSupportManager, reasonCodePersistanceManager);
return srt;
}
Handler:
#Stateless
public class ServiceHandler {
private CampaignImportManager campaignImportManager;
private ProspectManager prospectManager;
private ProspectPersistenceManager persistenceManager;
private InteractionManager interactionManager;
private ResourceLoadingManager resourceLoadingManager;
private TaskPersistenceManager taskPersistenceManager;
private AuditPersistenceManager auditPersist;
private TaskManager taskManager;
private SystemSupportManager systemSupportManager;
private ReasonCodePersistanceManager reasonCodePersistanceManager;
private ErrorsType err = new ErrorsType();
private List<MessageType> errorMessages = new ArrayList<MessageType>();
private ServiceRequestType request;
private ServiceReplyType reply = new ServiceReplyType();
private RequestHeaderType header = new RequestHeaderType();
private Campaign existingCampaign;
private ReplyHeaderType replyHeaderType= new ReplyHeaderType();
private static final Logger GENERAL = LoggingFacade.getLogger(ServiceHandler.class);
public ServiceReplyType handleRequest (ServiceRequestType srt, CampaignImportManager cim, ProspectManager pm,ProspectPersistenceManager persism,
TaskPersistenceManager tpm, AuditPersistenceManager ap, TaskManager tm, InteractionManager im, SystemSupportManager ssm, ReasonCodePersistanceManager rcpm) throws DatatypeConfigurationException{
this.request = srt;
this.header = srt.getHeader();
this.campaignImportManager = cim;
this.prospectManager = pm;
this.persistenceManager = persism;
this.taskPersistenceManager = tpm;
this.auditPersist = ap;
this.taskManager = tm;
this.interactionManager = im;
this.systemSupportManager = ssm;
this.reasonCodePersistanceManager = rcpm;
GENERAL.debug("Intrat in handleRequest");
if(header != null){
populateReplyHeader(header);
}else{
String errr = "Null request header.";
GENERAL.error(errr);
return replyFailed(errr);
}
String appID = header.getSourceAppItem().getSourceAppId();
String appCode = header.getSourceAppItem().getSourceAppCode();
if(getAppAuthentication(appID, appCode)){
if(header.getClientInfoDetails().getPhones().getMobile().isEmpty()header.getClientInfoDetails().getPhones().getWork().isEmpty()){
GENERAL.error("Impossible");
replyFailed("Impossible");
}
Interaction interaction = null;
Task task = null;
Prospect prospect = new Prospect();
final Date now = DateUtils.getCurrentDate();
existingCampaign = getExistingCampaign();
if (existingCampaign == null) {
String errr = "Nu exista";
GENERAL.error(errr);
return replyFailed(errr);
}
final List<Group> groupsForCampaign = campaignImportManager.
getGroupsForCampaign(existingCampaign.getId());
final String taskGroup;
if (groupsForCampaign.isEmpty()) {
final String errr = "-1Pentru " + existingCampaign.getName();
GENERAL.error(errr);
return replyFailed(errr);
} else {
taskGroup = groupsForCampaign.get(0).getId();
}
if (existingCampaign.getStatus() != null
&& existingCampaign.getStatus().equalsIgnoreCase(CCAConstants.CAMPAIGN_INACTIVE)) {
final String errr = "Interactiunea"
GENERAL.error(errr);
return replyFailed(errr);
}
prospect = getProspect();
task = getTask(taskGroup, now);
interaction = getInteraction(now);
interaction.setCampaignId(existingCampaign.getId());
String error = "";
try {
prospect = prospectManager.addCampaignProspectFromEmail(prospect, header.getUserID());//addCampProspect(prospect);
GENERAL.debug("Dupa prospectManager.addCampaignProspectFromEmail()");
} catch (EJBException ex) {
error = "Eroare" + ex.getMessage();
ex.printStackTrace();
GENERAL.error(error);
return replyFailed(error);
}
if (DataUtils.isEmpty(prospect.getId())) {
error = "Eroare";
GENERAL.error(error);
return replyFailed(error);
}
interaction.setProspect(prospect);
try {
interaction = interactionManager.addCampaignInteractionFromEmail(interaction, header.getUserID());
GENERAL.debug("Dupa interactionManager.addCampaignInteractionFromEmail)");
if(header.getInteractionWithTask().equalsIgnoreCase("y")){
task.setInteraction(interaction);
ServiceReply sr = new ServiceReply();
Long taskId = taskManager.addCampaignTaskFromEmail(task, header.getUserID());
interaction.setTaskId(taskId.toString());
//interactionManager.editInteraction(interaction, getReasonCode(), header.getAgentID());
sr.setTaskId(taskId.toString());
sr.setInteractionId(interaction.getInteractionId());
reply.setServiceReply(sr);
GENERAL.debug("Dupa reply.setServiceReply(sr) - sr = " + sr.toString());
}else{
ServiceReply sr = new ServiceReply();
sr.setTaskId("");
sr.setInteractionId(interaction.getInteractionId());
reply.setServiceReply(sr);
GENERAL.debug("Dupa reply.setServiceReply(sr) - sr = " + sr.toString());
}
} catch (Exception ex) {
ex.printStackTrace();
if(ex.getMessage() != null){
GENERAL.error(ex.getMessage());
return replyFailed(ex.getMessage());
}else{
GENERAL.error("Exception with NULL message.");
return replyFailed("Exception with NULL message.");
}
}
err.setErrorMsg(errorMessages);
reply.setErrors(err);
reply.getHeader().setDateTimeReply(getXmlDate());
reply.setServiceExecutionStatus(ExecutionStatusType.OK);
GENERAL.debug("reply.setServiceExecutionStatus(ExecutionStatusType.OK) - reply = " + reply.toString());
return reply;
}
String errr = "Source application authentication failed!";
GENERAL.error(errr);
return replyFailed(errr);
}
private List<Campaign> getCampaigns() {
GENERAL.debug("Intrat in getCampaigns()");
final SortCriteria defaultSortCriteria = new SortCriteria(CampaignColumns.CAMPAIGN_NAME, Boolean.TRUE);
return campaignImportManager.getAllCampaignsForEmail(defaultSortCriteria);
}
private Task getTask(final String group, final Date now) throws DatatypeConfigurationException {
GENERAL.debug("Intrat in getTask - start");
Task task = new Task();
List<String> lst = new ArrayList<String>();
if(!isNullOrEmpty(header.getClientInfoDetails().getPhones().getHome())){
lst.add(header.getClientInfoDetails().getPhones().getHome());
}
if(!isNullOrEmpty(header.getClientInfoDetails().getPhones().getMobile())){
lst.add(header.getClientInfoDetails().getPhones().getMobile());
}
if(!isNullOrEmpty(header.getClientInfoDetails().getPhones().getWork())){
lst.add(header.getClientInfoDetails().getPhones().getWork());
}
String phoneNumbersString = "";
for(String item: lst){
if(item.length() > 3){
phoneNumbersString += item + ";";
}
}
phoneNumbersString = phoneNumbersString.substring(0, phoneNumbersString.length()-1);
final StringBuilder sb = new StringBuilder();
sb.append("Nume campanie: ").append(existingCampaign.getName()).append("\n");
sb.append("Nume client: ").append(header.getClientInfoDetails().getFirstName()).append(" ");
sb.append(header.getClientInfoDetails().getLastName()).append("\n");
sb.append("Telefon: ").append(phoneNumbersString);
final GregorianCalendar cal = new GregorianCalendar();
cal.setTime(now);
cal.add(GregorianCalendar.DATE, 1);
task.setSubject(header.getProcessItem().getFormName());
if(!isNullOrEmpty(systemSupportManager.getValue("task.taskType"))){
GENERAL.debug("Intrat in getTask: systemSupportManager.getValue(\"task.taskType\") !=null value= " + systemSupportManager.getValue("task.taskType"));
task.setTaskTypeID(systemSupportManager.getValue("task.taskType"));
}else{
GENERAL.debug("Intrat in getTask: systemSupportManager.getValue(\"task.taskType\") =null; setting taskTypeId to 001");
task.setTaskTypeID("001");
}
String chargebackId = header.getProcessItem().getBpId();
if(isChargebackIdOk(chargebackId)=="true"
&& (chargebackId != "")){
task.setChargebackID(chargebackId);
}else{
replyFailed("ChargeBackID error");
}
return task;
}
private Interaction getInteraction(final Date now) throws DatatypeConfigurationException {
GENERAL.debug("Intrat in getInteraction");
final Direction dir = Direction.IN;
final Interaction interaction = new Interaction();
interaction.setSubject(header.getProcessItem().getFormName());
interaction.setNotes(header.getAppData().getTaskNotes());
if(!isNullOrEmpty(systemSupportManager.getValue("interaction.interactionChannelId"))){
interaction.setChannel(systemSupportManager.getValue("interaction.interactionChannelId"));
GENERAL.debug("Intrat in getInteraction - systemSupportManager.getValue(\"interaction.interactionChannelId\") != null; value= " + systemSupportManager.getValue("interaction.interactionChannelId"));
}
return interaction;
}
}
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>cca</display-name>
<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>
javax.faces.VALIDATE_EMPTY_FIELDS
</param-name>
<param-value>true</param-value>
</context-param>
<listener>
<listener-class>com.endava.cca.web.listeners.CCAHttpSessionListener</listener-class>
</listener>
<listener>
<listener-class>com.endava.cca.web.listeners.RdcServletContextListener</listener-class>
</listener>
<listener>
<listener-class>com.endava.cca.web.listeners.RdcServletRequestListener</listener-class>
</listener>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
<!-- init-param> <param-name>uploadDirectory</param-name> <param-value>C:/tmp_cca</param-value>
</init-param> <init-param> <param-name>thresholdSize</param-name> <param-value>512000</param-value>
</init-param -->
</filter>
<filter>
<filter-name>SessionTimeoutCheckFilter</filter-name>
<filter-class>com.endava.cca.web.filters.SessionTimeoutCheckFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>SessionTimeoutCheckFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>LoggedUserFilter</filter-name>
<filter-class>com.endava.cca.web.filters.LoggedUserFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>LoggedUserFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>NoCacheFilter</filter-name>
<filter-class>com.endava.cca.web.filters.NoCacheFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>NoCacheFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<security-constraint>
<web-resource-collection>
<web-resource-name>Unprotected images</web-resource-name>
<url-pattern>/images/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Unprotected CSS</web-resource-name>
<url-pattern>/css/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Unprotected JS</web-resource-name>
<url-pattern>/scripts/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Protected</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>cc_a</role-name>
<role-name>cc_s</role-name>
<role-name>cc_ag</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>createFoccaInteraction</web-resource-name>
<url-pattern>/createFoccaInteraction/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>getFoccaTaskStatus</web-resource-name>
<url-pattern>/getFoccaTaskStatus/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<security-role>
<role-name>cc_admin</role-name>
</security-role>
<security-role>
<role-name>cc_supervizor</role-name>
</security-role>
<security-role>
<role-name>cc_agent</role-name>
</security-role>
<!-- <login-config>
<auth-method>CLIENT-CERT</auth-method>
</login-config>-->
<login-config>
<auth-method>FORM</auth-method>
<realm-name>myrealm</realm-name>
<form-login-config>
<form-login-page>/login/login.jsp</form-login-page>
<form-error-page>/login/error.jsp</form-error-page>
</form-login-config>
</login-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
<param-value>/WEB-INF/CCAFunctions.taglib.xml</param-value>
</context-param>
<context-param>
<param-name>primefaces.THEME</param-name>
<!-- <param-value>redmond</param-value>-->
<param-value>redmond</param-value>
</context-param>
<context-param>
<param-name>servletPath</param-name>
<param-value>/faces</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>org.jboss.el.ExpressionFactoryImpl</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
<param-value>true</param-value>
</context-param>
<!-- Context parameters -->
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
<param-value>2</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.resourceUpdateCheckPeriod</param-name>
<param-value>2</param-value>
</context-param>
<!-- parameter javax.faces.FACELETS_SKIP_COMMENTS always should be false
because iexplorer specific css file should be included in response -->
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>javax.faces.SEPARATOR_CHAR</param-name>
<param-value>:</param-value>
</context-param>
<!-- <context-param> <param-name>javax.faces.VALIDATE_EMPTY_FIELDS</param-name>
<param-value>true</param-value> </context-param> -->
<context-param>
<param-name>com.sun.faces.allowTextChildren</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.defaultResourceMaxAge</param-name>
<param-value>1209600000</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.enableMissingResourceLibraryDetection</param-name>
<param-value>true</param-value>
</context-param>
<mime-mapping>
<extension>png</extension>
<mime-type>image/png</mime-type>
</mime-mapping>
<mime-mapping>
<extension>xhtml</extension>
<mime-type>application/xhtml+xml</mime-type>
</mime-mapping>
<listener>
<listener-class>
com.sun.xml.ws.transport.http.servlet.WSServletContextListener
</listener-class>
</listener>
<servlet>
<servlet-name>createFoccaInteraction</servlet-name>
<servlet-class>
com.sun.xml.ws.transport.http.servlet.WSServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>createFoccaInteraction</servlet-name>
<url-pattern>/createFoccaInteraction</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>getFoccaTaskStatus</servlet-name>
<servlet-class>
com.sun.xml.ws.transport.http.servlet.WSServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>getFoccaTaskStatus</servlet-name>
<url-pattern>/getFoccaTaskStatus</url-pattern>
</servlet-mapping>
</web-app>
It's my first post here. I hope I gave enough informations. Searched all internet but didn't found any answers.
It was from one Bean
#EJB
private SystemSupportManager systemSupportManager;
wich loaded properties from application.properties file.
Solved by loading needed properties directly in ServiceHandler.
Related
type Exception report
message
description The server encountered an internal error () that prevented it from >fulfilling this request.
>exception
>javax.servlet.ServletException: Servlet.init() for servlet resteasy-servlet >threw exception
org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
java.lang.Thread.run(Thread.java:745)
root cause
>java.lang.RuntimeException: Failed to construct public com.ph.restful.main.StringServiceApplication()
org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:144)
org.jboss.resteasy.spi.ResteasyDeployment.createFromInjectorFactory(ResteasyDeployment.java:282)
org.jboss.resteasy.spi.ResteasyDeployment.createApplication(ResteasyDeployment.java:259)
org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:220)
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:67)
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36)
org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
java.lang.Thread.run(Thread.java:745)
root cause
>java.lang.StackOverflowError
java.util.HashMap.init(HashMap.java:330)
java.util.HashMap.<init>(HashMap.java:262)
java.util.HashMap.<init>(HashMap.java:281)
java.util.HashSet.<init>(HashSet.java:103)
com.ph.restful.main.StringServiceApplication.<init>(StringServiceApplication.java:12)
com.ph.restful.main.StringServiceApplication.<init>(StringServiceApplication.java:15)
com.ph.restful.main.StringServiceApplication.<init>(StringServiceApplication.java:15)
com.ph.restful.main.StringServiceApplication.<init>(StringServiceApplication.java:15)
com.ph.restful.main.StringServiceApplication.<init>(StringServiceApplication.java:15)
com.ph.restful.main.StringServiceApplication.<init>(StringServiceApplication.java:15)
com.ph.restful.main.StringServiceApplication.<init>(StringServiceApplication.java:15)
com.ph.restful.main.StringServiceApplication.<init>(StringServiceApplication.java:15)
com.ph.restful.main.StringServiceApplication.<init>(StringServiceApplication.java:15)
getting an error when I use my browser as http://localhost:8080/sample/rest/app/test that will return a json data type..
Product class
private String productname;
private String description;
private Integer price;
public String getProductname() {
return productname;
}
public void setProductname(String productname) {
this.productname = productname;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
StringService class
#Path("/app")
public class StringService {
#GET
#Path("/test")
#Produces("application/json")
public Product printSample2(){
Product prod = new Product();
prod.setProductname("Alaska Milk");
prod.setDescription("Milk for all");
prod.setPrice(300);
return prod;
}
}
StringServiceApplication
public class StringServiceApplication extends Application{
private Set<Object> singletons = new HashSet<Object>();
public StringServiceApplication(){
singletons.add(new StringServiceApplication());
}
#Override
public Set<Object> getSingletons(){
return singletons;
}
}
my web.xml
<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/rest</param-value>
</context-param>
<servlet>
<servlet-name>resteasy-servlet</servlet-name>
<servlet-class>
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.ph.restful.main.StringServiceApplication</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>resteasy-servlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
my jboss-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>sample</context-root>
</jboss-web>
my libraries on build path
-javassist-3.12.1.GA
-json-simple-1.1.1
-resteasy-jaxb-provider-2.2.1.ga
-resteasy-jaxrs-2.2.1.GA
-resteasy-jettison-provider
-scannotation-1.0.3
java.lang.StackOverflowError
public class StringServiceApplication extends Application{
public StringServiceApplication(){
singletons.add(new StringServiceApplication());
}
}
You're getting stack overflow because you are trying to instantiate the same class in its own constructor.
I think you mean to instantiate the StringService instead
public StringServiceApplication(){
singletons.add(new StringService());
}
I have created a web service if I execute this service from eclipse configured tomcat, then it works properly
But if I execute this service without eclipse tomcat(same tomcat but without eclipse) it says 415 Unsupported Media Type
Here is my code
#Path("{get}")
public class MyClass {
#POST
#Path("/token")
#Produces(MediaType.APPLICATION_JSON)
public Response getToken(#FormParam("username") String username, #FormParam("password") String password, #FormParam("identity") String identity){
System.out.println("Service called !!!");
if(username == null)
return Response.status(404).entity("username can not be null").build();
if(username != null && username.length() == 0)
return Response.status(404).entity("username can not be empty").build();
if(password == null)
return Response.status(404).entity("password can not be null").build();
if(password != null && password.length() == 0)
return Response.status(404).entity("password can not be empty").build();
if(identity == null)
return Response.status(404).entity("identity can not be null").build();
if(identity != null && identity.length() == 0)
return Response.status(404).entity("identity can not be empty").build();
OtherClass obj = new OtherClass();
return Response.status(200)
.entity(obj.getdata(username, password, identity))
.build();
}
web.xml is
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Web Service</display-name>
<servlet>
<servlet-name>jersey-serlvet</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>jersey-serlvet</servlet-name>
<url-pattern>/service/*</url-pattern>
</servlet-mapping>
</web-app>
Service is called from Advance Rest Client by chrome
Content-type in request is
text/html
I m trying to create a restful webservice using jersey 2.13 API + TOMCAT 7. My aim is to show the directories and files on my computer as a response.
Everything works fine except the Turkish encoding. My HTML response includes Turkish chars. I did everything (added ;charset=ISO-8859-9 to the annotation, added meta stuff with charset,added charset to the response header, added language to the response header etc.) but still my page is full of unknown chars instead of Turkish ones.
I couldnt post an image showing the problem because of my low rep. :S
Instead here is a link from my server's response
KLASOR:Görüntü Ä°ÅLEME GENEL**
this one should be as
KLASOR:GÖRÜNTÜ İŞLEME GENEL
The same code is working properly using jersey 1x I think this is a bug :S
#GET
#Path("klasor")
#Produces(MediaType.TEXT_HTML+";charset=ISO-8859-9")
public Response dosyalariGosterHTML(#QueryParam("ad") String klasorAdi){
if(klasorAdi==null||klasorAdi.equals("")){
klasorAdi = "C:/";
}
StringBuffer sb = new StringBuffer();
sb.append("<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
<html><head><meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-9'/>
<META HTTP-EQUIV='Content-language' CONTENT='tr'><title>Tez İD</title></head><body>");
try{
klasorAdi = text_convert_ters(klasorAdi);
File folder = new File(klasorAdi);
File[] listOfFiles = folder.listFiles();
for (int i = 0; i < listOfFiles.length; i++) {
if (listOfFiles[i].isFile()) {
sb.append("<a href='http://localhost:8080/TezWebServer/rest/servis/dosya?adres="+klasorAdi+"/"+ listOfFiles[i].getName()+"'>DOSYA:"+listOfFiles[i].getName()+"</a><br/>");
} else if (listOfFiles[i].isDirectory()) {
sb.append("<a href='http://localhost:8080/TezWebServer/rest/servis/klasor?ad="+klasorAdi+"/"+ listOfFiles[i].getName()+"'>KLASOR:"+listOfFiles[i].getName()+"</a><br/>");
}
}
sb.append("</body></html>");
}catch(Exception e){
e.printStackTrace();
sb.append("Hata:Belirtilen Yol Geçersiz</body></html>");
}
return Response.ok(sb.toString()).language(Locale.getDefault()).header("charset", "ISO-8859-9").build();
}
public String text_convert_ters(String eskiStr)
{
String yeniStr = "";
for(int index = 0; index < eskiStr.length(); index++)
{
char tmpStr = eskiStr.charAt(index);
if(tmpStr == '\360') tmpStr='ğ';
else if(tmpStr == '\320') tmpStr='Ğ';
else if(tmpStr == '\375') tmpStr='ı';
else if(tmpStr == '\335') tmpStr='İ';
else if(tmpStr == '\366') tmpStr='ö';
else if(tmpStr == '\326') tmpStr='Ö';
else if(tmpStr == '\374') tmpStr='ü';
else if(tmpStr == '\334') tmpStr='Ü';
else if(tmpStr == '\376') tmpStr='ş';
else if(tmpStr == '\336') tmpStr='Ş';
else if(tmpStr == '\347') tmpStr='ç';
else if(tmpStr == '\307') tmpStr='Ç';
yeniStr = yeniStr + tmpStr;
}
return yeniStr;
}
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>TezWebServer</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
<welcome-file>/axis2-web/index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>benim.tez.projem.rs.servis</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey REST Service</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<servlet>
<display-name>Apache-Axis Servlet</display-name>
<servlet-name>AxisServlet</servlet-name>
<servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/servlet/AxisServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>*.jws</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
</web-app>
I have a simple POJO as a webservice that is mapped to, lets say /public/authenticate :
WebService
#SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
public class AuthWS{
#WebMethod
public boolean doAuthenticate(String securityToken) {
....
}
}
This webservice doesn't requre authentication and is not a protected resource.
I do have other private webservices mapped to path : /private/ws/*;
For the moment I use a security-domain that has a Database login module setup. It works fine, but user first needs to authenticate trought a web form based that makes a post request to /j_security_check. Only after this step user can use other private webservices.
I want to perform a programatically authentication after client calls this doAuthenticate method. So that client to be able to invoke other /private/ws/* webservice methods.
I'll type what I want to achieve:
#WebService
#SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
public class AuthWS{
#WebMethod
public boolean doAuthenticate(String securityToken) {
SomeSecurityManager manager= SomeSecurityManager.getDefaultManager()
Map<String,Object> map = new HashMap<String, Object>();
map.put("MY_CUSTOM_SECURITY_TOKEN",securityToken);
manager.doLogin(map);
// after webservice method returns, client should now be able to invoke other private webservice
// this means that the manager should associate with this session an authenticated user.
// in order that authorization to work.
}
}
And my CustomLoginModule :
class CustomLogModule implements LoginModule {
...
public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) {
// store what's needed
}
public boolean login(){
// get securityToken send from the SomeSecurityManager and validate it.
// get user information from that token and store into Subject object.
}
}
And in my CustomLoginModule that implements JAAS LoginModule to check that securityToken with a custom logic, verify if it right signed with a public key for example. That securityToken contains information about principal.
If you need more details, feel free to ask.
Thanks.
EDITED
1.) Created custom-login-module.jar together with module.xml
<module xmlns="urn:jboss:module:1.1" name="custom.login.module">
<resources>
<resource-root path="custom-login-module.jar"/>
</resources>
<dependencies>
<module name="org.picketbox"/>
<module name="javax.api"/>
<module name="org.slf4j"/>
</dependencies>
</module>
2.) Added custom-login-module.jar and module.xml into jboss-as-7.1.1.Final\modules\custom\login\module
3.) custom-login-module.jar contains :
public class CustomCallbackHandler implements CallbackHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(CustomCallbackHandler.class);
private String token;
public CustomCallbackHandler(String token) {
this.token= token;
}
public String getToken() {
return token;
}
#Override
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
for (Callback callback : callbacks) {
if (callback instanceof TokenCallback) {
((TokenCallback) callback).setToken(token);
}
}
}
}
public class TokenCallback implements Callback {
private static final Logger LOGGER = LoggerFactory.getLogger(TokenCallback.class);
private String token;
public TokenCallback() {
}
public String getToken() {
return token;
}
public void setToken(String token) {
LOGGER.info("Setting token = " + token);
this.token = token;
}
}
public class CustomLoginModule extends AbstractServerLoginModule {
private static final Logger LOGGER = LoggerFactory.getLogger(CustomLoginModule.class);
#Override
public boolean login() throws LoginException {
LOGGER.info("Doing login()");
boolean login = super.login();
super.loginOk = true;
return login;
}
#Override
protected Principal getIdentity() {
return new UserPrincipal("some user");
}
#Override
protected Group[] getRoleSets() throws LoginException {
return new Group[]{new MyGroup()}; // that and has name 'dummy'
}
}
These are only dummy implementations.
My web application is deployed from within a .war archive. And it Contains following :
jboss-web.xml
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE jboss-web
PUBLIC -//JBoss//DTD Web Application 2.3V2//EN
http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd>
<jboss-web>
<security-domain>custom-auth</security-domain>
</jboss-web>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>WebApp</display-name>
<session-config>
<session-timeout>120</session-timeout>
</session-config>
<security-constraint>
<web-resource-collection>
<web-resource-name>All resources</web-resource-name>
<description>Protects all private resources</description>
<url-pattern>/private/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>dummy</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<security-role>
<role-name>dummy</role-name>
</security-role>
<servlet>
<servlet-name>Private</servlet-name>
<servlet-class>com.company.private.PrivateWs</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Private</servlet-name>
<url-pattern>/private/PrivateWs</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>AuthWS</servlet-name>
<servlet-class>com.company.auth.AuthWS</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AuthWS</servlet-name>
<url-pattern>/AuthWS</url-pattern>
</servlet-mapping>
</web-app>
#WebService
#SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
public class AuthWS{
private static final Logger LOGGER = LoggerFactory.getLogger(AuthWS.class);
#WebMethod
public boolean doAuthenticate(String token) {
tryProgrammaticLogin(token);
return true;
}
private void tryProgrammaticLogin(String token) {
LoginContext loginContext = null;
try {
loginContext = new LoginContext("custom-auth", new CustomCallbackHandler(token));
loginContext.login();
} catch (LoginException e) {
LOGGER.info("Some problem occured when trying to custom login.", e);
}
}
}
The call to doAuthenticate from my ws client works but the problem is that after try ProgrammaticLogin an exception occurs. And the PrivateWS is not accesible by client.
17:33:40,901 INFO [com.mycompany.AuthWS] (http--0.0.0.0-8080-1) Some problem occured when trying to custom login.: javax.security.auth.login.LoginException: Login Failure: all modules ignored
at javax.security.auth.login.LoginContext.invoke(LoginContext.java:921) [rt.jar:1.6.0_26]
at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186) [rt.jar:1.6.0_26]
at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683) [rt.jar:1.6.0_26]
at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.6.0_26]
at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680) [rt.jar:1.6.0_26]
at javax.security.auth.login.LoginContext.login(LoginContext.java:579) [rt.jar:1.6.0_26]
standalone.xml from jboss configuration directory contains:
<security-domain name="custom-auth">
<authentication>
<login-module code="com.mycompany.CustomLoginModule" flag="required" module="custom.login.module"/>
</authentication>
</security-domain>
Please tell me if the way of doing authentication with creating a new LoginContext object is the right way of doing. I can't understand why this problem occurs.
I'm new to Spring-WS and I have defined an endpoint based off a schema generated from JAXB annotated classes. However, when I try to access the endpoint via soapUI, I get the following error along with a 404 response code:
No endpoint mapping found for [SaajSoapMessage {clip}clipClaimRequest]
Any ideas as to what I'm doing wrong? Thanks for any help given.
The endpoint class:
#Endpoint
public class TestEndpoint {
#PayloadRoot(localPart = "clipClaimRequest", namespace = "clip")
#ResponsePayload
public CLIPClaimResponse registerClaim(#RequestPayload CLIPClaimRequest request) {
return new CLIPClaimResponse("Success", "test success");
}
}
The request/response classes (marshalled/unmarshalled via JAXB):
#XmlRootElement(name = "clipClaimRequest")
#XmlType(name = "CLIPClaimRequest")
public class CLIPClaimRequest {
private Claim claim;
#XmlElement(required = true)
public Claim getClaim() {
return claim;
}
public void setClaim(Claim claim) {
this.claim = claim;
}
}
And:
#XmlRootElement(name = "clipClaimResponse")
#XmlType(name = "CLIPClaimResponse")
public class CLIPClaimResponse {
private String code;
private String description;
public CLIPClaimResponse() {
}
public CLIPClaimResponse(String code, String desc) {
setCode(code);
setDescription(desc);
}
#XmlElement(required = true)
public String getCode() {
return code;
}
#XmlElement(required = true)
public String getDescription() {
return description;
}
public void setCode(String code) {
this.code = code;
}
public void setDescription(String description) {
this.description = description;
}
}
web.xml servlet configuration:
<servlet>
<servlet-name>spring-ws</servlet-name>
<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
<init-param>
<description>This is used by SpringWS to dynamically convert WSDL urls</description>
<param-name>transformWsdlLocations</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring-ws</servlet-name>
<url-pattern>/clipClaimService/*</url-pattern>
</servlet-mapping>
spring-ws-servlet.xml configuration:
<?xml version="1.0" encoding="UTF-8"?>
<beans>
<context:annotation-config />
<sws:annotation-driven />
<sws:dynamic-wsdl id="claimRegistration" portTypeName="CLIPClaimPort"
locationUri="/clipClaimService/" targetNamespace="clip">
<sws:xsd location="/WEB-INF/CLIP_Poc.xsd" />
</sws:dynamic-wsdl>
<bean id="jaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="classesToBeBound">
<list>
<!-- list of classes... -->
</list>
</property>
<property name="schema" value="/WEB-INF/CLIP_PoC.xsd" />
</bean>
<bean id="marshallingPayloadMethodProcessor"
class="org.springframework.ws.server.endpoint.adapter.method.MarshallingPayloadMethodProcessor">
<constructor-arg ref="jaxb2Marshaller" />
<constructor-arg ref="jaxb2Marshaller" />
</bean>
<bean id="defaultMethodEndpointAdapter"
class="org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter">
<property name="methodArgumentResolvers">
<list>
<ref bean="marshallingPayloadMethodProcessor" />
</list>
</property>
<property name="methodReturnValueHandlers">
<list>
<ref bean="marshallingPayloadMethodProcessor" />
</list>
</property>
</bean>
</beans>
And finally, CLIP_PoC.xsd, the schema from which the WSDL was generated:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="clip" targetNamespace="clip" version="1.0">
<xs:element name="clipClaimRequest" type="CLIPClaimRequest"/>
<xs:element name="clipClaimResponse" type="CLIPClaimResponse"/>
<!-- type definitions for all the complex elements used... -->
</xs:schema>
I figured it out. I had forgotten to put: <context:component-scan base-package="my.base.package"/> in my spring-ws-servlet.xml file. This fixed it somehow.