Hi Joe,

I used your config to make some improvements. Running it through a few times I found a mix of places where we should have given better error messages, a bug or two, and a few places where we needed to add more configuration options.

Some details here:
  http://issues.apache.org/jira/browse/OPENEJB-742
  http://issues.apache.org/jira/browse/OPENEJB-743
  http://issues.apache.org/jira/browse/OPENEJB-744
  http://issues.apache.org/jira/browse/OPENEJB-745

The beta 2 should be out in about a week (give or take considering new years is coming up).

Till then this is what you need to do to get your config running in beta 1. Modify these three elements to look like this:

        <Connector id="db" provider="Default JDBC Database">
        <Resource id="mq" provider="Default JMS Resource Adapter">
<Connector id="mq_connector" provider="Default JMS Connection Factory">

In beta 2 those will be declarable pretty close to how you had them originally:

        <Connector id="db" type="DataSource">  // same as you had
        <Resource id="mq" type="ActiveMQResourceAdapter">
<Connector id="mq_connector" type="javax.jms.ConnectionFactory">

This is where OPENEJB-743 comes in. In beta 2 you'd get a message like this from your original <Resource id="mq"> declaration:


org.apache.openejb.OpenEJBException: Failed Configuring Service(id=mq): Cannot determine a provider for Resource(id=mq_connector, type=null, provider=null).

    Possible valid configurations might be:
      <Resource id="mq_connector" type="javax.sql.DataSource"/>
      <Resource id="mq_connector" type="DataSource"/>
      <Resource id="mq_connector" type="ActiveMQResourceAdapter"/>
      <Resource id="mq_connector" type="javax.jms.ConnectionFactory"/>
<Resource id="mq_connector" type="javax.jms.QueueConnectionFactory"/> <Resource id="mq_connector" type="javax.jms.TopicConnectionFactory"/>
      <Resource id="mq_connector" type="QueueConnectionFactory"/>
      <Resource id="mq_connector" type="TopicConnectionFactory"/>
      <Resource id="mq_connector" type="javax.jms.Queue"/>
      <Resource id="mq_connector" type="Queue"/>
      <Resource id="mq_connector" type="javax.jms.Topic"/>
      <Resource id="mq_connector" type="Topic"/>
      <Resource id="mq_connector" type="org.omg.CORBA.ORB"/>
      <Resource id="mq_connector" type="ORB"/>
      <Resource id="mq_connector" type="javax.mail.Session"/>

(fyi, the <Resource> and <Connector> tags are synonyms)

I've made a pre beta-2 build for you that has the changes:

http://people.apache.org/~dblevins/openejb-607397/

It should be pretty bullet proof, but if you run into any issues at all definitely let us know as we are happy to make improvements and love the feedback.

-David


On Dec 23, 2007, at 10:56 PM, xianzheng wrote:


Here is the output when "openejb start" is run:
Apache OpenEJB 3.0-beta-1    build: 20070926-12:34
http://openejb.apache.org/
org.apache.openejb.OpenEJBException: java.lang.NullPointerException: null
       at
org.apache.openejb.assembler.classic.Assembler.build(Assembler.java: 220)
       at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:149)
       at org.apache.openejb.OpenEJB.init(OpenEJB.java:293)
       at org.apache.openejb.server.Server.init(Server.java:63)
       at org.apache.openejb.server.Main.initServer(Main.java:155)
       at org.apache.openejb.server.Main.main(Main.java:128)
       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:597)
       at org.apache.openejb.cli.MainImpl.main(MainImpl.java:151)
       at org.apache.openejb.cli.Bootstrap.main(Bootstrap.java:102)
Caused by: java.lang.NullPointerException
       at
org.apache.openejb.config.ConfigurationFactory$DefaultService.access $000(ConfigurationFactory.java:472)
       at
org .apache .openejb .config .ConfigurationFactory.getDefaultService(ConfigurationFactory.java:519)
       at
org .apache .openejb .config .ConfigurationFactory .resolveServiceProvider(ConfigurationFactory.java:592)
       at
org .apache .openejb .config .ConfigurationFactory.configureService(ConfigurationFactory.java:534)
       at
org .apache .openejb .config .ConfigurationFactory .getOpenEjbConfiguration(ConfigurationFactory.java:240)
       at
org.apache.openejb.assembler.classic.Assembler.build(Assembler.java: 206)
       ... 11 more

Thanks for your quick response, david.

Joe


David Blevins wrote:

Hi Joe,

The config looks ok at first glance.  Can you send a full stack trace
of the NullPointerException?

-David


On Dec 23, 2007, at 9:29 PM, xianzheng wrote:


Hi,
I'm a new openejb user, or even a new starter of J2EE.
I'm currently trying to configure the openejb to but encountered
unexpected
NullPointerException.
My configure file is as below:
<?xml version="1.0" encoding="UTF-8"?>
<openejb>

        <Container id="cmp" ctype="CMP_ENTITY">
                ConnectorName db
                PoolSize 10
        </Container>

        <Container id="stateful" ctype="STATEFUL">
                Passivator   org.apache.openejb.core.stateful.SimplePassivater
                TimeOut 20
                PoolSize 50
                BulkPassivate  50
        </Container>

        <Container id="stateless" ctype="STATELESS">
                TimeOut 0
                PoolSize 10
                StrictPooling true
        </Container>

        <Container id="mdb" ctype="MESSAGE">
                ResourceAdapter mq
                ActivationSpecClass 
org.apache.activemq.ra.ActiveMQActivationSpec
                InstanceLimit 5
        </Container>

        <Connector id="db" type="DataSource">
                JdbcDriver   org.postgresql.Driver
                JdbcUrl      jdbc:postgresql://localhost/zhou
                UserName     joe
                Password     xianzheng
        </Connector>

        <Resource id="mq">
                BrokerXmlConfig broker:(tcp://localhost:61616)?useJmx=false

                ServerUrl vm://localhost?async=true
        </Resource>

        <Connector id="mq_connector">
  ResourceAdapter mq
        </Connector>
        
        <Deployments dir="apps/" />

</openejb>

I suspect it is caused by the db connector. How may I fix this please?
Thanks for your time in advance.

Regards,

Joe
--
View this message in context:
http://www.nabble.com/Help-for-configuring-openejb-tp14484775p14484775.html
Sent from the OpenEJB User mailing list archive at Nabble.com.






--
View this message in context: 
http://www.nabble.com/Help-for-configuring-openejb-tp14484775p14485130.html
Sent from the OpenEJB User mailing list archive at Nabble.com.



Reply via email to