Solved

Problem when deploying entity bean in Weblogic 5.1

Posted on 2001-06-18
9
332 Views
Last Modified: 2013-11-24
When I try to build the xml files using ejbc utility (entity beans using the downloads available in weblogic.com) I get the following error:
C:\demoejb\sampc>java -classpath \java\lib\classes.zip;\weblogic\classes;\weblog
ic\lib\weblogicaux.jar;\weblogic\myserver\clientclasses -Dweblogic.home=\weblogi
c weblogic.ejbc -compiler javac build\std_ejb_basic_containerManaged.jar \weblog
ic\myserver\ejb_basic_containerManaged.jar
org.xml.sax.SAXParseException: XML declaration may only begin entities.
        at com.sun.xml.parser.Parser.fatal(Parser.java:2797)
        at com.sun.xml.parser.Parser.fatal(Parser.java:2785)
        at com.sun.xml.parser.Parser.maybePI(Parser.java:938)
        at com.sun.xml.parser.Parser.maybeMisc(Parser.java:1061)
        at com.sun.xml.parser.Parser.parseInternal(Parser.java:478)
        at com.sun.xml.parser.Parser.parse(Parser.java:283)
        at weblogic.xml.dom.SunDOMParser.getDocument(SunDOMParser.java:69)
        at weblogic.xml.dom.DOMParser.getDocument(DOMParser.java:102)
        at weblogic.ejb.deployment.dd.DescriptorLoader.<init>(DescriptorLoader.j
ava:151)
        at weblogic.ejbc.runBody(ejbc.java:298)
        at weblogic.utils.compiler.Tool.run(Tool.java:80)
        at weblogic.ejbc.main(ejbc.java:353)

The examples that come with Weblogic server are getting deployed properly but when i try to deploy an example given in Ed Romans book i get this error. Any thoughts would be greatly appreciated
0
Comment
Question by:mrkumar
  • 5
  • 3
9 Comments
 
LVL 4

Expert Comment

by:jerch
Comment Utility
Can you post your ejb-jar.xml? There must be syntactic error in your deployment descriptor.

Jerson
0
 
LVL 3

Expert Comment

by:yerkan
Comment Utility
Hi,

- Your deployment description XML file may be corrupted,
- The same file may contain syntax errors,
- You may have a XML parser conflict in your classpath...

Please check those points,

Regards,

    Yagiz Erkan
    http://www.erkans.com
0
 

Author Comment

by:mrkumar
Comment Utility
here is the contents of ejb-jar.xml

  <?xml version="1.0" ?>
  <!DOCTYPE ejb-jar (View Source for full doctype...)>
- <ejb-jar>
- <enterprise-beans>
- <entity>
  <ejb-name>containerManaged</ejb-name>
  <home>examples.ejb.basic.containerManaged.AccountHome</home>
  <remote>examples.ejb.basic.containerManaged.Account</remote>
  <ejb-class>examples.ejb.basic.containerManaged.AccountBean</ejb-class>
  <persistence-type>Container</persistence-type>
  <prim-key-class>java.lang.String</prim-key-class>
  <reentrant>False</reentrant>
- <cmp-field>
  <field-name>accountId</field-name>
  </cmp-field>
- <cmp-field>
  <field-name>balance</field-name>
  </cmp-field>
- <cmp-field>
  <field-name>accountType</field-name>
  </cmp-field>
  <primkey-field>accountId</primkey-field>
  </entity>
  </enterprise-beans>
- <assembly-descriptor>
- <container-transaction>
- <method>
  <ejb-name>containerManaged</ejb-name>
  <method-intf>Remote</method-intf>
  <method-name>*</method-name>
  </method>
  <trans-attribute>Required</trans-attribute>
  </container-transaction>
  </assembly-descriptor>
  </ejb-jar>

Here is the contents of weblogic-ejb-jar.xml

<?xml version="1.0" ?>
  <!DOCTYPE weblogic-ejb-jar (View Source for full doctype...)>
- <weblogic-ejb-jar>
- <weblogic-enterprise-bean>
  <ejb-name>containerManaged</ejb-name>
- <caching-descriptor>
  <max-beans-in-cache>1000</max-beans-in-cache>
  </caching-descriptor>
- <persistence-descriptor>
  <is-modified-method-name>isModified</is-modified-method-name>
- <persistence-type>
  <type-identifier>WebLogic_CMP_RDBMS</type-identifier>
  <type-version>5.1.0</type-version>
  <type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
  </persistence-type>
- <persistence-use>
  <type-identifier>WebLogic_CMP_RDBMS</type-identifier>
  <type-version>5.1.0</type-version>
  </persistence-use>
  </persistence-descriptor>
  <jndi-name>containerManaged.AccountHome</jndi-name>
  </weblogic-enterprise-bean>
  </weblogic-ejb-jar>
And here's the contents of weblogic-cmp-rdbms-jar.xml

demoPool ejbAccounts accountId id balance bal accountType type findBigAccounts double balance $0)]]> findAccount double findNullAccounts false

    What do you think ?
0
 
LVL 3

Accepted Solution

by:
yerkan earned 200 total points
Comment Utility
Hi,

The "!DOCTYPE" instructions may be wrong. Try this:

<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>

for ejb-jar.xml and

<!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 5.1.0 EJB//EN' 'http://www.bea.com/servers/wls510/dtd/weblogic-ejb-jar.dtd'>

for weblogic-ejb-jar.xml.

You will also have to remove the '-' characters in the beginning of some lines if there are really there in your source code.

Regards,

    Yagiz
    http://www.erkans.com
0
Network it in WD Red

There's an industry-leading WD Red drive for every compatible NAS system to help fulfill your data storage needs. With drives up to 8TB, WD Red offers a wide array of solutions for customers looking to build the biggest, best-performing NAS storage solution.  

 

Author Comment

by:mrkumar
Comment Utility
Yagiz..i got this fixed with your comment....now i get the following error after that...any idea ?

Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.

C:\>cd demoejb

C:\demoejb>cd sampc

C:\demoejb\sampc>build

C:\demoejb\sampc>if "" == "" set JAVA_HOME=\java

C:\demoejb\sampc>if "" == "" set WL_HOME=\weblogic

C:\demoejb\sampc>set MYSERVER=\weblogic\myserver

C:\demoejb\sampc>set MYCLASSPATH=\java\lib\classes.zip;\weblogic\classes;\weblog
ic\lib\weblogicaux.jar;\weblogic\myserver\clientclasses

C:\demoejb\sampc>mkdir build build\META-INF

C:\demoejb\sampc>copy *.xml build\META-INF
ejb-jar.xml
weblogic-cmp-rdbms-jar.xml
weblogic-ejb-jar.xml
        3 file(s) copied.

C:\demoejb\sampc>javac -d build -classpath \java\lib\classes.zip;\weblogic\class
es;\weblogic\lib\weblogicaux.jar;\weblogic\myserver\clientclasses Account.java A
ccountHome.java ProcessingErrorException.java AccountBean.java

C:\demoejb\sampc>cd build

C:\demoejb\sampc\build>jar cv0f std_ejb_basic_containerManaged.jar META-INF exam
ples
examples : no such file or directory
added manifest
ignoring entry META-INF/
adding: META-INF/ejb-jar.xml(in = 1169) (out= 1169)(stored 0%)
adding: META-INF/weblogic-cmp-rdbms-jar.xml(in = 143) (out= 143)(stored 0%)
adding: META-INF/weblogic-ejb-jar.xml(in = 936) (out= 936)(stored 0%)

C:\demoejb\sampc\build>cd ..

C:\demoejb\sampc>java -classpath \java\lib\classes.zip;\weblogic\classes;\weblog
ic\lib\weblogicaux.jar;\weblogic\myserver\clientclasses -Dweblogic.home=\weblogi
c weblogic.ejbc -compiler javac build\std_ejb_basic_containerManaged.jar \weblog
ic\myserver\ejb_basic_containerManaged.jar
ERROR: Error from ejbc: Unable to load a class required by your EJB: examples.ej
b.basic.containerManaged.AccountBean
ERROR: ejbc found errors

C:\demoejb\sampc>javac -d \weblogic\myserver\clientclasses -classpath \java\lib\
classes.zip;\weblogic\classes;\weblogic\lib\weblogicaux.jar;\weblogic\myserver\c
lientclasses Account.java AccountHome.java ProcessingErrorException.java Client.
java
C:\demoejb\sampc>

My files are under the sampc folder.
0
 
LVL 3

Expert Comment

by:yerkan
Comment Utility
> examples : no such file or directory

It can't find the "examples" directory when you create the jar file. Can you doublecheck if you have a subdirectory called "examples" under "C:\demoejb\sampc\build"?

Yagiz
http://www.erkans.com
0
 

Author Comment

by:mrkumar
Comment Utility
Yagiz,
    I checked and there is no examples folder under build. but it is the build.cmd utility that creates this build folder. If it needs the examples folder shouldn't it be creating it automatically ?

Michael (m-rkumar@eth.net)
0
 

Author Comment

by:mrkumar
Comment Utility
Yagiz,
   Do you think we can chat online.
my MSN id is m_rkumaris@hotmail.com
my yahoo id is : m_rkumar@yhaoo.com and
AIM id is rmichaelk

Looking forward to chat with you. Michael
0
 

Author Comment

by:mrkumar
Comment Utility
Yagiz,
   Do you think we can chat online.
my MSN id is m_rkumaris@hotmail.com
my yahoo id is : m_rkumar@yhaoo.com and
AIM id is rmichaelk

Looking forward to chat with you. Michael
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now