<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Web Services class not known in context
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/teakins">Tim Eakins</a> in <i>JBoss Web Services</i> - <a href="http://community.jboss.org/message/535672#535672">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>This is probably a simple one, but I'm stuck.&#160; I call a new Web Service, queryByObject, which could return several different objects.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I have the below test case to return a User object.&#160; If I change the method signature to return a User, it works.&#160; If I leave it as an Object, I get '<span style="font-family: courier new,courier;">javax.xml.bind.JAXBException: class pfcommon.data.User nor any of its super class is known to this context.</span>'&#160; Even with the XmlSeeAlso, it just won't add User into the schema.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Any help really appreciated!&#160; I put in all the components that I felt were relevant.&#160; JBoss 5.1.0.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Also, if there's anything else wrong in my style, happy to take comments, this is my first attempt at expanding my working EJBs to also be Web Services.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Thanks,<br/>Tim</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><br/><strong>//Interface</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;">@WebService<br/>@SOAPBinding(style = SOAPBinding.Style.DOCUMENT)<br/>@XmlSeeAlso({pfcommon.data.User.class})<br/>public interface TestConnectionInterface {<br/>...<br/>&#160;&#160;&#160; /**<br/>&#160;&#160;&#160;&#160; * Select back one value<br/>&#160;&#160;&#160;&#160; */<br/>&#160;&#160;&#160; @WebMethod<br/>&#160;&#160;&#160; public Object queryForObject(String queryName, HashMap&lt;String, Object&gt; criteria);<br/>...<br/>}</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>//Remote</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;">@Remote<br/>public interface TestConnectionInterfaceRemote extends TestConnectionInterface { }</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>//Implementation</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;">@Stateless<br/>@WebService(endpointInterface="pfcommon.ejb.library.connect.TestConnectionInterface")<br/>@XmlSeeAlso({pfcommon.data.User.class})<br/>public class TestConnection implements TestConnectionInterfaceRemote, TestConnectionInterfaceLocal, TestConnectionInterface {<br/>...<br/>&#160;&#160;&#160; @Override<br/>&#160;&#160;&#160; public Object queryForObject(String queryName, HashMap&lt;String, Object&gt; criteria) {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; l.info("queryName=" + queryName);</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Simplified sample of something that could happen here<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; User ret = new User();</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; l.info("queryForObject ret="+ret);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; return ret;<br/>&#160;&#160;&#160; }<br/>...<br/>}</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>//Client</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;">&#160;&#160;&#160; public void testWebServiceTestConnectionQuery() throws Exception {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; boolean successfulTest = true;</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;"><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160; String endpointURI = "</span><a class="jive-link-external-small" href="http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnection?wsdl" target="_blank">http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnection?wsdl</a><span>";</span></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; try {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; URL wsdlURL = new URL(endpointURI);<br/><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; QName serviceName = new QName("</span><a class="jive-link-external-small" href="http://connect.ejb.pf/" target="_blank">http://connect.ejb.pf/</a><span>", "TestConnectionService");</span></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Service service = Service.create(wsdlURL, serviceName);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TestConnectionInterface tc = service.getPort(TestConnectionInterface.class);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; assertNotNull(tc);</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; HashMap&lt;String, Object&gt; filterCriteria = new HashMap&lt;String, Object&gt;();<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; filterCriteria.put("username", "bob");</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; l.info("Attempting to call dummy queryForObject method");<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; User ret = (User) tc.queryForObject(PFConsts.SELECT_USER_BY_ACTIVE, filterCriteria);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; l.info("User = ["+ret+"]");<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; } catch (Exception e) {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; e.printStackTrace();<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; successfulTest = false;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; assertTrue(successfulTest);<br/>&#160;&#160;&#160; }</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><br/><span style="text-decoration: underline;"><a class="jive-link-external-small" href="http://192.168.1.7:6881/jbossws/services" target="_blank">http://192.168.1.7:6881/jbossws/services</a></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Registered Service Endpoints<br/>Endpoint Name&#160;&#160;&#160;&#160; jboss.ws:context=PersonalFinancier-PersonalFinancier,endpoint=TestConnection<br/><span>Endpoint Address&#160;&#160;&#160;&#160; </span><a class="jive-link-external-small" href="http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnection?wsdl" target="_blank">http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnection?wsdl</a><br/>&#160;&#160;&#160; <br/><span style="text-decoration: underline;"><a class="jive-link-external-small" href="http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnection?wsdl" target="_blank">http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnection?wsdl</a></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;"><span>&lt;definitions name="TestConnectionService" targetNamespace="</span><a class="jive-link-external-small" href="http://connect.ejb.pf/" target="_blank">http://connect.ejb.pf/</a><span>"&gt;</span><br/><span>&#160; &lt;import location="</span><a class="jive-link-external-small" href="http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnection?wsdl&amp;resource=TestConnectionInterface_PortType2174988315873883329.wsdl" target="_blank">http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnection?wsdl&amp;resource=TestConnectionInterface_PortType2174988315873883329.wsdl</a><span>" namespace="</span><a class="jive-link-external-small" href="http://connect.library.ejb.pfcommon/" target="_blank">http://connect.library.ejb.pfcommon/</a><span>"/&gt;</span></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;">&#160; &lt;service name="TestConnectionService"&gt;</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;">&#160;&#160;&#160; &lt;port binding="ns1:TestConnectionInterfaceBinding" name="TestConnectionPort"&gt;<br/><span>&#160;&#160;&#160;&#160;&#160; &lt;soap:address location="</span><a class="jive-link-external-small" href="http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnection" target="_blank">http://192.168.1.7:6881/PersonalFinancier-PersonalFinancier/TestConnection</a><span>"/&gt;</span><br/>&#160;&#160;&#160; &lt;/port&gt;<br/>&#160; &lt;/service&gt;<br/>&lt;/definitions&gt;</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>//Server Exception</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;">...<br/>00:40:14,236 INFO&#160; [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@33435a77{name=jboss.j2ee:ear=PersonalFinancier.ear,jar=PersonalFinancier.jar,name=TestConnection,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}<br/>00:40:14,329 INFO&#160; [SessionSpecContainer] Starting jboss.j2ee:ear=PersonalFinancier.ear,jar=PersonalFinancier.jar,name=TestConnection,service=EJB3<br/>00:40:14,329 INFO&#160; [EJBContainer] STARTED EJB: pf.ejb.connect.TestConnection ejbName: TestConnection<br/>00:40:14,365 INFO&#160; [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; PersonalFinancier/TestConnection/remote - EJB3.x Default Remote Business Interface<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; PersonalFinancier/TestConnection/remote-pfcommon.ejb.library.connect.TestConnectionInterfaceRemote - EJB3.x Remote Business Interface<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; PersonalFinancier/TestConnection/local - EJB3.x Default Local Business Interface<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; PersonalFinancier/TestConnection/local-pfcommon.ejb.library.connect.TestConnectionInterfaceLocal - EJB3.x Local Business Interface</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: courier new,courier;">...<br/>00:40:14,670 INFO&#160; [DefaultEndpointRegistry] register: jboss.ws:context=PersonalFinancier-PersonalFinancier,endpoint=TestConnection<br/>00:40:16,225 INFO&#160; [WSDLFilePublisher] WSDL published to: file:/usr/java/jboss-5.1.0.GA-dev/server/pfdev/data/wsdl/PersonalFinancier.ear/PersonalFinancier.jar/TestConnectionService1705653235957235278.wsdl<br/>...<br/>00:40:20,905 WARN&#160; [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected<br/>00:40:20,905 INFO&#160; [STDOUT] Parameter constructor!<br/>00:40:20,905 INFO&#160; [TestConnection] Successful basic connection.&#160; Now returning value [id=null fieldValue=Remote Simple Test].<br/>00:40:20,905 WARN&#160; [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected<br/>00:40:26,754 WARN&#160; [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected<br/>00:40:26,755 INFO&#160; [TestConnection] queryName=selectUserByActive<br/>00:40:26,770 INFO&#160; [TestConnection] queryForObject ret=<br/>00:40:26,770 WARN&#160; [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from stateless bean context, it should already have been injected<br/>00:40:26,776 ERROR [RequestHandlerImpl] Error processing web service request<br/>org.jboss.ws.WSException: javax.xml.ws.WebServiceException: javax.xml.bind.MarshalException<br/> - with linked exception:<br/>[javax.xml.bind.JAXBException: class pfcommon.data.User nor any of its super class is known to this context.]<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at org.jboss.ws.WSException.rethrow(WSException.java:68)<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:336)<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:205)<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:131)<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at org.jboss.wsf.common.servlet.AbstractEndpointServlet.service(AbstractEndpointServlet.java:85)<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; ...</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Thanks again!</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/535672#535672">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Web Services at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>