geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bongosdude <bongosd...@gmail.com>
Subject Re: problem JNDI lookup in geronimo
Date Thu, 08 Jan 2009 04:07:13 GMT

I found it from console. There is a menu "JNDI Viewer", so this is the JNDI
for my db pool name: "jdbc/myvoipdb"


	<jee:jndi-lookup id="nuvoipDs" cache="true" lookup-on-startup="true"
jndi-name="jca:/console.dbpool/jdbc_nuvoip/JCAManagedConnectionFactory/jdbc/myvoipdb"
resource-ref="false" >
	</jee:jndi-lookup>


Thanks


CG-6 wrote:
> 
> Hi all, I have solved the previous problem by reinstalling geronimo ,
> adding <jta-data-source> tag at appropriate line in persistence.xml
> 
> I decided to reinstall geronimo because I found out I can't redeploy
> (to overwrite) the jar package after changing the persistence.xml.
> Later , I try to uninstall the EJB and deploy again but it told me
> that the configuraion already exist, then I try to check the
> "redeploy" but it told me that it is not installed.
> 
> unfortunately I can't reproduce the error
> 
> thx for all, I am now fighting with another error :)
> 
> CG
> 
> 
> On Sat, Apr 12, 2008 at 8:34 AM, CG <learn.koa@gmail.com> wrote:
>> Thx for the reply :)
>>
>>
>>  >  Does your application have any CMP 2.1 Entity beans?
>>  Not sure whether is CMP 2.1 and how should I verify ? I coded it
>>  byfollowing a tutorial of EJB3 . I enclose  the source of the
>>  EntityBEan Material.java as a reference at end of msg
>>
>>
>>
>>  >  What geronimo version are you using?
>>  I am using geronimo 2.1 on ubuntu , below is the openejb-jar.xml &
>>  persistence.xml for your reference
>>
>>  FYI, my program consists of 2 entity bean,  Material & MaterialType.
>>  Initially I try to use the dbpool in geronimo for the db connection
>>  but it seems like does not work , therefore , I hardcoded the driver
>>  name , server name in the coding.
>>
>>  Initially there is  tag <jta-source> in the openejb-jar.xml but it
>>  prompt me for error under eclipse GEP 2.1 snapshot plugin, and Ihave
>>  remove it out.
>>
>>  Thanks
>>  CG
>>
>>
>>  openejb-jar.xml
>>  ====================
>>
>>  <?xml version="1.0" encoding="UTF-8"?>
>>  <openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.2"
>>  xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2"
>>  xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen-2.0"
>>  xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.2"
>>  xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">
>>   <sys:environment>
>>     <sys:moduleId>
>>       <sys:groupId>default</sys:groupId>
>>       <sys:artifactId>EJBStructsEJB</sys:artifactId>
>>       <sys:version>1.0</sys:version>
>>       <sys:type>car</sys:type>
>>     </sys:moduleId>
>>     <sys:dependencies>
>>             <sys:dependency>
>>                 <sys:groupId>console.dbpool</sys:groupId>
>>                 <sys:artifactId>mysql</sys:artifactId>
>>             </sys:dependency>
>>     </sys:dependencies>
>>   </sys:environment>
>>   <enterprise-beans/>
>>  </openejb-jar>
>>
>>  persistence.xml
>>  ===================
>>  <?xml version="1.0" encoding="UTF-8"?>
>>  <persistence version="1.0"
>>  xmlns="http://java.sun.com/xml/ns/persistence"
>>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>  xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
>>  http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
>>         <persistence-unit name="EJBStructsEJB">
>>             <description>Entity Beans for Material</description>
>>                
>> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>>         <class>com.quesofttech.entity.MaterialType</class>
>>         <properties>
>>                 <property name="openjpa.jdbc.SynchronizeMappings"
>> value="false"/>
>>                 <property name="openjpa.ConnectionDriverName"
>>  value="com.mysql.jdbc.Driver"/>
>>                 <property name="openjpa.ConnectionURL"
>>  value="jdbc:mysql:localhost:3306/ERP"/>
>>                         <property name="openjpa.ConnectionUserName"
>> value="root"/>
>>                         <property name="openjpa.ConnectionPassword"
>> value="super123"/>
>>         </properties>
>>         </persistence-unit>
>>  </persistence>
>>
>>
>>
>>
>>
>>
>>
>>
>>  <code>
>>  package com.quesofttech.entity;
>>
>>  import java.io.Serializable;
>>  import java.sql.Date;
>>  import java.sql.Time;
>>
>>  import javax.persistence.Id;
>>  import javax.persistence.Entity;
>>  import javax.persistence.Table;
>>
>>  import javax.persistence.GeneratedValue;
>>  import javax.persistence.GenerationType;
>>  //import javax.persistence.SequenceGenerator;
>>  import javax.persistence.TableGenerator;
>>
>>  import javax.persistence.ManyToOne;
>>  import javax.persistence.JoinColumn;
>>
>>  @Entity
>>  @Table(name = "Material")
>>  //For Postgresql : @SequenceGenerator(name = "material_sequence",
>>  sequenceName = "material_id_seq")
>>  //Generic solution : (Use a table named PrimaryKeys, with 2 fields ,
>>  tableName &  keyField)
>>  @TableGenerator(  name="material_id", table="PrimaryKeys",
>>  pkColumnName="tableName", pkColumnValue="material",
>>  valueColumnName="keyField")
>>  public class Material implements Serializable {
>>
>>         private static final long serialVersionUID =
>> 7422574264557894632L;
>>
>>         private Integer id;
>>         private String code;
>>         private String description;
>>
>>         // Foreign keys
>>         private MaterialType materialType;
>>
>>         // Common fields
>>         private String recordStatus;
>>         private String sessionId;
>>         private String createLogin;
>>         private String createApp;
>>         private java.sql.Date createDate;
>>         private java.sql.Time createTime;
>>         private String modifyLogin;
>>         private String modifyApp;
>>         private java.sql.Date modifyDate;
>>         private java.sql.Time modifyTime;
>>
>>
>>         public Material() {
>>                 super();
>>                 // TODO Auto-generated constructor stub
>>         }
>>
>>         public Material(Integer id, String code, String description) {
>>                 super();
>>                 this.id = id;
>>                 this.code = code;
>>                 this.description = description;
>>         }
>>
>>
>>         public Material(Integer id, String code, String description,
>>                         MaterialType materialType, String recordStatus,
>> String sessionId,
>>                         String createLogin, String createApp, Date
>> createDate,
>>                         Time createTime, String modifyLogin, String
>> modifyApp,
>>                         Date modifyDate, Time modifyTime) {
>>                 super();
>>                 this.id = id;
>>                 this.code = code;
>>                 this.description = description;
>>                 this.materialType = materialType;
>>                 this.recordStatus = recordStatus;
>>                 this.sessionId = sessionId;
>>                 this.createLogin = createLogin;
>>                 this.createApp = createApp;
>>                 this.createDate = createDate;
>>                 this.createTime = createTime;
>>                 this.modifyLogin = modifyLogin;
>>                 this.modifyApp = modifyApp;
>>                 this.modifyDate = modifyDate;
>>                 this.modifyTime = modifyTime;
>>         }
>>
>>         @Override
>>         public String toString() {
>>
>>                 return "Id: " + getId() + " Desc: " + getDescription() +
>>                        " Code:" + getCode() +
>>                        " RecordStatus: " + getRecordStatus() +
>>                        " SessionId: " + getSessionId() +
>>                        " CreateLogin: " + getCreateLogin()  +
>>                        " CreateApp: " + getCreateApp() +
>>                        " CreateDate: "  + getCreateDate()  +
>>                        " CreateTime: "  + getCreateTime()  +
>>                        " ModifyLogin: "+ getModifyLogin()  +
>>                        " ModifyApp: " + getModifyApp() +
>>                        " ModifyDate: "  + getModifyDate()  +
>>                        " ModifyTime: "  + getModifyTime();
>>
>>         }
>>
>>
>>         @Id
>>         //For Postgresql : @GeneratedValue(strategy =
>>  GenerationType.SEQUENCE, generator = "material_sequence")
>>         //For MSSQL      : @GeneratedValue(strategy =
>> GenerationType.IDENTITY)
>>         //Generic solution :
>>         @GeneratedValue(strategy = GenerationType.TABLE, generator =
>> "material_id")
>>         public Integer getId() {
>>                 return id;
>>         }
>>         public void setId(Integer id) {
>>                 this.id = id;
>>         }
>>         public String getCode() {
>>                 return code;
>>         }
>>         public void setCode(String code) {
>>                 this.code = code;
>>         }
>>         public String getDescription() {
>>                 return description;
>>         }
>>         public void setDescription(String description) {
>>                 this.description = description;
>>         }
>>         public String getRecordStatus() {
>>                 return recordStatus;
>>         }
>>         public void setRecordStatus(String recordStatus) {
>>                 this.recordStatus = recordStatus;
>>         }
>>         public String getSessionId() {
>>                 return sessionId;
>>         }
>>         public void setSessionId(String sessionId) {
>>                 this.sessionId = sessionId;
>>         }
>>         public String getCreateLogin() {
>>                 return createLogin;
>>         }
>>         public void setCreateLogin(String createLogin) {
>>                 this.createLogin = createLogin;
>>         }
>>         public String getCreateApp() {
>>                 return createApp;
>>         }
>>         public void setCreateApp(String createApp) {
>>                 this.createApp = createApp;
>>         }
>>         public java.sql.Date getCreateDate() {
>>                 return createDate;
>>         }
>>         public void setCreateDate(java.sql.Date createDate) {
>>                 this.createDate = createDate;
>>         }
>>         public java.sql.Time getCreateTime() {
>>                 return createTime;
>>         }
>>         public void setCreateTime(java.sql.Time createTime) {
>>                 this.createTime = createTime;
>>         }
>>         public String getModifyLogin() {
>>                 return modifyLogin;
>>         }
>>         public void setModifyLogin(String modifyLogin) {
>>                 this.modifyLogin = modifyLogin;
>>         }
>>         public String getModifyApp() {
>>                 return modifyApp;
>>         }
>>         public void setModifyApp(String modifyApp) {
>>                 this.modifyApp = modifyApp;
>>         }
>>         public java.sql.Date getModifyDate() {
>>                 return modifyDate;
>>         }
>>         public void setModifyDate(java.sql.Date modifyDate) {
>>                 this.modifyDate = modifyDate;
>>         }
>>         public java.sql.Time getModifyTime() {
>>                 return modifyTime;
>>         }
>>         public void setModifyTime(java.sql.Time modifyTime) {
>>                 this.modifyTime = modifyTime;
>>         }
>>
>>     @ManyToOne
>>     @JoinColumn(name="materialType_fk")
>>         public MaterialType getMaterialType() {
>>                 return materialType;
>>         }
>>
>>         public void setMaterialType(MaterialType materialType) {
>>                 this.materialType = materialType;
>>         }
>>  }
>>  </code>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>  On Sat, Apr 12, 2008 at 3:25 AM, David Jencks <david_jencks@yahoo.com>
>> wrote:
>>  > Hi CG,
>>  >
>>  >  That's not a terribly informative error message :-).  It looks to me
>> as if
>>  > the cmp entity bean support is not properly configured.
>>  >  Does your application have any CMP 2.1 Entity beans?
>>  >  What geronimo version are you using?
>>  >
>>  >  If your application does not have any CMP2.1 entity beans and you are
>> using
>>  > a geronimo version before 2.1 please upgrade.  There was a bug in some
>>  > versions that installed the cmp support even if you didn't have any
>> cmp
>>  > beans.  I think this was fixed by G 2.1.
>>  >
>>  >  If you do have cmp 2.1 entity beans you should (1) upgrade to jpa or
>> if
>>  > that is not possible (2) show us your openejb-jar.xml.
>>  >
>>  >  If you are not using cmp 2.1 entity beans and are already using G 2.1
>>  > please let us know.... we should check this is not a problem for G
>> 2.1.1
>>  >
>>  >  thanks
>>  >  david jencks
>>  >
>>  >
>>  >  On Apr 11, 2008, at 11:49 AM, CG wrote:
>>  >
>>  >
>>  > > Hi all,
>>  > >
>>  > >
>>  > >
>>  > >  I have solved a few remaining problem in JNDI lookup which occur
>> after
>>  > that.
>>  > >
>>  > > And I manage to get a initialcontext and manage to lookup an EJB ,
>>  > > however, the program throw exception when I try to call EJB function
>>  > > using the returned reference of EJB.
>>  > >
>>  > > Already search google but can't get useful info ...
>>  > > My EJB fundamental concept is not strong , find hard to understand
>> the
>>  > > error message , therefore , hope to get some hints at here
>>  > > THanks
>>  > >
>>  > > CG
>>  > > <code>
>>  > >
>>  > > OK                       context = new InitialContext(props);
>>  > > seems OK         beanRemote = (MaterialTestBeanRemote)
>>  > > context.lookup(MaterialTestBean.RemoteJNDIName);
>>  > >                         if(beanRemote!=null)
>>  > >                         {
>>  > > problem                    beanRemote.testMaterial();
>>  > >                                 beanRemote.testMaterialType();
>>  > >                                 //beanRemote.testRelation();
>>  > >                         }
>>  > >
>>  > > </code>
>>  > >
>>  > > Error msg
>>  > > Exception in thread "main" javax.ejb.EJBException: The bean
>>  > > encountered a non-application exception.; nested exception is:
>>  > >        <openjpa-1.0.1-r420667:592145 fatal general error>
>>  > > org.apache.openjpa.persistence.PersistenceException: null
>>  > >        at
>>  >
>> org.apache.openejb.client.EJBInvocationHandler.convertException(EJBInvocationHandler.java:210)
>>  > >        at
>>  >
>> org.apache.openejb.client.EJBObjectHandler._invoke(EJBObjectHandler.java:157)
>>  > >        at
>>  >
>> org.apache.openejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:116)
>>  > >        at
>>  >
>> org.apache.openejb.client.proxy.Jdk13InvocationHandler.invoke(Jdk13InvocationHandler.java:52)
>>  > >        at $Proxy0.testMaterialType(Unknown Source)
>>  > >        at
>>  >
>> test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:52)
>>  > > Caused by: <openjpa-1.0.1-r420667:592145 fatal general error>
>>  > > org.apache.openjpa.persistence.PersistenceException: null
>>  > >        at
>>  >
>> org.apache.openjpa.jdbc.schema.DataSourceFactory.installDBDictionary(DataSourceFactory.java:234)
>>  > >        at
>>  >
>> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:709)
>>  > >        at
>>  >
>> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDataSource(JDBCConfigurationImpl.java:809)
>>  > >        at
>>  >
>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setContext(JDBCStoreManager.java:120)
>>  > >        at
>>  >
>> org.apache.openjpa.kernel.DelegatingStoreManager.setContext(DelegatingStoreManager.java:78)
>>  > >        at
>>  > org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:285)
>>  > >        at
>>  >
>> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:187)
>>  > >        at
>>  >
>> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:142)
>>  > >        at
>>  >
>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:192)
>>  > >        at
>>  >
>> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:56)
>>  > >        at
>>  >
>> org.apache.geronimo.persistence.CMPEntityManagerTxScoped.createEntityManager(CMPEntityManagerTxScoped.java:74)
>>  > >        at
>>  >
>> org.apache.geronimo.persistence.CMPEntityManagerTxScoped.getEntityManager(CMPEntityManagerTxScoped.java:55)
>>  > >        at
>>  >
>> org.apache.geronimo.persistence.CMPEntityManagerTxScoped.persist(CMPEntityManagerTxScoped.java:81)
>>  > >        at
>>  >
>> com.quesofttech.session.MaterialTestBean.testMaterialType(MaterialTestBean.java:63)
>>  > >        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.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:146)
>>  > >        at
>>  >
>> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:129)
>>  > >        at
>>  >
>> org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:67)
>>  > >        at
>>  >
>> org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:210)
>>  > >        at
>>  >
>> org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:188)
>>  > >        at
>>  >
>> org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:165)
>>  > >        at
>>  >
>> org.apache.openejb.server.ejbd.EjbRequestHandler.doEjbObject_BUSINESS_METHOD(EjbRequestHandler.java:214)
>>  > >        at
>>  >
>> org.apache.openejb.server.ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java:121)
>>  > >        at
>>  >
>> org.apache.openejb.server.ejbd.EjbDaemon.processEjbRequest(EjbDaemon.java:164)
>>  > >        at
>>  > org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:122)
>>  > >        at
>>  > org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:84)
>>  > >        at
>>  > org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:60)
>>  > >        at
>>  > org.apache.openejb.server.ServiceLogger.service(ServiceLogger.java:76)
>>  > >        at
>>  >
>> org.apache.openejb.server.ServiceAccessController.service(ServiceAccessController.java:55)
>>  > >        at
>>  > org.apache.openejb.server.ServiceDaemon$1.run(ServiceDaemon.java:118)
>>  > >        at java.lang.Thread.run(Thread.java:619)
>>  > > Caused by: java.lang.Exception: java.lang.NullPointerException
>>  > >        at
>>  >
>> org.apache.openjpa.util.Exceptions.replaceNestedThrowables(Exceptions.java:242)
>>  > >        at
>>  >
>> org.apache.openjpa.persistence.PersistenceException.writeObject(PersistenceException.java:100)
>>  > >        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
>>  >
>> java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
>>  > >        at
>>  >
>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
>>  > >        at
>>  >
>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>>  > >        at
>>  > java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>>  > >        at
>>  >
>> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
>>  > >        at
>>  >
>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
>>  > >        at
>>  >
>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>>  > >        at
>>  > java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>>  > >        at
>>  > java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
>>  > >        at
>>  >
>> org.apache.openejb.client.ThrowableArtifact.writeExternal(ThrowableArtifact.java:49)
>>  > >        at
>>  >
>> java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1421)
>>  > >        at
>>  >
>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1390)
>>  > >        at
>>  > java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>>  > >        at
>>  > java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
>>  > >        at
>>  >
>> org.apache.openejb.client.EJBResponse.writeExternal(EJBResponse.java:111)
>>  > >        at
>>  >
>> org.apache.openejb.server.ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java:197)
>>  > >        ... 8 more
>>  > >
>>  > > <snip>
>>  > >
>>  >
>>
> 
> 


-----
B Amigo:super:
-- 
View this message in context: http://www.nabble.com/problem-JNDI-lookup-in-geronimo-tp16525445s134p21345528.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Mime
View raw message