[jboss-user] [Beginners Corner] - Re: A true newbie -- Please help!
rij
do-not-reply at jboss.com
Wed Mar 11 15:08:02 EDT 2009
Ok, I was able to successfully build - or so I thought since my window showed the message "BUILD SUCCESSFUL".
However, when I checked the server log, there were a bunch of error messages. I wont include all of that here. But from checking the forums, it seemed that there was a problem in my persistence.xml file
First off, here is my persistence.xml:
| <persistence>
| <persistence-unit>
| <name>mojo</name>
| <jta-data-source>java:/DefaultDS</jta-data-source>
| <properties>
| <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
| </properties>
| </persistence-unit>
| </persistence>
|
Now, the next thing I checked was where to place persistence.xml. From the JBoss docs, I learnt the following:
anonymous wrote :
| You must also define a persistence.xml file that resides in the META-INF folder of the .jar file.
|
So in the directory where I have my EJB source files, I created a sub-directory META-INF directory and put persistence.xml in it. Incidentally, I have another sub-directory called client-config which has jndi.properties file. So now, my director structure looks like this:
| {DIR} client-config
| {DIR} META-INF
| build.xml
| Client.java
| User.java
| UserRegistrationRemote.java
| UserRegistrationSessionBean.java
| 5 File(s) 5,908 bytes
|
|
| Ok now, I run my build. Here is the relevant code which creates the jar file:
|
| | <!-- Create EJB-JAR and place it in deploy directory of JBoss server -->
| | <target name="ejbjar" depends="compile">
| | <jar jarfile="build/mojo.jar">
| | <fileset dir="${build.classes.dir}">
| | <include name="*.class"/>
| | <include name="*.class"/>
| | </fileset>
| | <fileset dir="${basedir}/META-INF">
| | <include name="*.xml"/>
| | </fileset>
| | </jar>
| | <copy file="build/mojo.jar "
| | todir="${jboss.deploy.dir}"/>
| | </target>
| |
|
| Now, I go on to check the mojo.jar file using the tar tf mojo.jar command.
| Funnily, persistence.xml gets pulled out of the META-INF directory and gets placed in the source (one level higher) directory. Here are the results of the command:
|
| | META-INF/
| | META-INF/MANIFEST.MF
| | Client.class
| | User.class
| | UserRegistrationRemote.class
| | UserRegistrationSessionBean.class
| | persistence.xml
| |
|
| That doesn't seem right to me. So my questions are: Is my mojo.jar correct? If not, what am I doing wrong?
|
| I don't know if this will solve the original messages in the server log. But, we will work on it gradually.
|
| Thank you for your patience in reading my extra long posts. But from my own experience in other forums, I also know that the best way for getting help is to include as much relevant information as possible. :)
|
| Thanks, Rij
|
| ----
| P.S: Peter, thanks for the note on packages. I will get into packages eventually. For now, I am just trying to get a hold on how to put the pieces together to get a EJB app running.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4217135#4217135
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4217135
More information about the jboss-user
mailing list