facebook

Weblogic 10.3 jpa (Web service)

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #299882 Reply

    Rmabini
    Member

    Hi
    I created a web service that uses EJB 3.0 that has a JPA implementation. I package them into EAR, then I deployed in using Weblogic 10.3 , using My eclipse 7.5 facility to configure server. Every thing compiles and run .

    My problem is

    1) when a client tries to connect to web service
    2) web service connect to EJB using dependency injection the data source could not be found by the Weblogic server what do i need to do ?

    I have my persistence XML , I have define all the datasource information. And I put that in META-INF

    Please help

    #299886 Reply

    support-joy
    Member

    Hi rmabini,

    I just want to outline the steps when we deploy EJB 3 Stateless bean Web service in WebLogic Server

    First develop your EJB3 session bean web service as follows:


    @WebService
    (name=”PlaceBid”,
    serviceName=”PlaceBidService”, portName = “PlaceBidPort”,
    targetNamespace = “http://domainName.com/xml”)
    @SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
    @PersistenceContext(unitName=”domainName”,name=”domainName”)
    @Stateless
    public class PlaceBidBean {
    @WebMethod

    public Long addBid(String userId, Long itemId, Double bidPrice) throws BidException {
    ….
    }
    }

    <b>Deployment</b>

    Unlike OC4J, WebLogic do not support parsing of JAX-WS annotations at deployment time and if you try to deploy the compiled EJB 3 Web service, you will get deployment time exception. You have to run the EJB 3 WS thru annotation parsing tool (jwsc -java web services compile) supplied with WebLogic to generate the artifacts and package in your ejb-jar module.

    Here is an example ant task to create the web service:

    <target
    name=”build-ws-server” description=”Target that builds the
    target Web Service”>
    <jwsc
    srcdir=”${src.ejb.dir}”
    destdir=”${bld.service.dir}”
    classpath=”${common.j2ee.class.path}”
    fork=”true”
    keepGenerated=”true”
    deprecation=”${deprecation}”
    keepTempFiles=”true”
    listfiles=”true”
    debug=”${debug}”>
    <jws
    file=”domainName/buslogic/PlaceBidBean.java” type=”JAXWS”
    explode=”true”/>
    </jwsc>
    </target>

    <target name=”package-ejb”
    depends=”compile-ejb-classes,build-ws-server”>;

    <mkdir dir=”${bld.ejb.dir}/domainName/buslogic/jaxws” />

    <copy todir=”${bld.ejb.dir}/domainName/buslogic/jaxws”>

    <fileset dir=”${bld.service.dir}/domainName/buslogic/PlaceBidBean/actionbazaar/buslogic/jaxws” includes=”*”/> </copy>
    <echo message=”—–> Create EJB jar file”/>
    <jar jarfile=”${bld.ear.dir}/${ejb.name}.jar”>
    <fileset dir=”${bld.ejb.dir}” includes=”**” />
    </jar>
    </target >

    Make sure to package the generated artifacts in the EJB JAR and then deploy the EJB-JAR or EAR to the WebLogic Server. Note that if your web service depends upon custom Java objects – the generated artifacts contain duplicate Java classes that you already may have. These duplicated classes are on a separate package structure and cause ClassCastException for me. So I avoid packaging these classes.

    Accessing EJB 3 Web service

    After successful deployment you can access the web service as follows:

    http://hostname:port/ejb-name/web-service-name?wsdl

    for e.g. – http://localhost:7001/PlaceBidBean/PlaceBidBeanService?wsdl

    Let me know if this works for you. In case you have a different deployment process. Can you elaborate in steps. Be super specific. I would recommend you to cross post to WebLogic/EJB/Webservices forums too.

    #299887 Reply

    Brian Fernandes
    Moderator

    rmabini,

    You have mentioned when you have problems, but more details on the problems themselves would help. Perhaps you can paste a few stack trances here in addition to following Joy’s suggestions above?

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Weblogic 10.3 jpa (Web service)

You must be logged in to post in the forum log in