[JBossWS] - Re: avoid lazy-initialization exceptions
by mazz@jboss.com
The SLSB and entity is very simple. I've included the relevant SLSB interface definition and entity code below. The specific issue here is our login() method returns a Subject - and the Subject, although it has a Role relationship, we do not eagerly load it. The caller to login() never needs to know the role relationship data, and because of that, we increase performance by never asking the persistence layer to load that data before returning the Subject. While this is a very specific example, this design paradigm is all through our code. In fact, I have to believe this is a general problem everyone will have (since this is a big reason behind using LAZY vs. EAGER loading).
Not sure how to annotate the entity, because would that mean we can either ALWAYS or NEVER the data? But we know will we need it sometimes, but not always (i.e. sometimes a caller will call a different method that returns a Subject and that Subject WILL have the role information loaded and we thus WILL want that data go through the JAXB engine and returned to the web client).
I think we need some way to customize the way JAXB processes the returned entity or we need some annotation on a per-SLSB method. We are looking at @XMLJavaTypeAdapter as a possible way to do something, but we aren't sure yet until we try it out.
@WebService
| @SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
| public interface SubjectManagerRemote {
| @WebMethod
| Subject login(String user, String password);
@Entity
| @Table(name = "ON_SUBJECT")
| public class Subject implements Externalizable {
| ...
| @ManyToMany
| @JoinTable(name="ON_SUBJECT_ROLE_MAP",
| joinColumns={@JoinColumn(name="SUBJECT_ID")},
| inverseJoinColumns={@JoinColumn(name="ROLE_ID")})
| private java.util.Set<Role> roles;
| ...
| public java.util.Set<Role> getRoles() {
| return this.roles;
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4098807#4098807
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4098807
17 years, 2 months
[JBossWS] - Cannot find endpoint meta data for
by tpawankumar
Hi,
I am trying to deploy sample webservice by using Jax-ws.
I am using JBOSS 4.2.1GA application server and Jbossws 2.0.1GA.
The code for Remote interface is
package com.covad.Inter;
import java.rmi.Remote;
import java.rmi.RemoteException;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
@WebService(name="Hello",targetNamespace = "http://Inter.covad.com/")
@SOAPBinding(style = SOAPBinding.Style.RPC)
public interface Hello extends Remote {
String echo(String value) throws RemoteException;
}
and this is my [B]implementation[/B] class
package com.covad.impl;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
@WebService(endpointInterface = "com.covad.Inter.Hello", name="Hello")
@SOAPBinding(style = SOAPBinding.Style.RPC)
public class HelloImpl {
public String echo(String value)
{
return "Hello"+value;
}
}
and this my [B]WSDL[/B] file which i generated by wsprovide tool
<?xml version="1.0" encoding="UTF-8"?>
<definitions name='HelloService' targetNamespace='http://Inter.covad.com/' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://Inter.covad.com/' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>
<soap:operation soapAction=''/>
<soap:body namespace='http://Inter.covad.com/' use='literal'/>
<soap:body namespace='http://Inter.covad.com/' use='literal'/>
<soap:address location='REPLACE_WITH_ACTUAL_URL'/>
and this is my [B]Web.xml[/B] file
<?xml version="1.0" encoding="UTF-8"?>
<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">
<servlet-name>JWeb</servlet-name>
<servlet-class>com.covad.impl.HelloImpl</servlet-class>
<servlet-mapping>
<servlet-name>JWeb</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
then i created war file with following directory
warfilename/WEB-INF/classes
warfilename/WEB-INF/lib
warfilename/WEB-INF/web.xml
warfilename/META-INF/wsdl/HelloService.wsdl
and tried to deploy and following is the exception i am getting
16:06:34,537 ERROR [MainDeployer] Could not start deployment: file:/D:/jboss-4.2
.1.GA/server/default/deploy/JbossWebService.war
java.lang.IllegalStateException: Cannot find endpoint meta data for: JWeb
at org.jboss.wsf.stack.jbws.UnifiedMetaDataDeploymentAspect.getEndpointM
etaData(UnifiedMetaDataDeploymentAspect.java:117)
at org.jboss.wsf.stack.jbws.UnifiedMetaDataDeploymentAspect.create(Unifi
edMetaDataDeploymentAspect.java:86)
at org.jboss.wsf.framework.deployment.DeploymentAspectManagerImpl.deploy
(DeploymentAspectManagerImpl.java:115)
at org.jboss.wsf.container.jboss42.ArchiveDeployerHook.deploy(ArchiveDep
loyerHook.java:97)
at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInt
erceptor.java:90)
at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.
start(SubDeployerInterceptorSupport.java:188)
at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterce
ptor.java:95)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy45.start(Unknown Source)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
er.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractIntercept
or.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelM
BeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy9.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymen
tScanner.java:421)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentS
canner.java:634)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
doScan(AbstractDeploymentScanner.java:263)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
loop(AbstractDeploymentScanner.java:274)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
run(AbstractDeploymentScanner.java:225)
Please let me if i am missing something?
Please help me.
Thanks in Advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4098773#4098773
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4098773
17 years, 2 months
[JBossWS] - Re: UsernameToken and Basic Auth
by ejb3workshop
I have specified the loginModule to use via @SecurityDomain(value="THZone") in my bean. I have also configured the login module in login-config.xml as shown below. I am not able to log in and authenticate, but the roles are not passed through. Where can I configure how the roles are obtained.
@RolesAllowed("friends")
or
System.out.println("Principal is a friend :"+context.isUserInRole("friends"));
Currently don't seem to work. I also tried to implement my own login module return my own implementations of Principal and had the same problem as using the org.jboss.security.auth.spi.UsersRolesLoginModule on. The results are that the principal is passed through and accessible through the context, but the roles are not.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4098717#4098717
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4098717
17 years, 2 months