[JBoss Seam] - Re: selectOneMenu - NPE
by w17chm4n
Exception
| 10:40:36,766 ERROR [STDERR] Nov 19, 2007 10:40:36 AM com.sun.facelets.FaceletViewHandler handleRenderException
| SEVERE: Error Rendering View[/question.xhtml]
| java.lang.NullPointerException
| at org.jboss.seam.ui.converter.EntityConverterStore.getEntityManager(EntityConverterStore.java:81)
| at org.jboss.seam.ui.converter.EntityConverterStore.put(EntityConverterStore.java:60)
| 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:585)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
| at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
| at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:38)
| at org.jboss.seam.util.Work.workInTransaction(Work.java:40)
| at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:32)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
| at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:155)
| at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:91)
| at org.jboss.seam.ui.converter.EntityConverterStore_$$_javassist_0.put(EntityConverterStore_$$_javassist_0.java)
| at org.jboss.seam.ui.converter.EntityConverter.getAsString(EntityConverter.java:67)
| at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getFormattedValue(HtmlBasicRenderer.java:469)
| at com.sun.faces.renderkit.html_basic.MenuRenderer.renderOption(MenuRenderer.java:502)
| at com.sun.faces.renderkit.html_basic.MenuRenderer.renderOptions(MenuRenderer.java:757)
| at com.sun.faces.renderkit.html_basic.MenuRenderer.renderSelect(MenuRenderer.java:811)
| at com.sun.faces.renderkit.html_basic.MenuRenderer.encodeEnd(MenuRenderer.java:335)
| at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:836)
| at javax.faces.component.UIComponent.encodeAll(UIComponent.java:896)
| at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
| at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
| at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
| at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
| at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
| at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
| at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
| at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
| at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
| 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:230)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
| 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:157)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
| at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
| at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
| at java.lang.Thread.run(Thread.java:595)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4105940#4105940
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4105940
18 years, 8 months
[JBossWS] - Returning Complex Type
by burakbayramli
Hi all,
While trying to return a complex type from a Web Service and I am experiencing some problems:
I am on JBoss 4.2.1.GA and jbossws-1.2.1.GA.
My client receives
Exception in thread "main" org.jboss.ws.WSException: Cannot obtain java/xml type mapping for: {http://service.gg.com/}Product
| at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCMetaDataBuilder.processOutputDocElement(JAXRPCMetaDataBuilder.java:778)
| at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCMetaDataBuilder.buildParameterMetaDataDoc(JAXRPCMetaDataBuilder.java:897)
| at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCMetaDataBuilder.setupOperationsFromWSDL(JAXRPCMetaDataBuilder.java:214)
| at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientMetaDataBuilder.buildMetaDataInternal(JAXRPCClientMetaDataBuilder.java:216)
| at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientMetaDataBuilder.buildMetaData(JAXRPCClientMetaDataBuilder.java:133)
| at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientMetaDataBuilder.buildMetaData(JAXRPCClientMetaDataBuilder.java:85)
| at org.jboss.ws.core.jaxrpc.client.ServiceImpl.<init>(ServiceImpl.java:111)
| at org.jboss.ws.core.jaxrpc.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:157)
| at org.jboss.ws.core.jaxrpc.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:128)
| at com.gg.service.Client.main(Client.java:20)
|
If I comment out the method which returns the complex type, the client code works fine.
Any ideas would be appreciated,
The code is below;
@WebService
| @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE)
| public interface ProductDb extends Remote {
|
| @WebMethod String getProductTitle(int id);
|
| @WebMethod Product getProduct();
|
| }
|
@Stateless
| @WebService(endpointInterface="com.gg.service.ProductDb")
| @WebContext(contextRoot="/ggServices")
| public class ProductDbBean implements ProductDb {
|
| @PersistenceContext(unitName="GGLocal")
| EntityManager em;
|
| public String getProductTitle(int id) {
| Product prd = em.find(Product.class, id);
| return prd.getTitle();
| }
|
| public Product getProduct() {
| List<Product> l = em.createQuery("from Product").getResultList();
| return l.get(0);
| }
| }
|
public class Client
| {
| public static void main(String[] args) throws Exception
| {
| URL url = new URL("http://localhost:8080/ggServices/ProductDbBean?wsdl");
| QName qname = new QName("http://service.gg.com/", "ProductDbBeanService");
|
| ServiceFactory factory = ServiceFactory.newInstance();
| Service service = factory.createService(url, qname);
| ProductDb s = (ProductDb) service.getPort(ProductDb.class);
|
| String test = s.getProductTitle(1);
| }
| }
|
WSDL
<definitions name='ProductDbBeanService' targetNamespace='http://service.gg.com/' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://service.gg.com/' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
| <types>
| <xs:schema targetNamespace='http://service.gg.com/' version='1.0' xmlns:tns='http://service.gg.com/' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
| <xs:element name='Product' type='tns:Product'/>
| <xs:element name='getProductResponse' nillable='true' type='tns:Product'/>
| <xs:element name='getProductTitle' type='xs:int'/>
| <xs:element name='getProductTitleResponse' nillable='true' type='xs:string'/>
| <xs:complexType name='Product'>
| <xs:sequence>
| <xs:element form='qualified' name='id' type='xs:int'/>
| <xs:element form='qualified' name='title' type='xs:string'/>
| </xs:sequence>
| </xs:complexType>
| </xs:schema>
| </types>
| <message name='ProductDb_getProduct'></message>
| <message name='ProductDb_getProductResponse'>
| <part element='tns:getProductResponse' name='getProductResponse'></part>
| </message>
| <message name='ProductDb_getProductTitleResponse'>
| <part element='tns:getProductTitleResponse' name='getProductTitleResponse'></part>
| </message>
| <message name='ProductDb_getProductTitle'>
| <part element='tns:getProductTitle' name='getProductTitle'></part>
| </message>
| <portType name='ProductDb'>
| <operation name='getProduct'>
| <input message='tns:ProductDb_getProduct'></input>
| <output message='tns:ProductDb_getProductResponse'></output>
| </operation>
| <operation name='getProductTitle' parameterOrder='getProductTitle'>
| <input message='tns:ProductDb_getProductTitle'></input>
| <output message='tns:ProductDb_getProductTitleResponse'></output>
| </operation>
| </portType>
| <binding name='ProductDbBinding' type='tns:ProductDb'>
| <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
| <operation name='getProduct'>
| <soap:operation soapAction=''/>
| <input>
| <soap:body use='literal'/>
| </input>
| <output>
| <soap:body use='literal'/>
| </output>
| </operation>
| <operation name='getProductTitle'>
| <soap:operation soapAction=''/>
| <input>
| <soap:body use='literal'/>
| </input>
| <output>
| <soap:body use='literal'/>
| </output>
| </operation>
| </binding>
| <service name='ProductDbBeanService'>
| <port binding='tns:ProductDbBinding' name='ProductDbBeanPort'>
| <soap:address location='http://127.0.0.1:8080/ggServices/ProductDbBean'/>
| </port>
| </service>
| </definitions>
POJO:
@Entity
| @Table(name="urun")
| @XmlAccessorType(XmlAccessType.FIELD)
| @XmlType(name = "Product", namespace="http://service.gg.com/",
| propOrder = { "id", "title"})
| @XmlRootElement(namespace="http://service.gg.com/", name = "Product")
| public class Product implements Serializable {
|
| @Id
| @Column(name="urun_id")
| @XmlElement(namespace="http://service.gg.com/", required = true)
| private Integer id;
|
| @Column(length=60)
| @XmlElement(namespace="http://service.gg.com/", required = true)
| private String title;
|
| public String getTitle() {
| return title;
| }
|
| public void setTitle(String title) {
| this.title = title;
| }
|
| public Integer getId() {
| return id;
| }
|
| public void setId(Integer id) {
| this.id = id;
| }
|
|
|
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4105932#4105932
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4105932
18 years, 8 months
[JBoss Seam] - Tranforming a db 1 record row into a vertical table jsf disp
by martin3
Hi,
In switching to seam(and POJO's) and keeping with the spirit of seam now being the handy glue from ejb's to jsf based pages, what would be the way to take a query that always produces one record row and then display to the user in columns in a jsf table or data grid? One record field now per jsf row? It is a common thing I do in my old self-deprecated glue and I'm wanting to replace it with seam.
Each field of the Entity now is a row in the display; often put the queries' column title in the first column, second column is the field's value and a third is the units of the value.
| @Entity
| @Name("element")
| @Table(name = "ELEMENT")
| @NamedQueries({@NamedQuery(name = "Element.findByElementPk", query = "SELECT e FROM Element e WHERE e.elementPk = :elementPk"), @NamedQuery(name = "Element.findByName", query = "SELECT e FROM Element e WHERE e.name = :name"), @NamedQuery(name = "Element.findByAtomicNumber", query = "SELECT e FROM Element e WHERE e.atomicNumber = :atomicNumber"), @NamedQuery(name = "Element.findByAtomicSymbol", query = "SELECT e FROM Element e WHERE e.atomicSymbol = :atomicSymbol"), @NamedQuery(name = "Element.findByAtomicWeight", query = "SELECT e FROM Element e WHERE e.atomicWeight = :atomicWeight"), @NamedQuery(name = "Element.findByAtomicRadius", query = "SELECT e FROM Element e WHERE e.atomicRadius = :atomicRadius"), @NamedQuery(name = "Element.findByMeltingPoint", query = "SELECT e FROM Element e WHERE e.meltingPoint = :meltingPoint"), @NamedQuery(name = "Element.findByBoilingPoint", query = "SELECT e FROM Element e WHERE e.boilingPoint = :boilingPoint"), @NamedQuery(name = "Element.findByOxidationStates", query = "SELECT e FROM Element e WHERE e.oxidationStates = :oxidationStates"), @NamedQuery(name = "Element.findByElectronConfiguration", query = "SELECT e FROM Element e WHERE e.electronConfiguration = :electronConfiguration")})
| public class Element implements Serializable {
| private static final long serialVersionUID = 1L;
| @Id
| @Column(name = "ELEMENT_PK", nullable = false)
| private Integer elementPk;
| @Column(name = "NAME")
| private String name;
| @Column(name = "ATOMIC_NUMBER")
| private Short atomicNumber;
| @Column(name = "ATOMIC_SYMBOL")
| private String atomicSymbol;
| @Column(name = "ATOMIC_WEIGHT")
| private Double atomicWeight;
| @Column(name = "ATOMIC_RADIUS")
| private Double atomicRadius;
| @Column(name = "MELTING_POINT")
| private Double meltingPoint;
| @Column(name = "BOILING_POINT")
| private Double boilingPoint;
| @Column(name = "OXIDATION_STATES")
| private Short oxidationStates;
| @Column(name = "ELECTRON_CONFIGURATION")
| private String electronConfiguration;
|
So the jsf table is now three columns labeled:
Parameter Value Units
Name Hydrogen
Atomic Number: 1
Atomic Radius 78 pm
Atomic Symbol H
Melting Point - 259.34 �C
Atomic Weight 1.0079 g/mol
Boiling Point -252.87 �C
Electron Configuration 1s1
Oxidation States 1, -1
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4105930#4105930
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4105930
18 years, 8 months