wood burning stoves
The moose likes Web Services and the fly likes Problem copiling EJB Web Services Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Problem copiling EJB Web Services" Watch "Problem copiling EJB Web Services" New topic

Problem copiling EJB Web Services

Xavier George
Ranch Hand

Joined: Jul 29, 2005
Posts: 39
I was compiling a simple HelloWorld SLSB as an EJB Endpoints. The problem is with the ejb-jar.xml when compiler encounters xmlns namespace dec -
<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" version="2.1"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">

I tried to compiling this guy this using weblogic builtin ant utlity from the examle, then I tried using weblogic.ejbc but all are in vain.

Please suggest, hoe to get rid of this

Tim West
Ranch Hand

Joined: Mar 15, 2004
Posts: 539
I tried to use EWS (i.e., exposing session bean as web service, as per JSR109/921) in Weblogic 9.0Beta, but was unable to get it working. I found later that it was recognised that this didn't work. I notice Weblogic 9 has moved past Beta, so maybe it does work now.

The list of known bugs may help you. I'd also suggest trying the BEA forums, though they tend to be pretty quiet.

As with all new Web services libraries, I'd expect to encounter a bug or three before you eventually get it all working.

As for ejb-jar.xml - are there any examples packaged with WLAS9 that you can copy? Weblogic is much fussier than JBoss when it comes to the structure of these documents - though IMO this is a good thing. In particular, it is fussy about the namespace declaration etc. The following worked for me in Weblogic 8.1, though note that EJB2.1 (not 2.0) is supported in Weblogic 9. Note that no namespace is declared; I was unable to declare one without Weblogic complaining.

Good luck!


[edited to break line in DOCTYPE declaration so we don't get ugly long lines...]
[ August 03, 2005: Message edited by: Tim West ]
Xavier George
Ranch Hand

Joined: Jul 29, 2005
Posts: 39
Its weird problem ..... I have to dig more to get rid of this ....
Any more suggestion from EXPERT ???

Tim West
Ranch Hand

Joined: Mar 15, 2004
Posts: 539
Haha, you saying I'm not an EXPERT???...well, I guess you're right.

Still, two (non-EXPERT) points:

  • You'll get more help if you provide a decent explanation of (1) what you tried, (2) why it didn't work, and (3) the exact error message / stack trace you got.
  • Since your problem relates to the content of ejb-jar.xml, you may have more luck in the EJB forum.

  • -Tim
    Xavier George
    Ranch Hand

    Joined: Jul 29, 2005
    Posts: 39
    Thats good catch . Actually, I was inviting more experts comment on this, but you wrongly interpreted. But, luckily you are the only expert who have shared the views.
    Here is what I did and probably you can try if your env is set up -

    HelloWorld EJB SLSB
    Weblogic Server 8

    (Source for ejb-jar.xml - http://docs.jboss.org/jbossas/jboss4guide/r2/html/ch12.html)
    And in the existing ejb-jar.xml, I replaced the starting tag as
    <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" version="2.1"

    Then I tried to compile using weblogic.ejbc and using weblogic ant build file. Here is the stacktrace when I used the following command

    <target name="appc" depends="jar.ejb">
    <wlappc debug="${debug}" source="${dist}/ejb20_basic_statelessSession.jar" />

    file:C:/bea8/user_projects/domains/wsdomain/work/webservices/build.xml:46: weblogic.utils.compiler.ToolFailureExce
    ption: [J2EE:160119]Appc is unable to process the file 'C:\bea8\user_projects\domains\wsdomain\work\webservices\di
    st\ejb20_basic_statelessSession.jar'. The following error occurred:
    weblogic.utils.compiler.ToolFailureException: [J2EE:160113]Error: The source file, 'C:\bea8\user_projects\domains\
    wsdomain\work\webservices\dist\ejb20_basic_statelessSession.jar', is not a valid ejb-jar file. To be valid, it mus
    t contain a META-INF/ejb-jar.xml file.
    at weblogic.appc.compileInput(appc.java:422)
    at weblogic.appc.runBody(appc.java:184)
    at weblogic.utils.compiler.Tool.run(Tool.java:192)
    at weblogic.utils.compiler.Tool.run(Tool.java:147)
    at weblogic.appc.main(appc.java:1030)
    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:324)
    at weblogic.ant.taskdefs.j2ee.CompilerTask.invokeMain(CompilerTask.java:278)
    at weblogic.ant.taskdefs.j2ee.Appc.privateExecute(Appc.java:200)
    at weblogic.ant.taskdefs.j2ee.Appc.execute(Appc.java:124)
    at org.apache.tools.ant.Task.perform(Task.java:341)
    at org.apache.tools.ant.Target.execute(Target.java:309)
    at org.apache.tools.ant.Target.performTasks(Target.java:336)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
    at org.apache.tools.ant.Main.runBuild(Main.java:609)
    at org.apache.tools.ant.Main.start(Main.java:196)
    at org.apache.tools.ant.Main.main(Main.java:235)
    - with nested exception:
    [weblogic.utils.compiler.ToolFailureException: [J2EE:160113]Error: The source file, 'C:\bea8\user_projects\domains
    \wsdomain\work\webservices\dist\ejb20_basic_statelessSession.jar', is not a valid ejb-jar file. To be valid, it mu
    st contain a META-INF/ejb-jar.xml file.]

    When I tried to compile weblogic.ejbc I got these errors -

    C:\bea8\user_projects\domains\wsdomain\work\webservices>java weblogic.ejbc ejb111.jar wshello.jar

    ERROR: ejbc found errors while parsing the descriptor for ejb111.jar:

    ERROR: Error from ejbc: Error parsing file 'META-INF/ejb-jar.xml' at line: 8 column: 106. Attribute "xmlns" must
    be declared for xtype "ejb-jar".

    ERROR: ejbc couldn't load descriptor from jar
    Xavier George
    Ranch Hand

    Joined: Jul 29, 2005
    Posts: 39
    Finally, I am able to compile this trouble guy. It seems there is problem with WLS 8. Then I downloaded WLS 9 (and sent WLS 8 on vacation )and tried with WLS9 and it worked. I used weblogic.ejbc but it is deprecated instead I should have used weblogic.appc anyway now I am one step ahead but still have to deploy my EJB endpoint .....

    Thanks Tim for your time
    Tim West
    Ranch Hand

    Joined: Mar 15, 2004
    Posts: 539
    Well done!

    I should have mentioned this more explicitly though: WLAS8 does not support SLSB Web service endpoints. This is a J2EE1.4 feature, and so was only introduced in Weblogic 9.

    In particular, WLAS8 supports only EJB2.0, not EJB2.1, and WS endpoints were introduced in 2.1.

    I had assumed you were using Weblogic 9 in your original post, when I saw you were using EJB2.1. Ouch! If only I'd mentioned that earlier.

    I agree. Here's the link: http://aspose.com/file-tools
    subject: Problem copiling EJB Web Services
    It's not a secret anymore!