• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem copiling EJB Web Services

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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"
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/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

Thanks
xgr3
 
Ranch Hand
Posts: 539
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!


-Tim

[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
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its weird problem ..... I have to dig more to get rid of this ....
Any more suggestion from EXPERT ???

Thanks
 
Tim West
Ranch Hand
Posts: 539
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
    Posts: 39
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    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" />
    </target>

    BUILD FAILED
    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
    Posts: 39
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Posts: 539
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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.


    -Tim
     
    Don't get me started about those stupid light bulbs.
    reply
      Bookmark Topic Watch Topic
    • New Topic