[JBoss Seam] - JAR with entities in a WebApp
by yuriy_zubarev
Hello,
I'm trying to set up Seam (2.0.0) Web App under Tomcat 6.0 in a such a way as to have 2 POM project. One is with entities (@Entity) and another one is a web app itself (and there is a parent POM of course). The idea is that entities could be re-used between different sub-projects.
He is my structure:
| .
| |-- pom.xml
| |
| |-- entity
| | |-- pom.xml
| | |-- src
| | |-- main
| | |-- java
| | | |-- entitypackage
| | | |-- Book.java
| | |-- resources
| | |-- seam.properties
| |
| |-- webapp
| |-- pom.xml
| |-- src
| |-- main
| |-- java
| | |-- webpackage
| | |-- BookController.java
| |-- resources
| | |-- seam.properties
| |-- webapp
| |-- META-INF
| | |-- context.xml
| | |-- persistence.xml
| |-- WEB-INF
| |-- web.xml
| |-- components.xml
| |-- pages.xml
|
In BookController I have something like this:
| this.books = em.createQuery("select b from entitypackage.Book b").getResultList();
|
When the web app is running this is what I see in a log file:
| WARNING: no persistent classes found for query class: select b from entitypackage.Book b
|
When I move Book.java to webapp project, everything works like a charm. I also tried to provide persistence.xml under entity/META-INF and provide "class" element in there but it didn't help.
I was wondering how I can separate entity (and java beans/session) classes from the actual web application and still enjoy the benefits of Seam. Just to stress it again, I'm building a light-weight web app to be run under Tomcat without EJB embedded container.
Thank you.
Yuriy
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4094739#4094739
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4094739
18Â years, 9Â months
[EJB 3.0] - SessionBean as WebService - again complex data structures
by CarstenRudat
Hi all,
I have a SLSB and want it to be accessable through a webservice. So I write
| package com.genloop.ejb.beans.service;
|
| import javax.ejb.Remote;
| import javax.jws.WebMethod;
| import javax.jws.WebService;
| import javax.jws.soap.SOAPBinding;
|
| @WebService
| @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
| @Remote
| public interface PartnerWebService extends java.rmi.Remote{
|
| @WebMethod
| public String sayHello(String hello);
|
| }
|
|
and
| package com.genloop.ejb.beans.service;
|
| import java.util.Date;
|
| import javax.ejb.Remote;
| import javax.ejb.Stateless;
| import javax.interceptor.Interceptors;
| import javax.jws.WebService;
|
| import org.jboss.annotation.ejb.RemoteBinding;
| import org.jboss.annotation.security.SecurityDomain;
|
| import com.genloop.ejb.commons.SecurityInterceptor;
| import com.genloop.ejb.commons.UserInterceptor;
|
| @Stateless
| @Remote(PartnerWebService.class)
| @SecurityDomain("...")
| @org.jboss.annotation.ejb.Clustered
| @RemoteBinding(jndiBinding="test/PartnerWebService/remote")
| @Interceptors({UserInterceptor.class, SecurityInterceptor.class})
| @WebService(endpointInterface="com.genloop.ejb.beans.service.PartnerWebService", serviceName="PartnerService")
| public class PartnerWebServiceBean implements PartnerWebService {
|
| public String sayHello(String hello) {
| return hello;
| }
|
| }
|
My Client works well:
| public class PartnerWSClient {
|
| /**
| * @param args
| */
| public static void main(String[] args) {
| try {
| URL url = new URL(
| "http://localhost:8080/test-ea-test-service/PartnerWebServiceBean?wsdl");
| QName qname = new QName("http://service.beans.ejb.genloop.com/",
| "PartnerService");
|
| ServiceFactory factory = ServiceFactory.newInstance();
| Service service = factory.createService(url, qname);
|
| PartnerWebService partnerService = (PartnerWebService) service
| .getPort(PartnerWebService.class);
|
| System.out.println(partnerService.sayHello("test"));
| } catch (MalformedURLException e) {
| e.printStackTrace();
| } catch (ServiceException e) {
| e.printStackTrace();
| }
| }
|
| }
|
But now, I add another mehtod:
| public ComplexObject getComplexObject() {
| return new ComplexObject(new Date(), "test");
| }
|
| ...
|
| @WebMethod
| public ComplexObject getComplexObject();
|
| ...
|
| public class ComplexObject implements Serializable {
|
| /**
| *
| */
| private static final long serialVersionUID = 1L;
|
| protected Date date;
|
| protected String string;
|
| public ComplexObject() {
| }
|
| getter/setter
| }
|
No, I just get this exception:
Cannot obtain java/xml type mapping for: {http://service.beans.ejb.genloop.com/}complexObject
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4094737#4094737
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4094737
18Â years, 9Â months