Jubin-
Just got Minerva up and running with jboss (I am using CVS build, but
assume that PR4 will work much the same), postgres (I am using 7.0.2 and
the jdbc2 driver) without a hitch. Here is what I did and what I think
looks suspect in what you have done - read onward below.
If you still have problems, send me what you have privately and I will
see what I can do with it. If you want to see exactly what I have done,
I can send it along to you.
Jubin Zawar wrote:
>
[snip]
>
> Here the entry in my jboss.conf :
>
> <MLET CODE="org.jboss.jdbc.XADataSourceLoader"
> ARCHIVE="jboss.jar,jdbc6.5-1.2.jar" CODEBASE="../lib/ext/">
> <ARG TYPE="java.lang.String" VALUE="postgres">
> <ARG TYPE="java.lang.String"
> VALUE="org.jboss.minerva.xa.XADataSourceImpl">
> </MLET>
>
I did exactly the same thing you have in jboss.conf. I am using the
slightly more recent jar for postgres 7, but I do not see a reason why
the 6.5 jdbc2 jar would not work.
> the only content in my jboss.jcml :
> <mbean name="DefaultDomain:service=XADataSource,name=postgres">
> <attribute name="URL">jdbc:postgresql:wapdb</attribute>
> <attribute name="JDBCUser">onu</attribute>
> <attribute name="Password">onu</attribute>
> </mbean>
>
This looks the same as mine as well.
> jboss.properties:
> jdbc.drivers=org.hsql.jdbcDriver,jdbc.idbDriver,postgresql.Driver
>
Yep, the same
> ejb-jar.xml :
>
> <?xml version="1.0" encoding="Cp1252"?>
>
> <ejb-jar>
> <description>jBoss wap framework application </description>
> <display-name>wapplication</display-name>
> <enterprise-beans>
> <session>
> <ejb-name>Quiz</ejb-name>
> <jndi-name>Quiz</jndi-name>
> <home>framework.application.QuizHome</home>
> <remote>framework.application.Quiz</remote>
> <ejb-class>framework.application.QuizBean</ejb-class>
> <session-type>Stateless</session-type>
> <transaction-type>Bean</transaction-type>
> </session>
> </enterprise-beans>
> </ejb-jar>
Here is where we part ways, and where the beginning of your problem
probably starts. You *have* to have a resource-ref in the ejb-jar.xml
file. Here is what I have:
<ejb-jar>
<description>test application</description>
<enterprise-beans>
<session>
<display-name>PoolTest</display-name>
<ejb-name>PoolTest</ejb-name>
<home>com.bonevich.helloworld.PoolTestHome</home>
<remote>com.bonevich.helloworld.PoolTest</remote>
<ejb-class>com.bonevich.helloworld.PoolTestBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
<resource-ref>
<res-ref-name>pgPool</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</session>
</enterprise-beans>
</ejb-jar>
PLEASE NOTE: the res-ref-name is not the same as the pool name defined
in jboss.conf above. The most important thing here is that this name in
ejb-jar.xml is the name you use to get the resource inside your bean
(so, given your bean method listed below, you would use 'wapdb')
>
> and here the jboss.xml : (also in directory META-INF, shouldnt it be there
> ?)
Yes, it should
>
> <?xml version="1.0" encoding="Cp1252"?>
> <jboss>
> <resource-managers>
> <resource-manager res-class="org.jboss.ejb.deployment.JDBCResource">
> <res-name>wapdb</res-name>
> <res-jndi-name>xa.postgres</res-jndi-name>
> </resource-manager>
> </resource-managers>
>
> <enterprise-beans>
> <session>
> <ejb-name>Quiz</ejb-name>
> <jndi-name>Quiz</jndi-name>
> <configuration-name>Default Stateless Session Bean</configuration-name>
> <resource-ref>
> <res-ref-name>wapdb</res-ref-name>
> <resource-name>wapdb</resource-name>
> </resource-ref>
> </session>
> </enterprise-beans>
>
> </jboss>
I assume you have cut out the cruft here to get to the meat. If that is
the case, this looks good to me. If not and this is exactly what you
have in jboss.xml, you might have cut out too much. Use EJX to create a
new one if that is the case.
>
> And here the code fragment executing the db lookup, but in fact, this is
> never called, since I get the NullPointerException at Deploy time :
>
> public QuizPattern getQuizPattern(int level) throws SQLException,
> javax.naming.NamingException
> {
>
> /* lots of declarations cutted */
>
> try {
> /* try to get a connection from the database pool
> named postgres */
> naming = new InitialContext();
> ds =
> (DataSource)naming.lookup("java:comp/env/wapdb");
> con = ds.getConnection();
> st = con.createStatement();
> /* get the count of interesting records */
> rs=st.executeQuery("SELECT COUNT(question) FROM
> wapquizview WHERE (difficulty = " + level +");");
>
> /* stuff cutted again */
>
> }
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Problems?: [EMAIL PROTECTED]
--
Jeffrey & Nikole Bonevich
Maxmillian Bonevich
Ann Arbor, Michigan
[EMAIL PROTECTED]
http://www.bonevich.com
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]