[Beginners Corner] - How to correctly work with Many to One relationships.
by henri_tudor
Hi...
In the scope of a project we're working on, we're sometimes running into trouble with One to Many relationships. We've found two working scenarios but can't realy figure out whether they are "principaly correct" or not.
Scenario 1
----------
Lets assume a table parent and a table child, knowing that many child records may reference a single parent. (BTW we're using Postgres)
CREATE TABLE parent
(
id SERIAL PRIMARY KEY,
name VARCHAR(128)
);
CREATE TABLE child
(
id SERIAL PRIMARY KEY,
parent_id INTEGER,
name VARCHAR(128)
);
ALTER TABLE child ADD CONSTRAINT fk_parent_id FOREIGN KEY (parent_id) REFERENCES parent(id) ON DELETE CASCADE;
In the parent Entity Bean, we have a property children, which is a collection, and which is mapped as follows:
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "parent_id")
public Collection getChildren ()
{
return children;
}
In the Child Entity Bean, we have a parentId property of type Integer, which is mapped as follows:
@Column(name = "parent_id", updatable=false, insertable=false)
public Integer getParentId()
{
return parentId;
}
This scenario works fine as long as no NOT NULL constraints are being specified for the foreign key parent_id. It also fails as soon as the updatable and insertable attributes are removed from the child mapping.
The advantage of this scheme is:
We only have to add childs to the children collection an to perist the parent in order to store both the parent and the children. No need to previously set the parentId of the children.
Scenario 2
----------
Another scenario we have tried is as follows: Again the two tables (please note the addition NOT NULL constraint.
CREATE TABLE parent
(
id SERIAL PRIMARY KEY,
name VARCHAR(128)
);
CREATE TABLE child
(
id SERIAL PRIMARY KEY,
parent_id INTEGER NOT NULL,
name VARCHAR(128)
);
ALTER TABLE child ADD CONSTRAINT fk_parent_id FOREIGN KEY (parent_id) REFERENCES parent(id) ON DELETE CASCADE;
In the parent Entity Bean, we have a property children, which is a collection, and which is mapped as follows:
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "parent_id")
public Collection getChildren ()
{
return children;
}
In the Child Entity Bean, we have a parent property of type Parent, which is mapped as follows:
@ManyToOne
@JoinColumn(name="parent_id")
public Parent getParent()
{
return parent;
}
Disadvantage of this solution is that we have to explicitly tell each child who his parent is.
Question
--------
1.) Both solution appear to fail when it comes to deleting children, though. In both cases we have to explicitely determine which children are no longer require and we have to remove them explicitely. Are there other ways of using One to Many relationships ?
2.) My guts tell me that the second scenario appears to be more "as intended by the inventor" or am I wrong ?
Many thanks in advance for your help...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993441#3993441
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993441
19 years, 4 months
[JBoss Seam] - Re: Fileupload
by mvinayam
"robinemig" wrote : Any chance this can be added to one of the demos? I'm still have problems getting it to work correctly.
hi robinemig,
I am facing the same prbolem of "javax.faces.el.EvaluationException: Cannot set value for expression '#{resultRow.uploadedFile}' to a new value of type org.apache.myfaces.custom.
fileupload.UploadedFileDefaultFileImpl" . I have a datatable within which I have the inputFileUpload & the value is binded with the DTO object. Here is my code. Any help is greatly Appreciated. Need this to be done asap.
| JSF
|
| <%@ taglib uri = "http://java.sun.com/jsf/html" prefix="h"%>
| <%@ taglib uri = "http://java.sun.com/jsf/core" prefix="f"%>
| <%@ taglib uri = "http://myfaces.apache.org/tomahawk" prefix = "t"%>
|
| <f:view>
| <f:verbatim>
| <html>
| <head>
| <title>Mailing Upload</title>
| <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/styleSheet/PzStyles.css">
| <script type="text/javascript" src="<%=request.getContextPath()%>/script/PzUtil.js"></script>
| <script type="text/javascript">
| function trim(field){
| field.value = Trim(field.value).toUpperCase();
| }
|
| function validateAndSetCounter(){
| var retValue = true;
| var elements = document.getElementsByTagName("input");
| for(i=0;i<elements.length;i++){
| if(elements.type=="file" && elements.id.indexOf("pdfFile")>=0 && elements.value.length<=0){
| alert("Select a PDF file to Print");
| elements.focus();
| retValue = false;
| break;
| }
| else if(elements.type=="file" && elements.id.indexOf("pdfFile")>=0 && elements.value.length>0 && elements.value.indexOf(".pdf")<0){
| alert("Invalid PDF file");
| retValue = false;
| break;
| }
| else if(elements.id.indexOf("rowCount")>=0){
| document.getElementById("mailingUpload:pdfCounter").value = elements.value;
| }
| }
| return retValue;
| }
| </script>
| </head>
| <body>
| </f:verbatim>
|
| <h:form id="mailingUpload" enctype="multipart/form-data">
| <h:panelGrid align="center" width="100%" columnClasses="c6Middle">
| <h:outputText styleClass="c7" value="Mailing Interface"/>
| </h:panelGrid>
| <f:verbatim>
| <fieldset class="c19" align="center">
| <legend style="c6">Mailing Upload</legend>
| </f:verbatim>
| <h:messages layout="table" globalOnly="true" styleClass="c3r" showSummary="false" showDetail="true"/>
| <h:panelGrid border="0" align="center" columns="2" width="100%" columnClasses="c6rt25, c6lt25">
| <h:outputText styleClass="c4r" value="* "/>
| <h:outputText value="Mandatory Fields"/>
|
| <h:outputText styleClass="c4r" value="** "/>
| <h:outputText value="Mandatory when Address Field is Selected"/>
|
| <h:panelGroup>
| <h:outputText styleClass="c4r" value="* "/>
| <h:outputText value="Description: "/>
| </h:panelGroup>
| <h:panelGroup>
| <h:inputText id="desc" styleClass="c12" value="#{MailingBacking.mailingDesc}" onchange="trim(this)" required="true">
| <f:attribute name="errMsg" value="Description"/>
| </h:inputText>
| <h:message for="desc" styleClass="c3r"/>
| </h:panelGroup>
|
| <h:panelGroup>
| <h:outputText styleClass="c4r" value="* "/>
| <h:outputText value="Total Quantity: "/>
| </h:panelGroup>
| <h:panelGroup>
| <h:inputText id="totQty" styleClass="c12" value="#{MailingBacking.totalQty}" onchange="trim(this)" required="true">
| <f:attribute name="errMsg" value="Total Quantity"/>
| </h:inputText>
| <h:message for="totQty" styleClass="c3r"/>
| </h:panelGroup>
|
| <h:panelGroup>
| <h:outputText styleClass="c4r" value="* "/>
| <h:outputText value="Item Type: "/>
| </h:panelGroup>
|
| <h:panelGroup>
| <h:selectOneMenu id="itemType" value="#{MailingBacking.itemTypeId}" styleClass="c12" required="true">
| <f:selectItem itemValue="" itemLabel="--Select--"/>
| <f:selectItems value="#{MailingBacking.itemTypeList}"/>
| <f:attribute name="errMsg" value="Item Type"/>
| </h:selectOneMenu>
| <h:message for="itemType" styleClass="c3r"/>
| </h:panelGroup>
|
| <h:panelGroup>
| <h:outputText value="Address File: "/>
| </h:panelGroup>
| <h:panelGroup>
| <t:inputFileUpload id="addressFile" styleClass="c12" value="#{MailingBacking.uploadedFile}" onchange="trim(this)" storage="file">
| <f:attribute name="errMsg" value="Address File"/>
| </t:inputFileUpload>
| <h:message for="addressFile" styleClass="c3r"/>
| </h:panelGroup>
|
| <h:panelGroup>
| <h:outputText styleClass="c4r" value="** "/>
| <h:outputText value="Group Number: "/>
| </h:panelGroup>
| <h:panelGroup>
| <h:inputText id="groupRef" styleClass="c12" value="#{MailingBacking.groupRef}" onchange="trim(this)">
| <f:attribute name="errMsg" value="Group Number"/>
| </h:inputText>
| <h:message for="groupRef" styleClass="c3r"/>
| </h:panelGroup>
| </h:panelGrid>
| <h:panelGrid align="center" columnClasses="c6Middle" width="100%">
| <t:dataTable id="pdfFiles" value="#{MailingBacking.pdfFileList}" renderedIfEmpty="false"
| headerClass="tableHeader" styleClass="tableStyle" align="center" var="resultRow" rowCountVar="rowCount">
| <t:column>
| <f:facet name="header">
| <h:outputText styleClass="c3" value=" PDF Print File "/>
| </f:facet>
| <t:inputFileUpload storage="file" id="pdfFile" styleClass="c12" value="#{resultRow.uploadedFile}" onchange="trim(this)" required="true"/>
| <h:inputHidden id="rowCount" value="#{rowCount}"/>
| </t:column>
| </t:dataTable>
| <h:inputHidden id="pdfCounter" value="#{MailingBacking.pdfCounter}"/>
| <h:commandButton id="addPdf" value="Add PDF Supplement" styleClass="c15" onclick="return validateAndSetCounter();" action="#{MailingBacking.addNewPdf}"/>
| </h:panelGrid>
| </h:form>
| <f:verbatim>
| </body>
| </html>
| </f:verbatim>
| </f:view>
|
| BackingBean
|
| package com.cci.pz.web.orderMgmt.mailing;
|
| import java.sql.Timestamp;
| import java.util.ArrayList;
| import java.util.Enumeration;
|
| import javax.faces.context.FacesContext;
| import javax.faces.model.SelectItem;
| import javax.naming.Context;
| import javax.naming.InitialContext;
| import javax.servlet.http.HttpServletRequest;
|
| import org.apache.myfaces.custom.fileupload.UploadedFile;
|
| import com.cci.pz.data.orderMgmt.mailing.PzMailingLineDTO;
| import com.cci.pz.entity.catalogMgmt.PzItemTypes;
| import com.cci.pz.session.catalogMgmt.PzItemTypeFacade;
| import com.cci.pz.web.login.PzUserObject;
|
| public class MailingBackingBean{
|
| private String addrFileNameIn;
| private Timestamp dueDate;
| private String groupRef;
| private String mailingDesc;
| private String fileNameIn;
| private Long itemTypeId;
| private Long totalQty;
| private Long lineQty;
| private Long pdfCounter = 0L;
| private ArrayList<PzMailingLineDTO> pdfFileList;
| private PzUserObject userSessionObj;
| private UploadedFile uploadedFile;
|
| PzItemTypeFacade itemTypeFacade;
|
| HttpServletRequest request = null;
|
| public MailingBackingBean()throws Exception{
| Context ctx = new InitialContext();
| itemTypeFacade = (PzItemTypeFacade)ctx.lookup(PzItemTypeFacade.class.getName());
| request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
| Enumeration ee = request.getParameterNames();
| while(ee.hasMoreElements()){
| String name = (String)ee.nextElement();
| if(name.indexOf("rowCount")>=0){
| String value = request.getParameter(name);
| System.out.println(name+":"+value);
| if(value!=null && value.length()>0){
| this.pdfCounter = Long.parseLong(value);
| }
| }
| }
|
| }
|
| public String getAddrFileNameIn() {
| return addrFileNameIn;
| }
|
| public void setAddrFileNameIn(String addrFileNameIn) {
| this.addrFileNameIn = addrFileNameIn;
| }
|
|
| public Timestamp getDueDate() {
| return dueDate;
| }
|
| public void setDueDate(Timestamp dueDate) {
| this.dueDate = dueDate;
| }
|
| public String getFileNameIn() {
| return fileNameIn;
| }
|
| public void setFileNameIn(String fileNameIn) {
| this.fileNameIn = fileNameIn;
| }
|
| public String getGroupRef() {
| return groupRef;
| }
|
| public void setGroupRef(String groupRef) {
| this.groupRef = groupRef;
| }
|
| public Long getItemTypeId() {
| return itemTypeId;
| }
|
| public void setItemTypeId(Long itemTypeId) {
| this.itemTypeId = itemTypeId;
| }
|
| public Long getLineQty() {
| return lineQty;
| }
|
| public void setLineQty(Long lineQty) {
| this.lineQty = lineQty;
| }
|
| public String getMailingDesc() {
| return mailingDesc;
| }
|
| public void setMailingDesc(String mailingDesc) {
| this.mailingDesc = mailingDesc;
| }
|
| public SelectItem[] getItemTypeList(){
| SelectItem[] selectItems = new SelectItem[]{};
| ArrayList<PzItemTypes> itemTypeList = itemTypeFacade.getItemTypes(this.getUserSessionObj().getClientCode(),"A");
| if(itemTypeList!=null && itemTypeList.size()>0){
| selectItems = new SelectItem[itemTypeList.size()];
| for(int i=0;i<itemTypeList.size();i++){
| selectItems = new SelectItem((itemTypeList.get(i)).getItemTypeId(),(itemTypeList.get(i)).getItemTypeDesc());
| }
| }
| return selectItems;
| }
|
| public PzUserObject getUserSessionObj() {
| return userSessionObj;
| }
|
| public void setUserSessionObj(PzUserObject userSessionObj) {
| this.userSessionObj = userSessionObj;
| }
|
| public Long getTotalQty() {
| return totalQty;
| }
|
| public void setTotalQty(Long totalQty) {
| this.totalQty = totalQty;
| }
|
| public ArrayList<PzMailingLineDTO> getPdfFileList() {
| System.out.println("inside getPdfFileList pdfFileCounter : "+this.pdfCounter);
| System.out.println("inside getPdfFileList pdfFileList : "+this.pdfFileList);
| if(this.pdfCounter!=null && this.pdfCounter.longValue()==0){
| this.pdfFileList = new ArrayList<PzMailingLineDTO>();
| this.pdfFileList.add(new PzMailingLineDTO());
| }
| else if(this.pdfFileList==null){
| this.pdfFileList = new ArrayList<PzMailingLineDTO>();
| }
| if(this.pdfFileList.size()<this.pdfCounter.intValue()){
| int i = this.pdfFileList.size();
| for(;i<this.pdfCounter.intValue();i++){
| this.pdfFileList.add(new PzMailingLineDTO());
| }
| }
| System.out.println("PdfList Size frm getPdfFileList: "+this.pdfFileList.size());
| return pdfFileList;
| }
|
| public void addNewPdf(){
| System.out.println("inside addNewPdf");
| if(this.getPdfFileList()!=null){
| System.out.println("PdfList Size: "+this.pdfFileList.size());
| for(PzMailingLineDTO lineDTO:this.pdfFileList){
| System.out.println(lineDTO.getUploadedFile().getName()+":"+lineDTO.getUploadedFile().getContentType());
| }
| this.pdfFileList.add(new PzMailingLineDTO());
| }
| }
|
| public void setPdfFileList(ArrayList<PzMailingLineDTO> pdfFileList) {
| this.pdfFileList = pdfFileList;
| }
|
| public Long getPdfCounter() {
| return pdfCounter;
| }
|
| public void setPdfCounter(Long pdfCounter) {
| this.pdfCounter = pdfCounter;
| }
|
| public void upload(){
| UploadedFile uploadedFile = this.getUploadedFile();
| String uploadedFileName = uploadedFile.getName();
| System.out.println("File Name : "+uploadedFileName);
| }
|
| public UploadedFile getUploadedFile() {
| return uploadedFile;
| }
|
| public void setUploadedFile(UploadedFile uploadedFile) {
| this.uploadedFile = uploadedFile;
| }
| }
|
| DTO
| package com.cci.pz.data.orderMgmt.mailing;
|
|
| import org.apache.myfaces.custom.fileupload.UploadedFile;
|
| import com.cci.pz.data.util.GlobalDbDataHolder;
|
| public class PzMailingLineDTO implements GlobalDbDataHolder {
| private String fileNameIn;
|
| private String fileNameProc;
|
| private String itemNum;
|
| private Long itemTypeId;
|
| private Long lineNumber;
|
| private Long lineQty;
|
| private Long mailingLineId;
|
| private Long pageCount;
|
| private Long mailingId;
|
| private UploadedFile uploadedFile;
|
| public PzMailingLineDTO() {
| }
|
| public String getFileNameIn() {
| return fileNameIn;
| }
|
| public void setFileNameIn(String fileNameIn) {
| this.fileNameIn = fileNameIn;
| }
|
| public String getFileNameProc() {
| return fileNameProc;
| }
|
| public void setFileNameProc(String fileNameProc) {
| this.fileNameProc = fileNameProc;
| }
|
| public String getItemNum() {
| return itemNum;
| }
|
| public void setItemNum(String itemNum) {
| this.itemNum = itemNum;
| }
|
| public Long getItemTypeId() {
| return itemTypeId;
| }
|
| public void setItemTypeId(Long itemTypeId) {
| this.itemTypeId = itemTypeId;
| }
|
| public Long getLineNumber() {
| return lineNumber;
| }
|
| public void setLineNumber(Long lineNumber) {
| this.lineNumber = lineNumber;
| }
|
| public Long getLineQty() {
| return lineQty;
| }
|
| public void setLineQty(Long lineQty) {
| this.lineQty = lineQty;
| }
|
| public Long getMailingLineId() {
| return mailingLineId;
| }
|
| public void setMailingLineId(Long mailingLineId) {
| this.mailingLineId = mailingLineId;
| }
|
| public Long getPageCount() {
| return pageCount;
| }
|
| public void setPageCount(Long pageCount) {
| this.pageCount = pageCount;
| }
|
| public Long getMailingId() {
| return mailingId;
| }
|
| public void setMailingId(Long mailingId) {
| this.mailingId = mailingId;
| }
|
| public UploadedFile getUploadedFile() {
| return uploadedFile;
| }
|
| public void setUploadedFile(UploadedFile pdfPrintFile) {
| this.uploadedFile = pdfPrintFile;
| }
|
| }
|
| web.xml
| <?xml version="1.0" ?>
| <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
| version="2.4">
| <distributable />
|
| <listener>
| <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</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>
|
| <servlet>
| <servlet-name>Login Servlet</servlet-name>
| <servlet-class>com.cci.pz.web.login.LoginServlet</servlet-class>
| <load-on-startup>1</load-on-startup>
| </servlet>
|
| <servlet-mapping>
| <servlet-name>Login Servlet</servlet-name>
| <url-pattern>/LoginServlet</url-pattern>
| </servlet-mapping>
|
| <servlet>
| <servlet-name>PlaceOrder Servlet</servlet-name>
| <servlet-class>com.cci.pz.web.PlaceOrder</servlet-class>
| <load-on-startup>1</load-on-startup>
| </servlet>
|
| <servlet-mapping>
| <servlet-name>PlaceOrder Servlet</servlet-name>
| <url-pattern>/PlaceOrder</url-pattern>
| </servlet-mapping>
|
| <servlet>
| <servlet-name>Komatsu Servlet</servlet-name>
| <servlet-class>com.cci.pz.web.xmlProcess.Komatsu</servlet-class>
| <load-on-startup>1</load-on-startup>
| </servlet>
|
| <servlet-mapping>
| <servlet-name>Komatsu Servlet</servlet-name>
| <url-pattern>/Komatsu</url-pattern>
| </servlet-mapping>
|
| <filter>
| <filter-name>MyFacesExtensionsFilter</filter-name>
| <filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
| <init-param>
| <param-name>maxFileSize</param-name>
| <param-value>20m</param-value>
| </init-param>
| </filter>
|
| <!-- extension mapping for adding <script/>, <link/>, and other resource tags to JSF-pages -->
| <filter-mapping>
| <filter-name>MyFacesExtensionsFilter</filter-name>
| <!-- servlet-name must match the name of your javax.faces.webapp.FacesServlet entry -->
| <servlet-name>Faces Servlet</servlet-name>
| </filter-mapping>
|
| <!-- extension mapping for serving page-independent resources (javascript, stylesheets, images, etc.) -->
| <filter-mapping>
| <filter-name>MyFacesExtensionsFilter</filter-name>
| <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
| </filter-mapping>
|
| <!-- extension mapping for adding <script/>, <link/>, and other resource tags to JSF-pages -->
| <filter-mapping>
| <filter-name>MyFacesExtensionsFilter</filter-name>
| <url-pattern>*.jsf</url-pattern>
| </filter-mapping>
|
| <filter>
| <filter-name>extensionsFilter</filter-name>
| <filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
| <init-param>
| <param-name>uploadMaxFileSize</param-name>
| <param-value>100m</param-value>
| </init-param>
| <init-param>
| <param-name>uploadThresholdSize</param-name>
| <param-value>100k</param-value>
| </init-param>
|
| <init-param>
| <param-name>uploadRepositoryPath</param-name>
| <param-value>C:\jboss-4.0.3SP1\server\default\deploy\jbossweb-tomcat55.sar\ROOT.war\mailUpload\</param-value>
| </init-param>
| </filter>
|
| <filter-mapping>
| <filter-name>extensionsFilter</filter-name>
| <url-pattern>*.jsf</url-pattern>
| </filter-mapping>
|
| <context-param>
| <param-name>pz3FilePath</param-name>
| <param-value>c:\jboss-4.0.3SP1\server\default\</param-value>
| </context-param>
|
| <context-param>
| <param-name>pz3ViewableLocation</param-name>
| <param-value>C:\jboss-4.0.3SP1\server\default\deploy\jbossweb-tomcat55.sar\ROOT.war\pz3Viewable\</param-value>
| </context-param>
|
| <context-param>
| <param-name>pz3Viewables</param-name>
| <param-value>http://hq00416:8080/pz3Viewable/</param-value>
| </context-param>
| </web-app>
|
| Thanks & Regds
| Viji
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993438#3993438
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993438
19 years, 4 months
[JBoss Messaging] - Re: LeasePinger error
by clebert.suconic@jboss.com
I meant to ask if you have seen the exception listed on JBREM-649.
On my tests I got some other exceptions.. and the main one was this:
ava.lang.reflect.InvocationTargetException
| at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:324)
| at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithMethod(RegularObjectPersister.java:120)
| at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:86)
| at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
| at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
| at org.jboss.serial.persister.ObjectOutputStreamProxy.writeObjectOverride(ObjectOutputStreamProxy.java:60)
| at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:274)
| at java.util.HashMap.writeObject(HashMap.java:986)
| at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:324)
| at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithMethod(RegularObjectPersister.java:120)
| at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:86)
| at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
| at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
| at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
| at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
| at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
| at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
| at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
| at org.jboss.serial.io.JBossObjectOutputStream.writeObjectOverride(JBossObjectOutputStream.java:181)
| at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:274)
| at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.sendObject(JavaSerializationManager.java:86)
| at org.jboss.remoting.marshal.serializable.SerializableMarshaller.write(SerializableMarshaller.java:84)
| at org.jboss.jms.server.remoting.JMSWireFormat.write(JMSWireFormat.java:310)
| at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.versionedWrite(MicroSocketClientInvoker.java:518)
| at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:340)
| at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:125)
| at org.jboss.remoting.LeasePinger.sendClientPing(LeasePinger.java:97)
| at org.jboss.remoting.LeasePinger$LeaseTimerTask.run(LeasePinger.java:216)
| at java.util.TimerThread.mainLoop(Timer.java:432)
| at java.util.TimerThread.run(Timer.java:382)
| Caused by: java.util.ConcurrentModificationException
| at java.util.HashMap$HashIterator.nextEntry(HashMap.java:782)
| at java.util.HashMap$EntryIterator.next(HashMap.java:824)
| at java.util.HashMap.writeObject(HashMap.java:984)
| ... 36 more
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993436#3993436
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993436
19 years, 4 months
[JBossWS] - Re: SOAP Error- DefaultNamespace doesnot contain operation m
by pshankar
I have the log file showing the following information
UnifiedMetaData:
| securityDomain: null
|
|
| ServiceMetaData:
| name={http://DefaultNamespace}MySpringServiceService
| wsdName=MySpringService
| wsdlFile=WEB-INF/wsdl/myspringservice.wsdl
| jaxrpcFile=WEB-INF/jaxrpc-mapping.xml
| publishLocation=null
| properties=null
|
| TypesMetaData:
|
|
| ServerEndpointMetaData:
| name={http://DefaultNamespace}MySpringService
| id=jboss.ws:context=MySpringService,endpoint=MySpringServiceServlet
| address=http://MSN17089C:8080/MySpringService/
| linkName=MySpringServiceServlet
| implName=MySpringServiceImplementation
| seiName=MySpringService
| annotated=false
| portComponentName=MySpringService
| contextRoot=/MySpringService
| urlPattern=/
| configFile=null
| configName=null
| authMethod=null
| transportGuarantee=null
| properties=null
|
| OperationMetaData:
| xmlName={http://DefaultNamespace}getName
| javaName=getName
| style=rpc/literal
| oneWay=false
| soapAction=
| ReturnMetaData:
| xmlName=getNameReturn
| xmlType={http://www.w3.org/2001/XMLSchema}string
| javaType=java.lang.String
| mode=OUT
| inHeader=false
|
| OperationMetaData:
| xmlName={http://DefaultNamespace}setName
| javaName=setName
| style=rpc/literal
| oneWay=false
| soapAction=
| ParameterMetaData:
| xmlName=in0
| xmlType={http://www.w3.org/2001/XMLSchema}string
| javaType=java.lang.String
| mode=IN
| inHeader=false
My Client use the following
private static String endpoint = "http://localhost:8080/MySpringService/";
|
| private static String qnameService = "MySpringService";
|
| private static String qnamePort = "MySpringService";
|
| private static String ENCODING_STYLE_PROPERTY = "javax.xml.rpc.encodingstyle.namespace.uri";
|
| private static String NS_XSD = "http://www.w3.org/2001/XMLSchema";
|
| private static String URI_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/";
|
| public static void main(String[] args) {
|
| System.out.println("Endpoint address = " + endpoint);
|
| try {
| ServiceFactory factory = ServiceFactory.newInstance();
| Service service = factory.createService(new QName(qnameService));
|
| QName port = new QName(qnamePort);
|
| Call call = service.createCall(port);
| call.setTargetEndpointAddress(endpoint);
| call.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean(true));
| call.setProperty(Call.SOAPACTION_URI_PROPERTY, "");
| call.setProperty(ENCODING_STYLE_PROPERTY, URI_ENCODING);
| QName QNAME_TYPE_STRING = new QName(NS_XSD, "string");
| call.setReturnType(QNAME_TYPE_STRING);
Can you suggest what need to be changed?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993435#3993435
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993435
19 years, 4 months