You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by CG <le...@gmail.com> on 2008/04/06 16:53:26 UTC

problem JNDI lookup in geronimo

Hi, I am facing problem in using JNDI to do lookup. I have tried to
solve several problem using google before hitting this

I have materialType.properties and jndi.properties file deployed in geronimo

materialType.properties
================
jndi.process.ejb = java:comp/env/ejb/MaterialTestBean

jndi.properties
============
java.naming.factory.initial=org.openejb.client.RemoteInitialContextFactory
java.naming.provider.url=localhost:4201
java.naming.security.principal=system
java.naming.security.credentials=manager


The problem I face seems like not able to find the class
org.openejb.client.RemoteInitialContextFactory .
I think the reason should be openejb library missing or invalid but I
can't figure out where the openejb library in geronimo ..
Any help is appreciated , thanks.



Error msg
=========

javax.naming.NoInitialContextException: Cannot instantiate class:
org.openejb.client.RemoteInitialContextFactory [Root exception is
java.lang.ClassNotFoundException:
org.openejb.client.RemoteInitialContextFactory]
	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
	at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
	at javax.naming.InitialContext.init(InitialContext.java:223)
	at javax.naming.InitialContext.<init>(InitialContext.java:175)
	at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
Caused by: java.lang.ClassNotFoundException:
org.openejb.client.RemoteInitialContextFactory



<more codes>
  ::
		InitialContext context;
		MaterialTestBeanRemote beanRemote = null;
		ResourceBundle      bundle = null;

	      bundle = ResourceBundle.getBundle("materialType",
Locale.getDefault(), FirstEJB3TutorialClient.class.getClassLoader());
	      String jndiName = bundle.getString("jndi.process.ejb");
		try
		{
			 context = new InitialContext();
			 beanRemote = (MaterialTestBeanRemote)
context.lookup(MaterialTestBean.RemoteJNDIName);
			 beanRemote.testMaterial();
			 beanRemote.testMaterialType();
               }

 <more codes>

Re: problem JNDI lookup in geronimo

Posted by bongosdude <bo...@gmail.com>.
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 <le...@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 <da...@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.


Re: problem JNDI lookup in geronimo

Posted by CG <le...@gmail.com>.
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 <le...@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 <da...@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>
>  > >
>  >
>

Re: problem JNDI lookup in geronimo

Posted by CG <le...@gmail.com>.
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 <da...@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>
> >
>

Re: problem JNDI lookup in geronimo

Posted by David Jencks <da...@yahoo.com>.
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.getConnectionFactor 
> y(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.createEntityMa 
> nager(EntityManagerFactoryImpl.java:192)
> 	at  
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMa 
> nager(EntityManagerFactoryImpl.java:56)
> 	at  
> org.apache.geronimo.persistence.CMPEntityManagerTxScoped.createEntityM 
> anager(CMPEntityManagerTxScoped.java:74)
> 	at  
> org.apache.geronimo.persistence.CMPEntityManagerTxScoped.getEntityMana 
> ger(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.procee 
> d(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>

Re: problem JNDI lookup in geronimo

Posted by CG <le...@gmail.com>.
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






On Thu, Apr 10, 2008 at 9:55 PM, CG <le...@gmail.com> wrote:
> Thx Viet, it solved that problem.
>  I am facing another problem now , and I'll try to solve it myself
>  before coming back.
>
>  Thanks for all the guidance.
>
>  CG
>
>
>
>  On Thu, Apr 10, 2008 at 9:10 PM, Viet Nguyen <vh...@gmail.com> wrote:
>  > Your client probably does not have the geronimo-security jar in its
>  >  class path. Try adding
>  >
>  >  org/apache/geronimo/framework/geronimo-security//jar
>  >
>  >  to your classpath.
>  >
>  >  --Viet
>  >
>  >
>  >
>  >  On Thu, Apr 10, 2008 at 8:43 AM, CG <le...@gmail.com> wrote:
>  >  > Thx Nguyen. This solved the problem.
>  >  >
>  >  >  I am facing another problem now , which hv troubled me for 2 days and
>  >  >  could find solution on google.
>  >  >
>  >  >
>  >  >  It is still stuck at     context = new InitialContext(props);
>  >  >
>  >  >  The error is
>  >  >  Cannot read the response from the server.  The class for an object
>  >  >  being returned is not located in this system
>  >  >
>  >  >  I'm not sure which class is the refer to in the error , is it related
>  >  >  to the JNDI of the ejb ?
>  >  >
>  >  >
>  >  >  Koa
>  >  >
>  >  >
>  >  >  Full error
>  >  >  =======
>  >  >  javax.naming.AuthenticationException: Cannot read the response from
>  >  >  the server.  The class for an object being returned is not located in
>  >  >  this system:; nested exception is:
>  >  >         java.lang.ClassNotFoundException: org.apache.geronimo.security.SubjectId
>  >  >
>  >  >         at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
>  >  >         at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>  >  >         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>  >  >         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >  >         at javax.naming.InitialContext.init(InitialContext.java:223)
>  >  >
>  >  >         at javax.naming.InitialContext.<init>(InitialContext.java:197)
>  >  >         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:47)
>  >  >
>  >  > Exception in thread "main" java.lang.RuntimeException:
>  >  >  javax.naming.AuthenticationException: Cannot read the response from
>  >  >  the server.  The class for an object being returned is not located in
>  >  >  this system:; nested exception is:
>  >  >         java.lang.ClassNotFoundException: org.apache.geronimo.security.SubjectId
>  >  >         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:58)
>  >  >  Caused by: javax.naming.AuthenticationException: Cannot read the
>  >  >  response from the server.  The class for an object being returned is
>  >  >  not located in this system:; nested exception is:
>  >  >         java.lang.ClassNotFoundException: org.apache.geronimo.security.SubjectId
>  >  >
>  >  >         at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
>  >  >         at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>  >  >         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>  >  >         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >  >         at javax.naming.InitialContext.init(InitialContext.java:223)
>  >  >
>  >  >         at javax.naming.InitialContext.<init>(InitialContext.java:197)
>  >  >         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:47)
>  >  >
>  >  >
>  >  >
>  >  >
>  >  >
>  >  >
>  >  >
>  >  >
>  >  >
>  >  >
>  >  >  On Wed, Apr 9, 2008 at 12:37 AM, Viet Nguyen <vh...@gmail.com> wrote:
>  >  >  > You also need to specify the security realm in which you want to
>  >  >  >  authenticate against. Try adding this to your props
>  >  >  >
>  >  >  >                 props.setProperty("openejb.authentication.realmName",
>  >  >  >  "geronimo-admin");
>  >  >  >
>  >  >  >  Regards,
>  >  >  >  Viet
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >  >  On Tue, Apr 8, 2008 at 11:38 AM, CG <le...@gmail.com> wrote:
>  >  >  >  > hi, thanks for the feedback.
>  >  >  >  >
>  >  >  >  >  I have tried to settle the new problem but no luck , it is out of my ability.
>  >  >  >  >  I can confirm the user and password works.
>  >  >  >  >
>  >  >  >  >  But the error msg seems like telling me that authentication failed ..
>  >  >  >  >
>  >  >  >  >  Any hints will be appreciated .. thx.
>  >  >  >  >
>  >  >  >  >  CG
>  >  >  >  >
>  >  >  >  >  <my code>
>  >  >  >  >  // initially has no this part , manually added to isolate the possible
>  >  >  >  >  problem of properties file
>  >  >  >  >             Properties props = new Properties();
>  >  >  >  >  props.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.openejb.client.RemoteInitialContextFactory");
>  >  >  >  >             props.put(Context.PROVIDER_URL,"ejbd://127.0.0.1:4201");
>  >  >  >  >             props.setProperty(Context.SECURITY_PRINCIPAL, "system");
>  >  >  >  >             props.setProperty(Context.SECURITY_CREDENTIALS, "manager");
>  >  >  >  >   // end
>  >  >  >  >                          context = new InitialContext(props);    <--- problem at this line
>  >  >  >  >
>  >  >  >  >  < end my code>
>  >  >  >  >
>  >  >  >  >  Error message
>  >  >  >  >  ==============
>  >  >  >  >  javax.naming.AuthenticationException: This principle is not
>  >  >  >  >  authorized. [Root exception is
>  >  >  >  >  javax.security.auth.login.LoginException: Invalid null input: name]
>  >  >  >  >         at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:162)
>  >  >  >  >
>  >  >  >  >         at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>  >  >  >  >         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>  >  >  >  >         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >  >  >  >         at javax.naming.InitialContext.init(InitialContext.java:223)
>  >  >  >  >         at javax.naming.InitialContext.<init>(InitialContext.java:197)
>  >  >  >  >         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:46)
>  >  >  >  >  Caused by: javax.security.auth.login.LoginException: Invalid null input: name
>  >  >  >  >         at javax.security.auth.login.LoginContext.init(LoginContext.java:229)
>  >  >  >  >         at javax.security.auth.login.LoginContext.<init>(LoginContext.java:367)
>  >  >  >  >         at javax.security.auth.login.LoginContext.<init>(LoginContext.java:444)
>  >  >  >  >         at org.apache.geronimo.security.ContextManager.login(ContextManager.java:74)
>  >  >  >  >         at org.apache.geronimo.openejb.GeronimoSecurityService.login(GeronimoSecurityService.java:52)
>  >  >  >  >         at org.apache.openejb.server.ejbd.AuthRequestHandler.processRequest(AuthRequestHandler.java:56)
>  >  >  >  >         at org.apache.openejb.server.ejbd.EjbDaemon.processAuthRequest(EjbDaemon.java:172)
>  >  >  >  >         at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:130)
>  >  >  >  >         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)
>  >  >  >  >
>  >  >  >  > Exception in thread "main" java.lang.RuntimeException:
>  >  >  >  >  javax.naming.AuthenticationException: This principle is not
>  >  >  >  >  authorized. [Root exception is
>  >  >  >  >  javax.security.auth.login.LoginException: Invalid null input: name]
>  >  >  >  >         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:57)
>  >  >  >  >  Caused by: javax.naming.AuthenticationException: This principle is not
>  >  >  >  >  authorized. [Root exception is
>  >  >  >  >  javax.security.auth.login.LoginException: Invalid null input: name]
>  >  >  >  >         at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:162)
>  >  >  >  >
>  >  >  >  >         at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>  >  >  >  >         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>  >  >  >  >         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >  >  >  >         at javax.naming.InitialContext.init(InitialContext.java:223)
>  >  >  >  >         at javax.naming.InitialContext.<init>(InitialContext.java:197)
>  >  >  >  >         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:46)
>  >  >  >  >  Caused by: javax.security.auth.login.LoginException: Invalid null input: name
>  >  >  >  >         at javax.security.auth.login.LoginContext.init(LoginContext.java:229)
>  >  >  >  >         at javax.security.auth.login.LoginContext.<init>(LoginContext.java:367)
>  >  >  >  >         at javax.security.auth.login.LoginContext.<init>(LoginContext.java:444)
>  >  >  >  >         at org.apache.geronimo.security.ContextManager.login(ContextManager.java:74)
>  >  >  >  >         at org.apache.geronimo.openejb.GeronimoSecurityService.login(GeronimoSecurityService.java:52)
>  >  >  >  >         at org.apache.openejb.server.ejbd.AuthRequestHandler.processRequest(AuthRequestHandler.java:56)
>  >  >  >  >         at org.apache.openejb.server.ejbd.EjbDaemon.processAuthRequest(EjbDaemon.java:172)
>  >  >  >  >         at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:130)
>  >  >  >  >         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)
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >  Geronimo log
>  >  >  >  >  ===========
>  >  >  >  >  84387:  23:50:31,778 DEBUG [auth] AUTH REQUEST: null:system --
>  >  >  >  >  RESPONSE: AUTH_DENIED:javax.security.auth.login.LoginException:
>  >  >  >  >  Invalid null input: name
>  >  >  >  >  84388:  23:50:38,941 DEBUG [CoyoteAdapter] Requested cookie session id
>  >  >  >  >  is 27D8EC25DC047479A6FB368DDB730876
>  >  >  >  >  84389:  23:50:38,941 DEBUG [AuthenticatorBase] Security checking
>  >  >  >  >  request GET /console/portal//Server/Server%20Logs/__ac0x3console-base0x2LogViewer!1535651776|1
>  >  >  >  >  84390:  23:50:38,941 DEBUG [AuthenticatorBase] We have cached auth
>  >  >  >  >  type FORM for principal
>  >  >  >  >  org.apache.geronimo.tomcat.JAASTomcatPrincipal@194a7fb
>  >  >  >  >  84391:  23:50:38,941 DEBUG [AuthenticatorBase] Calling hasUserDataPermission()
>  >  >  >  >  84392:  23:50:38,941 DEBUG [AuthenticatorBase] Calling authenticate()
>  >  >  >  >  84393:  23:50:38,941 DEBUG [FormAuthenticator] Already authenticated 'system'
>  >  >  >  >  84394:  23:50:38,941 DEBUG [AuthenticatorBase] Calling accessControl()
>  >  >  >  >  84395:  23:50:38,941 DEBUG [AuthenticatorBase] Successfully passed all
>  >  >  >  >  security constraints
>  >  >  >  >  84396:  23:50:38,941 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  >  >  84397:  23:50:38,942 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  >  >  84398:  23:50:38,945 DEBUG [CoyoteAdapter] Requested cookie session id
>  >  >  >  >  is 27D8EC25DC047479A6FB368DDB730876
>  >  >  >  >  84399:  23:50:38,945 DEBUG [AuthenticatorBase] Security checking
>  >  >  >  >  request GET /console/portal//Server/Server%20Logs/__rp0x3console-base0x2LogViewer!1535651776|1_logFile/0x3home0x3super0x3bin0x3geronimo-tomcat6-javaee5-20x210x3var0x3log0x3geronimo0x2log/__rp0x3console-base0x2LogViewer!1535651776|1_action/search/__rp0x3console-base0x2LogViewer!1535651776|1_logLevel/TRACE/__rp0x3console-base0x2LogViewer!1535651776|1_maxRows/50
>  >  >  >  >  84400:  23:50:38,945 DEBUG [AuthenticatorBase] We have cached auth
>  >  >  >  >  type FORM for principal
>  >  >  >  >  org.apache.geronimo.tomcat.JAASTomcatPrincipal@194a7fb
>  >  >  >  >  84401:  23:50:38,945 DEBUG [AuthenticatorBase] Calling hasUserDataPermission()
>  >  >  >  >  84402:  23:50:38,945 DEBUG [AuthenticatorBase] Calling authenticate()
>  >  >  >  >  84403:  23:50:38,945 DEBUG [FormAuthenticator] Already authenticated 'system'
>  >  >  >  >  84404:  23:50:38,946 DEBUG [AuthenticatorBase] Calling accessControl()
>  >  >  >  >  84405:  23:50:38,946 DEBUG [AuthenticatorBase] Successfully passed all
>  >  >  >  >  security constraints
>  >  >  >  >  84406:  23:50:38,946 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  >  >  84407:  23:50:38,946 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  >  >  84408:  23:50:38,947 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  >  >  84409:  23:50:39,129 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  >  >  84410:  23:50:39,130 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  >  >  84411:  23:50:39,131 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  >  >  84412:  23:50:39,132 INFO [SupportedModesServiceImpl] Portlet mode
>  >  >  >  >  'edit' not found for portletId:
>  >  >  >  >  '/console-base.LogManager!1535651776|0'
>  >  >  >  >  84413:  23:50:39,140 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  >  >  84414:  23:50:39,146 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >  On Tue, Apr 8, 2008 at 3:25 AM, David Blevins <da...@visi.com> wrote:
>  >  >  >  >  >
>  >  >  >  >  >  On Apr 7, 2008, at 8:36 AM, CG wrote:
>  >  >  >  >  >
>  >  >  >  >  > > Hi all,
>  >  >  >  >  > > After googling again,  I have solved the problem by changing the
>  >  >  >  >  > > jndi.properties , localhost:4201 to 127.0.0.1:4201.
>  >  >  >  >  > >
>  >  >  >  >  >
>  >  >  >  >  >  You can use "localhost" as a host, you just need to add
>  >  >  >  >  > "ejbd://localhost:4201" due to the way URIs are parsed.  In the openejb 3.0
>  >  >  >  >  > final up for a vote now, we check your provider url string a bit more before
>  >  >  >  >  > giving it to java.net.URI and make corrections.
>  >  >  >  >  >
>  >  >  >  >  >
>  >  >  >  >  >
>  >  >  >  >  > > After solving that , another problem coming up , I still need time to
>  >  >  >  >  > > do more searching.
>  >  >  >  >  > >
>  >  >  >  >  >
>  >  >  >  >  >  Happy to help when you get the details.
>  >  >  >  >  >
>  >  >  >  >  >  -David
>  >  >  >  >  >
>  >  >  >  >  >
>  >  >  >  >  >
>  >  >  >  >  >
>  >  >  >  >  > >
>  >  >  >  >  > >
>  >  >  >  >  > > CG
>  >  >  >  >  > >
>  >  >  >  >  > > On Mon, Apr 7, 2008 at 9:29 PM, CG <le...@gmail.com> wrote:
>  >  >  >  >  > >
>  >  >  >  >  > > > Forget to attach the error message in the previous mail, here it is.
>  >  >  >  >  > > >
>  >  >  >  >  > > > Error
>  >  >  >  >  > > > ====
>  >  >  >  >  > > > javax.naming.AuthenticationException: Cannot connect to server
>  >  >  >  >  > > > 'localhost:4201"; nested exception is:
>  >  >  >  >  > > >       java.io.IOException: Cannot  connect to server: 'localhost:4201'
>  >  >  >  >  > due
>  >  >  >  >  > > > to an unkown exception in the OpenEJB client:
>  >  >  >  >  > > > java.lang.IllegalArgumentException : port out of range:-1
>  >  >  >  >  > > >       at
>  >  >  >  >  > org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
>  >  >  >  >  > > >       at
>  >  >  >  >  > org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>  >  >  >  >  > > >       at
>  >  >  >  >  > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>  >  >  >  >  > > >
>  >  >  >  >  > > >       at
>  >  >  >  >  > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >  >  >  >  > > >       at javax.naming.InitialContext.init(InitialContext.java:223)
>  >  >  >  >  > > >       at javax.naming.InitialContext.<init>(InitialContext.java:175)
>  >  >  >  >  > > >       at
>  >  >  >  >  > test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
>  >  >  >  >  > > > Exception in thread "main" java.lang.RuntimeException:
>  >  >  >  >  > > > javax.naming.AuthenticationException: Cannot connect to server
>  >  >  >  >  > > > 'localhost:4201"; nested exception is:
>  >  >  >  >  > > >       java.io.IOException: Cannot  connect to server: 'localhost:4201'
>  >  >  >  >  > due
>  >  >  >  >  > > > to an unkown exception in the OpenEJB client:
>  >  >  >  >  > > > java.lang.IllegalArgumentException : port out of range:-1
>  >  >  >  >  > > >       at
>  >  >  >  >  > test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:50)
>  >  >  >  >  > > > Caused by: javax.naming.AuthenticationException: Cannot connect to
>  >  >  >  >  > > > server 'localhost:4201"; nested exception is:
>  >  >  >  >  > > >       java.io.IOException: Cannot  connect to server: 'localhost:4201'
>  >  >  >  >  > due
>  >  >  >  >  > > > to an unkown exception in the OpenEJB client:
>  >  >  >  >  > > > java.lang.IllegalArgumentException : port out of range:-1
>  >  >  >  >  > > >       at
>  >  >  >  >  > org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
>  >  >  >  >  > > >       at
>  >  >  >  >  > org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>  >  >  >  >  > > >       at
>  >  >  >  >  > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>  >  >  >  >  > > >
>  >  >  >  >  > > >       at
>  >  >  >  >  > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >  >  >  >  > > >       at javax.naming.InitialContext.init(InitialContext.java:223)
>  >  >  >  >  > > >       at javax.naming.InitialContext.<init>(InitialContext.java:175)
>  >  >  >  >  > > >       at
>  >  >  >  >  > test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
>  >  >  >  >  > > >
>  >  >  >  >  > > >
>  >  >  >  >  > > >
>  >  >  >  >  > > >
>  >  >  >  >  > > >
>  >  >  >  >  > > >
>  >  >  >  >  > > > On Mon, Apr 7, 2008 at 9:19 PM, CG <le...@gmail.com> wrote:
>  >  >  >  >  > > >
>  >  >  >  >  > > > > Hi all,
>  >  >  >  >  > > > > I have managed to add the appropriate library but encounter another
>  >  >  >  >  > problem.
>  >  >  >  >  > > > >
>  >  >  >  >  > > > > It seems like port 4201 does not have the JNDI provider service
>  >  >  >  >  > running.
>  >  >  >  >  > > > >
>  >  >  >  >  > > > > May I know whether geronimo built-in with JNDI provider service or
>  >  >  >  >  > not?
>  >  >  >  >  > > > > I noticed that there is LDAP service (which can be a JNDI provider
>  >  >  >  >  > > > > service to my understanding)running at port 1389  , and I tried to
>  >  >  >  >  > > > > change the jndi.properties to connect to port 1389 instead , however,
>  >  >  >  >  > > > > no luck , error still persist.
>  >  >  >  >  > > > >
>  >  >  >  >  > > > > any idea ?
>  >  >  >  >  > > > >
>  >  >  >  >  > > > > Thanks in advanced.
>  >  >  >  >  > > > >
>  >  >  >  >  > > > > CG
>  >  >  >  >  > > > >
>  >  >  >  >  > > > >
>  >  >  >  >  > > > >
>  >  >  >  >  > > > >
>  >  >  >  >  > > > > On Mon, Apr 7, 2008 at 7:56 PM, CG <le...@gmail.com> wrote:
>  >  >  >  >  > > > >
>  >  >  >  >  > > > > > thanks david.
>  >  >  >  >  > > > > >
>  >  >  >  >  > > > > > I just wonder how do I add those libraries in the classpath in
>  >  >  >  >  > eclipse
>  >  >  >  >  > > > > > ? Is it going to Build path > add external jar ?
>  >  >  >  >  > > > > >
>  >  >  >  >  > > > > > Isn't the GEP have added those thing automatically ?
>  >  >  >  >  > > > > >
>  >  >  >  >  > > > > > thanks for your patient  to guide a newbie of Java & eclipse.
>  >  >  >  >  > > > > >
>  >  >  >  >  > > > > >
>  >  >  >  >  > > > > >
>  >  >  >  >  > > > > >
>  >  >  >  >  > > > > > On Sun, Apr 6, 2008 at 11:21 PM, David Jencks
>  >  >  >  >  > <da...@yahoo.com> wrote:
>  >  >  >  >  > > > > >
>  >  >  >  >  > > > > > > The library you need in your client classpath is at
>  >  >  >  >  > > > > > >
>  >  >  >  >  > > > > > >
>  >  >  >  >  > repository/org/apache/openejb/openejb-client/*/openejb-client-*.jar
>  >  >  >  >  > > > > > >
>  >  >  >  >  > > > > > > thanks
>  >  >  >  >  > > > > > > david jencks
>  >  >  >  >  > > > > > >
>  >  >  >  >  > > > > > >
>  >  >  >  >  > > > > > >
>  >  >  >  >  > > > > > > On Apr 6, 2008, at 7:53 AM, CG wrote:
>  >  >  >  >  > > > > > >
>  >  >  >  >  > > > > > >
>  >  >  >  >  > > > > > >
>  >  >  >  >  > > > > > > > Hi, I am facing problem in using JNDI to do lookup. I have tried
>  >  >  >  >  > to
>  >  >  >  >  > > > > > > > solve several problem using google before hitting this
>  >  >  >  >  > > > > > > >
>  >  >  >  >  > > > > > > > I have materialType.properties and jndi.properties file deployed
>  >  >  >  >  > in
>  >  >  >  >  > > > > > > >
>  >  >  >  >  > > > > > > geronimo
>  >  >  >  >  > > > > > >
>  >  >  >  >  > > > > > > >
>  >  >  >  >  > > > > > > > materialType.properties
>  >  >  >  >  > > > > > > > ================
>  >  >  >  >  > > > > > > > jndi.process.ejb = java:comp/env/ejb/MaterialTestBean
>  >  >  >  >  > > > > > > >
>  >  >  >  >  > > > > > > > jndi.properties
>  >  >  >  >  > > > > > > > ============
>  >  >  >  >  > > > > > > >
>  >  >  >  >  > java.naming.factory.initial=org.openejb.client.RemoteInitialContextFactory
>  >  >  >  >  > > > > > > > java.naming.provider.url=localhost:4201
>  >  >  >  >  > > > > > > > java.naming.security.principal=system
>  >  >  >  >  > > > > > > > java.naming.security.credentials=manager
>  >  >  >  >  > > > > > > >
>  >  >  >  >  > > > > > > >
>  >  >  >  >  > > > > > > > The problem I face seems like not able to find the class
>  >  >  >  >  > > > > > > > org.openejb.client.RemoteInitialContextFactory .
>  >  >  >  >  > > > > > > > I think the reason should be openejb library missing or invalid
>  >  >  >  >  > but I
>  >  >  >  >  > > > > > > > can't figure out where the openejb library in geronimo ..
>  >  >  >  >  > > > > > > > Any help is appreciated , thanks.
>  >  >  >  >  > > > > > > >
>  >  >  >  >  > > > > > > >
>  >  >  >  >  > > > > > > >
>  >  >  >  >  > > > > > > > Error msg
>  >  >  >  >  > > > > > > > =========
>  >  >  >  >  > > > > > > >
>  >  >  >  >  > > > > > > > javax.naming.NoInitialContextException: Cannot instantiate
>  >  >  >  >  > class:
>  >  >  >  >  > > > > > > > org.openejb.client.RemoteInitialContextFactory [Root exception
>  >  >  >  >  > is
>  >  >  >  >  > > > > > > > java.lang.ClassNotFoundException:
>  >  >  >  >  > > > > > > > org.openejb.client.RemoteInitialContextFactory]
>  >  >  >  >  > > > > > > >      at
>  >  >  >  >  > > > > > > >
>  >  >  >  >  > > > > > >
>  >  >  >  >  > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
>  >  >  >  >  > > > > > >
>  >  >  >  >  > > > > > > >      at
>  >  >  >  >  > > > > > > >
>  >  >  >  >  > > > > > >
>  >  >  >  >  > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >  >  >  >  > > > > > >
>  >  >  >  >  > > > > > > >      at
>  >  >  >  >  > javax.naming.InitialContext.init(InitialContext.java:223)
>  >  >  >  >  > > > > > > >      at
>  >  >  >  >  > javax.naming.InitialContext.<init>(InitialContext.java:175)
>  >  >  >  >  > > > > > > >      at
>  >  >  >  >  > > > > > > >
>  >  >  >  >  > > > > > >
>  >  >  >  >  > test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
>  >  >  >  >  > > > > > >
>  >  >  >  >  > > > > > > > Caused by: java.lang.ClassNotFoundException:
>  >  >  >  >  > > > > > > > org.openejb.client.RemoteInitialContextFactory
>  >  >  >  >  > > > > > > >
>  >  >  >  >  > > > > > > >
>  >  >  >  >  > > > > > > >
>  >  >  >  >  > > > > > > > <more codes>
>  >  >  >  >  > > > > > > > ::
>  >  >  >  >  > > > > > > >              InitialContext context;
>  >  >  >  >  > > > > > > >              MaterialTestBeanRemote beanRemote = null;
>  >  >  >  >  > > > > > > >              ResourceBundle      bundle = null;
>  >  >  >  >  > > > > > > >
>  >  >  >  >  > > > > > > >            bundle = ResourceBundle.getBundle("materialType",
>  >  >  >  >  > > > > > > > Locale.getDefault(),
>  >  >  >  >  > FirstEJB3TutorialClient.class.getClassLoader());
>  >  >  >  >  > > > > > > >            String jndiName =
>  >  >  >  >  > bundle.getString("jndi.process.ejb");
>  >  >  >  >  > > > > > > >              try
>  >  >  >  >  > > > > > > >              {
>  >  >  >  >  > > > > > > >                       context = new InitialContext();
>  >  >  >  >  > > > > > > >                       beanRemote = (MaterialTestBeanRemote)
>  >  >  >  >  > > > > > > > context.lookup(MaterialTestBean.RemoteJNDIName);
>  >  >  >  >  > > > > > > >                       beanRemote.testMaterial();
>  >  >  >  >  > > > > > > >                       beanRemote.testMaterialType();
>  >  >  >  >  > > > > > > >             }
>  >  >  >  >  > > > > > > >
>  >  >  >  >  > > > > > > > <more codes>
>  >  >  >  >  > > > > > > >
>  >  >  >  >  > > > > > > >
>  >  >  >  >  > > > > > >
>  >  >  >  >  > > > > > >
>  >  >  >  >  > > > > > >
>  >  >  >  >  > > > > >
>  >  >  >  >  > > > > >
>  >  >  >  >  > > > >
>  >  >  >  >  > > > >
>  >  >  >  >  > > >
>  >  >  >  >  > > >
>  >  >  >  >  > >
>  >  >  >  >  > >
>  >  >  >  >  >
>  >  >  >  >  >
>  >  >  >  >
>  >  >  >
>  >  >
>  >
>

RE: Annotations and JNDI

Posted by Jean-Baptiste <Je...@montrealboutique.com>.
Thanks for the link to the sample apps! 
I'll check it out.

JB

-----Original Message-----
From: Viet Nguyen [mailto:vhnguy2@gmail.com] 
Sent: April 10, 2008 2:39 PM
To: user@geronimo.apache.org
Subject: Re: Annotations and JNDI

Hello,

Try using the attribute 'name' instead of 'mappedName.' We also have a
simple sample application which illustrates what you are doing at
http://cwiki.apache.org/GMOxDOC21/jms-and-mdb-sample-application.html.

Regards,
Viet Nguyen

2008/4/10 Jean-Baptiste <Je...@montrealboutique.com>:
> Hello,
>
>  Are Ressource mappedName annotations supported within Geronimo?
>
>  I'm trying to instantiate a ConnectionFactory using the following code:
>  @Resource(mappedName="jms/broker")
>    private static QueueConnectionFactory connectionFactory;
>
>  I have added a dependency to activemq using the following:
>  <sys:dependency>
>         <sys:groupId>org.apache.geronimo.configs</sys:groupId>
>       <sys:artifactId>activemq-ra</sys:artifactId>
>  </sys:dependency>
>
>  I have created a reference to the Default connection factory
>  <nam:resource-ref>
>         <nam:ref-name>jms/broker</nam:ref-name>
>
>  <nam:resource-link>DefaultActiveMQConnectionFactory</nam:resource-link>
>  </nam:resource-ref>
>
>  I have added this to my web.xml
>  <resource-ref>
>         <res-ref-name>jms/broker</res-ref-name>
>         <res-type>javax.jms.QueueConnectionFactory</res-type>
>         <res-auth>Container</res-auth>
>  </resource-ref>
>
>  But... it doest not work, am I missing something or it is just not
supported
>  (yet ?!). Thanks !
>
>  Distribution of configuration failed.  See log for details.
>   Unable to resolve resource reference
>  'com.testwm.Servlet2/connectionFactory' (Could not auto-map to resource.
>  Try adding a resource-ref mapping to your Geronimo deployment plan.
>   Search conducted in current module and dependencies:
>   [ALL: org.apache.geronimo.configs/activemq-ra//]
>   [ALL: org.apache.geronimo.configs/tomcat6/2.1/car]
>   [ALL: org.apache.geronimo.configs/openjpa//car]
>   [CLASSES: org.apache.geronimo.configs/openejb//car]
>   [ALL: org.apache.geronimo.configs/j2ee-corba-yoko//car]
>   [ALL: org.apache.geronimo.configs/axis//car]
>   [ALL: org.apache.geronimo.configs/axis2//car]
>   )
>   org.apache.geronimo.common.DeploymentException: Unable to resolve
resource
>  reference 'com.testwm.Servlet2/connectionFactory' (Could not auto-map to
>  resource.  Try adding a resource-ref mapping to your Geronimo deployment
>  plan.
>   Search conducted in current module and dependencies:
>   [ALL: org.apache.geronimo.configs/activemq-ra//]
>   [ALL: org.apache.geronimo.configs/tomcat6/2.1/car]
>   [ALL: org.apache.geronimo.configs/openjpa//car]
>   [CLASSES: org.apache.geronimo.configs/openejb//car]
>   [ALL: org.apache.geronimo.configs/j2ee-corba-yoko//car]
>   [ALL: org.apache.geronimo.configs/axis//car]
>   [ALL: org.apache.geronimo.configs/axis2//car]
>   )
>         at
>
org.apache.geronimo.connector.deployment.ResourceRefBuilder.buildNaming(Reso
>  urceRefBuilder.java:207)
>         at
>
org.apache.geronimo.j2ee.deployment.NamingBuilderCollection.buildNaming(Nami
>  ngBuilderCollection.java:53)
>         at
>
org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.configureBasic
>  WebModuleAttributes(AbstractWebModuleBuilder.java:842)
>         at
>
org.apache.geronimo.tomcat.deployment.TomcatModuleBuilder.addGBeans(TomcatMo
>  duleBuilder.java:343)
>         at
>
org.apache.geronimo.j2ee.deployment.SwitchingModuleBuilder.addGBeans(Switchi
>  ngModuleBuilder.java:165)
>         at
>
org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARC
>  onfigBuilder.java:647)
>         at
org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:254)
>         at
org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:133)
>         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.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionM
>  ethodInvoker.java:34)
>         at
>
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:
>  124)
>         at
>
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:86
>  7)
>         at
>  org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
>         at
>  org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:342)
>         at sun.reflect.GeneratedMethodAccessor151.invoke(Unknown Source)
>         at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
>  .java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at
>
org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionM
>  ethodInvoker.java:34)
>         at
>
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:
>  124)
>         at
>
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:86
>  7)
>         at
>  org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
>         at
>
org.apache.geronimo.system.jmx.MBeanGBeanBridge.invoke(MBeanGBeanBridge.java
>  :172)
>         at
>
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanSer
>  verInterceptor.java:836)
>         at
>  com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
>         at
>
javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.
>  java:1426)
>         at
>
javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.j
>  ava:72)
>         at
>
javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMICon
>  nectionImpl.java:1264)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at
>
javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConne
>  ctionImpl.java:1366)
>         at
>
javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:
>  788)
>         at sun.reflect.GeneratedMethodAccessor69.invoke(Unknown Source)
>         at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
>  .java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at
>  sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
>         at sun.rmi.transport.Transport$1.run(Transport.java:159)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>         at
>  sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>         at
>
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:
>  790)
>         at
>
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:6
>  49)
>         at
>
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.ja
>  va:885)
>         at
>
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:9
>  07)
>         at java.lang.Thread.run(Thread.java:619)
>
>  No virus found in this outgoing message.
>  Checked by AVG.
>  Version: 7.5.519 / Virus Database: 269.22.11/1368 - Release Date:
09/04/2008
>  4:20 PM
>
>
>


-- 
No virus found in this incoming message.
Checked by AVG. 
Version: 7.5.519 / Virus Database: 269.22.11/1368 - Release Date: 09/04/2008
4:20 PM

No virus found in this incoming message.
Checked by AVG. 
Version: 7.5.519 / Virus Database: 269.22.11/1368 - Release Date: 09/04/2008
4:20 PM
 

No virus found in this outgoing message.
Checked by AVG. 
Version: 7.5.519 / Virus Database: 269.22.11/1368 - Release Date: 09/04/2008
4:20 PM
 


Re: Annotations and JNDI

Posted by Viet Nguyen <vh...@gmail.com>.
Hello,

Try using the attribute 'name' instead of 'mappedName.' We also have a
simple sample application which illustrates what you are doing at
http://cwiki.apache.org/GMOxDOC21/jms-and-mdb-sample-application.html.

Regards,
Viet Nguyen

2008/4/10 Jean-Baptiste <Je...@montrealboutique.com>:
> Hello,
>
>  Are Ressource mappedName annotations supported within Geronimo?
>
>  I'm trying to instantiate a ConnectionFactory using the following code:
>  @Resource(mappedName="jms/broker")
>    private static QueueConnectionFactory connectionFactory;
>
>  I have added a dependency to activemq using the following:
>  <sys:dependency>
>         <sys:groupId>org.apache.geronimo.configs</sys:groupId>
>       <sys:artifactId>activemq-ra</sys:artifactId>
>  </sys:dependency>
>
>  I have created a reference to the Default connection factory
>  <nam:resource-ref>
>         <nam:ref-name>jms/broker</nam:ref-name>
>
>  <nam:resource-link>DefaultActiveMQConnectionFactory</nam:resource-link>
>  </nam:resource-ref>
>
>  I have added this to my web.xml
>  <resource-ref>
>         <res-ref-name>jms/broker</res-ref-name>
>         <res-type>javax.jms.QueueConnectionFactory</res-type>
>         <res-auth>Container</res-auth>
>  </resource-ref>
>
>  But... it doest not work, am I missing something or it is just not supported
>  (yet ?!). Thanks !
>
>  Distribution of configuration failed.  See log for details.
>   Unable to resolve resource reference
>  'com.testwm.Servlet2/connectionFactory' (Could not auto-map to resource.
>  Try adding a resource-ref mapping to your Geronimo deployment plan.
>   Search conducted in current module and dependencies:
>   [ALL: org.apache.geronimo.configs/activemq-ra//]
>   [ALL: org.apache.geronimo.configs/tomcat6/2.1/car]
>   [ALL: org.apache.geronimo.configs/openjpa//car]
>   [CLASSES: org.apache.geronimo.configs/openejb//car]
>   [ALL: org.apache.geronimo.configs/j2ee-corba-yoko//car]
>   [ALL: org.apache.geronimo.configs/axis//car]
>   [ALL: org.apache.geronimo.configs/axis2//car]
>   )
>   org.apache.geronimo.common.DeploymentException: Unable to resolve resource
>  reference 'com.testwm.Servlet2/connectionFactory' (Could not auto-map to
>  resource.  Try adding a resource-ref mapping to your Geronimo deployment
>  plan.
>   Search conducted in current module and dependencies:
>   [ALL: org.apache.geronimo.configs/activemq-ra//]
>   [ALL: org.apache.geronimo.configs/tomcat6/2.1/car]
>   [ALL: org.apache.geronimo.configs/openjpa//car]
>   [CLASSES: org.apache.geronimo.configs/openejb//car]
>   [ALL: org.apache.geronimo.configs/j2ee-corba-yoko//car]
>   [ALL: org.apache.geronimo.configs/axis//car]
>   [ALL: org.apache.geronimo.configs/axis2//car]
>   )
>         at
>  org.apache.geronimo.connector.deployment.ResourceRefBuilder.buildNaming(Reso
>  urceRefBuilder.java:207)
>         at
>  org.apache.geronimo.j2ee.deployment.NamingBuilderCollection.buildNaming(Nami
>  ngBuilderCollection.java:53)
>         at
>  org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.configureBasic
>  WebModuleAttributes(AbstractWebModuleBuilder.java:842)
>         at
>  org.apache.geronimo.tomcat.deployment.TomcatModuleBuilder.addGBeans(TomcatMo
>  duleBuilder.java:343)
>         at
>  org.apache.geronimo.j2ee.deployment.SwitchingModuleBuilder.addGBeans(Switchi
>  ngModuleBuilder.java:165)
>         at
>  org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARC
>  onfigBuilder.java:647)
>         at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:254)
>         at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:133)
>         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.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionM
>  ethodInvoker.java:34)
>         at
>  org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:
>  124)
>         at
>  org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:86
>  7)
>         at
>  org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
>         at
>  org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:342)
>         at sun.reflect.GeneratedMethodAccessor151.invoke(Unknown Source)
>         at
>  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
>  .java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at
>  org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionM
>  ethodInvoker.java:34)
>         at
>  org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:
>  124)
>         at
>  org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:86
>  7)
>         at
>  org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
>         at
>  org.apache.geronimo.system.jmx.MBeanGBeanBridge.invoke(MBeanGBeanBridge.java
>  :172)
>         at
>  com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanSer
>  verInterceptor.java:836)
>         at
>  com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
>         at
>  javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.
>  java:1426)
>         at
>  javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.j
>  ava:72)
>         at
>  javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMICon
>  nectionImpl.java:1264)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at
>  javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConne
>  ctionImpl.java:1366)
>         at
>  javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:
>  788)
>         at sun.reflect.GeneratedMethodAccessor69.invoke(Unknown Source)
>         at
>  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
>  .java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at
>  sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
>         at sun.rmi.transport.Transport$1.run(Transport.java:159)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>         at
>  sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>         at
>  sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:
>  790)
>         at
>  sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:6
>  49)
>         at
>  java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.ja
>  va:885)
>         at
>  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:9
>  07)
>         at java.lang.Thread.run(Thread.java:619)
>
>  No virus found in this outgoing message.
>  Checked by AVG.
>  Version: 7.5.519 / Virus Database: 269.22.11/1368 - Release Date: 09/04/2008
>  4:20 PM
>
>
>

Annotations and JNDI

Posted by Jean-Baptiste <Je...@montrealboutique.com>.
Hello,

Are Ressource mappedName annotations supported within Geronimo?

I'm trying to instantiate a ConnectionFactory using the following code:
@Resource(mappedName="jms/broker")
   private static QueueConnectionFactory connectionFactory;

I have added a dependency to activemq using the following:
<sys:dependency>
	<sys:groupId>org.apache.geronimo.configs</sys:groupId>
      <sys:artifactId>activemq-ra</sys:artifactId>
</sys:dependency>

I have created a reference to the Default connection factory
<nam:resource-ref>
	<nam:ref-name>jms/broker</nam:ref-name>
	
<nam:resource-link>DefaultActiveMQConnectionFactory</nam:resource-link>
</nam:resource-ref> 

I have added this to my web.xml
<resource-ref>
	<res-ref-name>jms/broker</res-ref-name>
	<res-type>javax.jms.QueueConnectionFactory</res-type>
	<res-auth>Container</res-auth>
</resource-ref>

But... it doest not work, am I missing something or it is just not supported
(yet ?!). Thanks !

Distribution of configuration failed.  See log for details.
  Unable to resolve resource reference
'com.testwm.Servlet2/connectionFactory' (Could not auto-map to resource.
Try adding a resource-ref mapping to your Geronimo deployment plan.
  Search conducted in current module and dependencies:
  [ALL: org.apache.geronimo.configs/activemq-ra//]
  [ALL: org.apache.geronimo.configs/tomcat6/2.1/car]
  [ALL: org.apache.geronimo.configs/openjpa//car]
  [CLASSES: org.apache.geronimo.configs/openejb//car]
  [ALL: org.apache.geronimo.configs/j2ee-corba-yoko//car]
  [ALL: org.apache.geronimo.configs/axis//car]
  [ALL: org.apache.geronimo.configs/axis2//car]
  )
  org.apache.geronimo.common.DeploymentException: Unable to resolve resource
reference 'com.testwm.Servlet2/connectionFactory' (Could not auto-map to
resource.  Try adding a resource-ref mapping to your Geronimo deployment
plan.
  Search conducted in current module and dependencies:
  [ALL: org.apache.geronimo.configs/activemq-ra//]
  [ALL: org.apache.geronimo.configs/tomcat6/2.1/car]
  [ALL: org.apache.geronimo.configs/openjpa//car]
  [CLASSES: org.apache.geronimo.configs/openejb//car]
  [ALL: org.apache.geronimo.configs/j2ee-corba-yoko//car]
  [ALL: org.apache.geronimo.configs/axis//car]
  [ALL: org.apache.geronimo.configs/axis2//car]
  )
  	at
org.apache.geronimo.connector.deployment.ResourceRefBuilder.buildNaming(Reso
urceRefBuilder.java:207)
  	at
org.apache.geronimo.j2ee.deployment.NamingBuilderCollection.buildNaming(Nami
ngBuilderCollection.java:53)
  	at
org.apache.geronimo.web25.deployment.AbstractWebModuleBuilder.configureBasic
WebModuleAttributes(AbstractWebModuleBuilder.java:842)
  	at
org.apache.geronimo.tomcat.deployment.TomcatModuleBuilder.addGBeans(TomcatMo
duleBuilder.java:343)
  	at
org.apache.geronimo.j2ee.deployment.SwitchingModuleBuilder.addGBeans(Switchi
ngModuleBuilder.java:165)
  	at
org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARC
onfigBuilder.java:647)
  	at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:254)
  	at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:133)
  	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.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionM
ethodInvoker.java:34)
  	at
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:
124)
  	at
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:86
7)
  	at
org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
  	at
org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:342)
  	at sun.reflect.GeneratedMethodAccessor151.invoke(Unknown Source)
  	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
  	at java.lang.reflect.Method.invoke(Method.java:597)
  	at
org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionM
ethodInvoker.java:34)
  	at
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:
124)
  	at
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:86
7)
  	at
org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
  	at
org.apache.geronimo.system.jmx.MBeanGBeanBridge.invoke(MBeanGBeanBridge.java
:172)
  	at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanSer
verInterceptor.java:836)
  	at
com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
  	at
javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.
java:1426)
  	at
javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.j
ava:72)
  	at
javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMICon
nectionImpl.java:1264)
  	at java.security.AccessController.doPrivileged(Native Method)
  	at
javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConne
ctionImpl.java:1366)
  	at
javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:
788)
  	at sun.reflect.GeneratedMethodAccessor69.invoke(Unknown Source)
  	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
  	at java.lang.reflect.Method.invoke(Method.java:597)
  	at
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
  	at sun.rmi.transport.Transport$1.run(Transport.java:159)
  	at java.security.AccessController.doPrivileged(Native Method)
  	at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
  	at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
  	at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:
790)
  	at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:6
49)
  	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.ja
va:885)
  	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:9
07)
  	at java.lang.Thread.run(Thread.java:619)

No virus found in this outgoing message.
Checked by AVG. 
Version: 7.5.519 / Virus Database: 269.22.11/1368 - Release Date: 09/04/2008
4:20 PM
 


Re: problem JNDI lookup in geronimo

Posted by CG <le...@gmail.com>.
Thx Viet, it solved that problem.
I am facing another problem now , and I'll try to solve it myself
before coming back.

Thanks for all the guidance.

CG

On Thu, Apr 10, 2008 at 9:10 PM, Viet Nguyen <vh...@gmail.com> wrote:
> Your client probably does not have the geronimo-security jar in its
>  class path. Try adding
>
>  org/apache/geronimo/framework/geronimo-security//jar
>
>  to your classpath.
>
>  --Viet
>
>
>
>  On Thu, Apr 10, 2008 at 8:43 AM, CG <le...@gmail.com> wrote:
>  > Thx Nguyen. This solved the problem.
>  >
>  >  I am facing another problem now , which hv troubled me for 2 days and
>  >  could find solution on google.
>  >
>  >
>  >  It is still stuck at     context = new InitialContext(props);
>  >
>  >  The error is
>  >  Cannot read the response from the server.  The class for an object
>  >  being returned is not located in this system
>  >
>  >  I'm not sure which class is the refer to in the error , is it related
>  >  to the JNDI of the ejb ?
>  >
>  >
>  >  Koa
>  >
>  >
>  >  Full error
>  >  =======
>  >  javax.naming.AuthenticationException: Cannot read the response from
>  >  the server.  The class for an object being returned is not located in
>  >  this system:; nested exception is:
>  >         java.lang.ClassNotFoundException: org.apache.geronimo.security.SubjectId
>  >
>  >         at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
>  >         at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>  >         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>  >         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >         at javax.naming.InitialContext.init(InitialContext.java:223)
>  >
>  >         at javax.naming.InitialContext.<init>(InitialContext.java:197)
>  >         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:47)
>  >
>  > Exception in thread "main" java.lang.RuntimeException:
>  >  javax.naming.AuthenticationException: Cannot read the response from
>  >  the server.  The class for an object being returned is not located in
>  >  this system:; nested exception is:
>  >         java.lang.ClassNotFoundException: org.apache.geronimo.security.SubjectId
>  >         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:58)
>  >  Caused by: javax.naming.AuthenticationException: Cannot read the
>  >  response from the server.  The class for an object being returned is
>  >  not located in this system:; nested exception is:
>  >         java.lang.ClassNotFoundException: org.apache.geronimo.security.SubjectId
>  >
>  >         at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
>  >         at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>  >         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>  >         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >         at javax.naming.InitialContext.init(InitialContext.java:223)
>  >
>  >         at javax.naming.InitialContext.<init>(InitialContext.java:197)
>  >         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:47)
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >
>  >  On Wed, Apr 9, 2008 at 12:37 AM, Viet Nguyen <vh...@gmail.com> wrote:
>  >  > You also need to specify the security realm in which you want to
>  >  >  authenticate against. Try adding this to your props
>  >  >
>  >  >                 props.setProperty("openejb.authentication.realmName",
>  >  >  "geronimo-admin");
>  >  >
>  >  >  Regards,
>  >  >  Viet
>  >  >
>  >  >
>  >  >
>  >  >  On Tue, Apr 8, 2008 at 11:38 AM, CG <le...@gmail.com> wrote:
>  >  >  > hi, thanks for the feedback.
>  >  >  >
>  >  >  >  I have tried to settle the new problem but no luck , it is out of my ability.
>  >  >  >  I can confirm the user and password works.
>  >  >  >
>  >  >  >  But the error msg seems like telling me that authentication failed ..
>  >  >  >
>  >  >  >  Any hints will be appreciated .. thx.
>  >  >  >
>  >  >  >  CG
>  >  >  >
>  >  >  >  <my code>
>  >  >  >  // initially has no this part , manually added to isolate the possible
>  >  >  >  problem of properties file
>  >  >  >             Properties props = new Properties();
>  >  >  >  props.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.openejb.client.RemoteInitialContextFactory");
>  >  >  >             props.put(Context.PROVIDER_URL,"ejbd://127.0.0.1:4201");
>  >  >  >             props.setProperty(Context.SECURITY_PRINCIPAL, "system");
>  >  >  >             props.setProperty(Context.SECURITY_CREDENTIALS, "manager");
>  >  >  >   // end
>  >  >  >                          context = new InitialContext(props);    <--- problem at this line
>  >  >  >
>  >  >  >  < end my code>
>  >  >  >
>  >  >  >  Error message
>  >  >  >  ==============
>  >  >  >  javax.naming.AuthenticationException: This principle is not
>  >  >  >  authorized. [Root exception is
>  >  >  >  javax.security.auth.login.LoginException: Invalid null input: name]
>  >  >  >         at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:162)
>  >  >  >
>  >  >  >         at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>  >  >  >         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>  >  >  >         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >  >  >         at javax.naming.InitialContext.init(InitialContext.java:223)
>  >  >  >         at javax.naming.InitialContext.<init>(InitialContext.java:197)
>  >  >  >         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:46)
>  >  >  >  Caused by: javax.security.auth.login.LoginException: Invalid null input: name
>  >  >  >         at javax.security.auth.login.LoginContext.init(LoginContext.java:229)
>  >  >  >         at javax.security.auth.login.LoginContext.<init>(LoginContext.java:367)
>  >  >  >         at javax.security.auth.login.LoginContext.<init>(LoginContext.java:444)
>  >  >  >         at org.apache.geronimo.security.ContextManager.login(ContextManager.java:74)
>  >  >  >         at org.apache.geronimo.openejb.GeronimoSecurityService.login(GeronimoSecurityService.java:52)
>  >  >  >         at org.apache.openejb.server.ejbd.AuthRequestHandler.processRequest(AuthRequestHandler.java:56)
>  >  >  >         at org.apache.openejb.server.ejbd.EjbDaemon.processAuthRequest(EjbDaemon.java:172)
>  >  >  >         at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:130)
>  >  >  >         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)
>  >  >  >
>  >  >  > Exception in thread "main" java.lang.RuntimeException:
>  >  >  >  javax.naming.AuthenticationException: This principle is not
>  >  >  >  authorized. [Root exception is
>  >  >  >  javax.security.auth.login.LoginException: Invalid null input: name]
>  >  >  >         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:57)
>  >  >  >  Caused by: javax.naming.AuthenticationException: This principle is not
>  >  >  >  authorized. [Root exception is
>  >  >  >  javax.security.auth.login.LoginException: Invalid null input: name]
>  >  >  >         at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:162)
>  >  >  >
>  >  >  >         at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>  >  >  >         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>  >  >  >         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >  >  >         at javax.naming.InitialContext.init(InitialContext.java:223)
>  >  >  >         at javax.naming.InitialContext.<init>(InitialContext.java:197)
>  >  >  >         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:46)
>  >  >  >  Caused by: javax.security.auth.login.LoginException: Invalid null input: name
>  >  >  >         at javax.security.auth.login.LoginContext.init(LoginContext.java:229)
>  >  >  >         at javax.security.auth.login.LoginContext.<init>(LoginContext.java:367)
>  >  >  >         at javax.security.auth.login.LoginContext.<init>(LoginContext.java:444)
>  >  >  >         at org.apache.geronimo.security.ContextManager.login(ContextManager.java:74)
>  >  >  >         at org.apache.geronimo.openejb.GeronimoSecurityService.login(GeronimoSecurityService.java:52)
>  >  >  >         at org.apache.openejb.server.ejbd.AuthRequestHandler.processRequest(AuthRequestHandler.java:56)
>  >  >  >         at org.apache.openejb.server.ejbd.EjbDaemon.processAuthRequest(EjbDaemon.java:172)
>  >  >  >         at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:130)
>  >  >  >         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)
>  >  >  >
>  >  >  >
>  >  >  >  Geronimo log
>  >  >  >  ===========
>  >  >  >  84387:  23:50:31,778 DEBUG [auth] AUTH REQUEST: null:system --
>  >  >  >  RESPONSE: AUTH_DENIED:javax.security.auth.login.LoginException:
>  >  >  >  Invalid null input: name
>  >  >  >  84388:  23:50:38,941 DEBUG [CoyoteAdapter] Requested cookie session id
>  >  >  >  is 27D8EC25DC047479A6FB368DDB730876
>  >  >  >  84389:  23:50:38,941 DEBUG [AuthenticatorBase] Security checking
>  >  >  >  request GET /console/portal//Server/Server%20Logs/__ac0x3console-base0x2LogViewer!1535651776|1
>  >  >  >  84390:  23:50:38,941 DEBUG [AuthenticatorBase] We have cached auth
>  >  >  >  type FORM for principal
>  >  >  >  org.apache.geronimo.tomcat.JAASTomcatPrincipal@194a7fb
>  >  >  >  84391:  23:50:38,941 DEBUG [AuthenticatorBase] Calling hasUserDataPermission()
>  >  >  >  84392:  23:50:38,941 DEBUG [AuthenticatorBase] Calling authenticate()
>  >  >  >  84393:  23:50:38,941 DEBUG [FormAuthenticator] Already authenticated 'system'
>  >  >  >  84394:  23:50:38,941 DEBUG [AuthenticatorBase] Calling accessControl()
>  >  >  >  84395:  23:50:38,941 DEBUG [AuthenticatorBase] Successfully passed all
>  >  >  >  security constraints
>  >  >  >  84396:  23:50:38,941 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  >  84397:  23:50:38,942 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  >  84398:  23:50:38,945 DEBUG [CoyoteAdapter] Requested cookie session id
>  >  >  >  is 27D8EC25DC047479A6FB368DDB730876
>  >  >  >  84399:  23:50:38,945 DEBUG [AuthenticatorBase] Security checking
>  >  >  >  request GET /console/portal//Server/Server%20Logs/__rp0x3console-base0x2LogViewer!1535651776|1_logFile/0x3home0x3super0x3bin0x3geronimo-tomcat6-javaee5-20x210x3var0x3log0x3geronimo0x2log/__rp0x3console-base0x2LogViewer!1535651776|1_action/search/__rp0x3console-base0x2LogViewer!1535651776|1_logLevel/TRACE/__rp0x3console-base0x2LogViewer!1535651776|1_maxRows/50
>  >  >  >  84400:  23:50:38,945 DEBUG [AuthenticatorBase] We have cached auth
>  >  >  >  type FORM for principal
>  >  >  >  org.apache.geronimo.tomcat.JAASTomcatPrincipal@194a7fb
>  >  >  >  84401:  23:50:38,945 DEBUG [AuthenticatorBase] Calling hasUserDataPermission()
>  >  >  >  84402:  23:50:38,945 DEBUG [AuthenticatorBase] Calling authenticate()
>  >  >  >  84403:  23:50:38,945 DEBUG [FormAuthenticator] Already authenticated 'system'
>  >  >  >  84404:  23:50:38,946 DEBUG [AuthenticatorBase] Calling accessControl()
>  >  >  >  84405:  23:50:38,946 DEBUG [AuthenticatorBase] Successfully passed all
>  >  >  >  security constraints
>  >  >  >  84406:  23:50:38,946 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  >  84407:  23:50:38,946 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  >  84408:  23:50:38,947 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  >  84409:  23:50:39,129 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  >  84410:  23:50:39,130 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  >  84411:  23:50:39,131 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  >  84412:  23:50:39,132 INFO [SupportedModesServiceImpl] Portlet mode
>  >  >  >  'edit' not found for portletId:
>  >  >  >  '/console-base.LogManager!1535651776|0'
>  >  >  >  84413:  23:50:39,140 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  >  84414:  23:50:39,146 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >  >  On Tue, Apr 8, 2008 at 3:25 AM, David Blevins <da...@visi.com> wrote:
>  >  >  >  >
>  >  >  >  >  On Apr 7, 2008, at 8:36 AM, CG wrote:
>  >  >  >  >
>  >  >  >  > > Hi all,
>  >  >  >  > > After googling again,  I have solved the problem by changing the
>  >  >  >  > > jndi.properties , localhost:4201 to 127.0.0.1:4201.
>  >  >  >  > >
>  >  >  >  >
>  >  >  >  >  You can use "localhost" as a host, you just need to add
>  >  >  >  > "ejbd://localhost:4201" due to the way URIs are parsed.  In the openejb 3.0
>  >  >  >  > final up for a vote now, we check your provider url string a bit more before
>  >  >  >  > giving it to java.net.URI and make corrections.
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >
>  >  >  >  > > After solving that , another problem coming up , I still need time to
>  >  >  >  > > do more searching.
>  >  >  >  > >
>  >  >  >  >
>  >  >  >  >  Happy to help when you get the details.
>  >  >  >  >
>  >  >  >  >  -David
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >
>  >  >  >  >
>  >  >  >  > >
>  >  >  >  > >
>  >  >  >  > > CG
>  >  >  >  > >
>  >  >  >  > > On Mon, Apr 7, 2008 at 9:29 PM, CG <le...@gmail.com> wrote:
>  >  >  >  > >
>  >  >  >  > > > Forget to attach the error message in the previous mail, here it is.
>  >  >  >  > > >
>  >  >  >  > > > Error
>  >  >  >  > > > ====
>  >  >  >  > > > javax.naming.AuthenticationException: Cannot connect to server
>  >  >  >  > > > 'localhost:4201"; nested exception is:
>  >  >  >  > > >       java.io.IOException: Cannot  connect to server: 'localhost:4201'
>  >  >  >  > due
>  >  >  >  > > > to an unkown exception in the OpenEJB client:
>  >  >  >  > > > java.lang.IllegalArgumentException : port out of range:-1
>  >  >  >  > > >       at
>  >  >  >  > org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
>  >  >  >  > > >       at
>  >  >  >  > org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>  >  >  >  > > >       at
>  >  >  >  > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>  >  >  >  > > >
>  >  >  >  > > >       at
>  >  >  >  > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >  >  >  > > >       at javax.naming.InitialContext.init(InitialContext.java:223)
>  >  >  >  > > >       at javax.naming.InitialContext.<init>(InitialContext.java:175)
>  >  >  >  > > >       at
>  >  >  >  > test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
>  >  >  >  > > > Exception in thread "main" java.lang.RuntimeException:
>  >  >  >  > > > javax.naming.AuthenticationException: Cannot connect to server
>  >  >  >  > > > 'localhost:4201"; nested exception is:
>  >  >  >  > > >       java.io.IOException: Cannot  connect to server: 'localhost:4201'
>  >  >  >  > due
>  >  >  >  > > > to an unkown exception in the OpenEJB client:
>  >  >  >  > > > java.lang.IllegalArgumentException : port out of range:-1
>  >  >  >  > > >       at
>  >  >  >  > test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:50)
>  >  >  >  > > > Caused by: javax.naming.AuthenticationException: Cannot connect to
>  >  >  >  > > > server 'localhost:4201"; nested exception is:
>  >  >  >  > > >       java.io.IOException: Cannot  connect to server: 'localhost:4201'
>  >  >  >  > due
>  >  >  >  > > > to an unkown exception in the OpenEJB client:
>  >  >  >  > > > java.lang.IllegalArgumentException : port out of range:-1
>  >  >  >  > > >       at
>  >  >  >  > org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
>  >  >  >  > > >       at
>  >  >  >  > org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>  >  >  >  > > >       at
>  >  >  >  > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>  >  >  >  > > >
>  >  >  >  > > >       at
>  >  >  >  > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >  >  >  > > >       at javax.naming.InitialContext.init(InitialContext.java:223)
>  >  >  >  > > >       at javax.naming.InitialContext.<init>(InitialContext.java:175)
>  >  >  >  > > >       at
>  >  >  >  > test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
>  >  >  >  > > >
>  >  >  >  > > >
>  >  >  >  > > >
>  >  >  >  > > >
>  >  >  >  > > >
>  >  >  >  > > >
>  >  >  >  > > > On Mon, Apr 7, 2008 at 9:19 PM, CG <le...@gmail.com> wrote:
>  >  >  >  > > >
>  >  >  >  > > > > Hi all,
>  >  >  >  > > > > I have managed to add the appropriate library but encounter another
>  >  >  >  > problem.
>  >  >  >  > > > >
>  >  >  >  > > > > It seems like port 4201 does not have the JNDI provider service
>  >  >  >  > running.
>  >  >  >  > > > >
>  >  >  >  > > > > May I know whether geronimo built-in with JNDI provider service or
>  >  >  >  > not?
>  >  >  >  > > > > I noticed that there is LDAP service (which can be a JNDI provider
>  >  >  >  > > > > service to my understanding)running at port 1389  , and I tried to
>  >  >  >  > > > > change the jndi.properties to connect to port 1389 instead , however,
>  >  >  >  > > > > no luck , error still persist.
>  >  >  >  > > > >
>  >  >  >  > > > > any idea ?
>  >  >  >  > > > >
>  >  >  >  > > > > Thanks in advanced.
>  >  >  >  > > > >
>  >  >  >  > > > > CG
>  >  >  >  > > > >
>  >  >  >  > > > >
>  >  >  >  > > > >
>  >  >  >  > > > >
>  >  >  >  > > > > On Mon, Apr 7, 2008 at 7:56 PM, CG <le...@gmail.com> wrote:
>  >  >  >  > > > >
>  >  >  >  > > > > > thanks david.
>  >  >  >  > > > > >
>  >  >  >  > > > > > I just wonder how do I add those libraries in the classpath in
>  >  >  >  > eclipse
>  >  >  >  > > > > > ? Is it going to Build path > add external jar ?
>  >  >  >  > > > > >
>  >  >  >  > > > > > Isn't the GEP have added those thing automatically ?
>  >  >  >  > > > > >
>  >  >  >  > > > > > thanks for your patient  to guide a newbie of Java & eclipse.
>  >  >  >  > > > > >
>  >  >  >  > > > > >
>  >  >  >  > > > > >
>  >  >  >  > > > > >
>  >  >  >  > > > > > On Sun, Apr 6, 2008 at 11:21 PM, David Jencks
>  >  >  >  > <da...@yahoo.com> wrote:
>  >  >  >  > > > > >
>  >  >  >  > > > > > > The library you need in your client classpath is at
>  >  >  >  > > > > > >
>  >  >  >  > > > > > >
>  >  >  >  > repository/org/apache/openejb/openejb-client/*/openejb-client-*.jar
>  >  >  >  > > > > > >
>  >  >  >  > > > > > > thanks
>  >  >  >  > > > > > > david jencks
>  >  >  >  > > > > > >
>  >  >  >  > > > > > >
>  >  >  >  > > > > > >
>  >  >  >  > > > > > > On Apr 6, 2008, at 7:53 AM, CG wrote:
>  >  >  >  > > > > > >
>  >  >  >  > > > > > >
>  >  >  >  > > > > > >
>  >  >  >  > > > > > > > Hi, I am facing problem in using JNDI to do lookup. I have tried
>  >  >  >  > to
>  >  >  >  > > > > > > > solve several problem using google before hitting this
>  >  >  >  > > > > > > >
>  >  >  >  > > > > > > > I have materialType.properties and jndi.properties file deployed
>  >  >  >  > in
>  >  >  >  > > > > > > >
>  >  >  >  > > > > > > geronimo
>  >  >  >  > > > > > >
>  >  >  >  > > > > > > >
>  >  >  >  > > > > > > > materialType.properties
>  >  >  >  > > > > > > > ================
>  >  >  >  > > > > > > > jndi.process.ejb = java:comp/env/ejb/MaterialTestBean
>  >  >  >  > > > > > > >
>  >  >  >  > > > > > > > jndi.properties
>  >  >  >  > > > > > > > ============
>  >  >  >  > > > > > > >
>  >  >  >  > java.naming.factory.initial=org.openejb.client.RemoteInitialContextFactory
>  >  >  >  > > > > > > > java.naming.provider.url=localhost:4201
>  >  >  >  > > > > > > > java.naming.security.principal=system
>  >  >  >  > > > > > > > java.naming.security.credentials=manager
>  >  >  >  > > > > > > >
>  >  >  >  > > > > > > >
>  >  >  >  > > > > > > > The problem I face seems like not able to find the class
>  >  >  >  > > > > > > > org.openejb.client.RemoteInitialContextFactory .
>  >  >  >  > > > > > > > I think the reason should be openejb library missing or invalid
>  >  >  >  > but I
>  >  >  >  > > > > > > > can't figure out where the openejb library in geronimo ..
>  >  >  >  > > > > > > > Any help is appreciated , thanks.
>  >  >  >  > > > > > > >
>  >  >  >  > > > > > > >
>  >  >  >  > > > > > > >
>  >  >  >  > > > > > > > Error msg
>  >  >  >  > > > > > > > =========
>  >  >  >  > > > > > > >
>  >  >  >  > > > > > > > javax.naming.NoInitialContextException: Cannot instantiate
>  >  >  >  > class:
>  >  >  >  > > > > > > > org.openejb.client.RemoteInitialContextFactory [Root exception
>  >  >  >  > is
>  >  >  >  > > > > > > > java.lang.ClassNotFoundException:
>  >  >  >  > > > > > > > org.openejb.client.RemoteInitialContextFactory]
>  >  >  >  > > > > > > >      at
>  >  >  >  > > > > > > >
>  >  >  >  > > > > > >
>  >  >  >  > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
>  >  >  >  > > > > > >
>  >  >  >  > > > > > > >      at
>  >  >  >  > > > > > > >
>  >  >  >  > > > > > >
>  >  >  >  > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >  >  >  > > > > > >
>  >  >  >  > > > > > > >      at
>  >  >  >  > javax.naming.InitialContext.init(InitialContext.java:223)
>  >  >  >  > > > > > > >      at
>  >  >  >  > javax.naming.InitialContext.<init>(InitialContext.java:175)
>  >  >  >  > > > > > > >      at
>  >  >  >  > > > > > > >
>  >  >  >  > > > > > >
>  >  >  >  > test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
>  >  >  >  > > > > > >
>  >  >  >  > > > > > > > Caused by: java.lang.ClassNotFoundException:
>  >  >  >  > > > > > > > org.openejb.client.RemoteInitialContextFactory
>  >  >  >  > > > > > > >
>  >  >  >  > > > > > > >
>  >  >  >  > > > > > > >
>  >  >  >  > > > > > > > <more codes>
>  >  >  >  > > > > > > > ::
>  >  >  >  > > > > > > >              InitialContext context;
>  >  >  >  > > > > > > >              MaterialTestBeanRemote beanRemote = null;
>  >  >  >  > > > > > > >              ResourceBundle      bundle = null;
>  >  >  >  > > > > > > >
>  >  >  >  > > > > > > >            bundle = ResourceBundle.getBundle("materialType",
>  >  >  >  > > > > > > > Locale.getDefault(),
>  >  >  >  > FirstEJB3TutorialClient.class.getClassLoader());
>  >  >  >  > > > > > > >            String jndiName =
>  >  >  >  > bundle.getString("jndi.process.ejb");
>  >  >  >  > > > > > > >              try
>  >  >  >  > > > > > > >              {
>  >  >  >  > > > > > > >                       context = new InitialContext();
>  >  >  >  > > > > > > >                       beanRemote = (MaterialTestBeanRemote)
>  >  >  >  > > > > > > > context.lookup(MaterialTestBean.RemoteJNDIName);
>  >  >  >  > > > > > > >                       beanRemote.testMaterial();
>  >  >  >  > > > > > > >                       beanRemote.testMaterialType();
>  >  >  >  > > > > > > >             }
>  >  >  >  > > > > > > >
>  >  >  >  > > > > > > > <more codes>
>  >  >  >  > > > > > > >
>  >  >  >  > > > > > > >
>  >  >  >  > > > > > >
>  >  >  >  > > > > > >
>  >  >  >  > > > > > >
>  >  >  >  > > > > >
>  >  >  >  > > > > >
>  >  >  >  > > > >
>  >  >  >  > > > >
>  >  >  >  > > >
>  >  >  >  > > >
>  >  >  >  > >
>  >  >  >  > >
>  >  >  >  >
>  >  >  >  >
>  >  >  >
>  >  >
>  >
>

Re: problem JNDI lookup in geronimo

Posted by Viet Nguyen <vh...@gmail.com>.
Your client probably does not have the geronimo-security jar in its
class path. Try adding

org/apache/geronimo/framework/geronimo-security//jar

to your classpath.

--Viet

On Thu, Apr 10, 2008 at 8:43 AM, CG <le...@gmail.com> wrote:
> Thx Nguyen. This solved the problem.
>
>  I am facing another problem now , which hv troubled me for 2 days and
>  could find solution on google.
>
>
>  It is still stuck at     context = new InitialContext(props);
>
>  The error is
>  Cannot read the response from the server.  The class for an object
>  being returned is not located in this system
>
>  I'm not sure which class is the refer to in the error , is it related
>  to the JNDI of the ejb ?
>
>
>  Koa
>
>
>  Full error
>  =======
>  javax.naming.AuthenticationException: Cannot read the response from
>  the server.  The class for an object being returned is not located in
>  this system:; nested exception is:
>         java.lang.ClassNotFoundException: org.apache.geronimo.security.SubjectId
>
>         at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
>         at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>         at javax.naming.InitialContext.init(InitialContext.java:223)
>
>         at javax.naming.InitialContext.<init>(InitialContext.java:197)
>         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:47)
>
> Exception in thread "main" java.lang.RuntimeException:
>  javax.naming.AuthenticationException: Cannot read the response from
>  the server.  The class for an object being returned is not located in
>  this system:; nested exception is:
>         java.lang.ClassNotFoundException: org.apache.geronimo.security.SubjectId
>         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:58)
>  Caused by: javax.naming.AuthenticationException: Cannot read the
>  response from the server.  The class for an object being returned is
>  not located in this system:; nested exception is:
>         java.lang.ClassNotFoundException: org.apache.geronimo.security.SubjectId
>
>         at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
>         at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>         at javax.naming.InitialContext.init(InitialContext.java:223)
>
>         at javax.naming.InitialContext.<init>(InitialContext.java:197)
>         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:47)
>
>
>
>
>
>
>
>
>
>
>  On Wed, Apr 9, 2008 at 12:37 AM, Viet Nguyen <vh...@gmail.com> wrote:
>  > You also need to specify the security realm in which you want to
>  >  authenticate against. Try adding this to your props
>  >
>  >                 props.setProperty("openejb.authentication.realmName",
>  >  "geronimo-admin");
>  >
>  >  Regards,
>  >  Viet
>  >
>  >
>  >
>  >  On Tue, Apr 8, 2008 at 11:38 AM, CG <le...@gmail.com> wrote:
>  >  > hi, thanks for the feedback.
>  >  >
>  >  >  I have tried to settle the new problem but no luck , it is out of my ability.
>  >  >  I can confirm the user and password works.
>  >  >
>  >  >  But the error msg seems like telling me that authentication failed ..
>  >  >
>  >  >  Any hints will be appreciated .. thx.
>  >  >
>  >  >  CG
>  >  >
>  >  >  <my code>
>  >  >  // initially has no this part , manually added to isolate the possible
>  >  >  problem of properties file
>  >  >             Properties props = new Properties();
>  >  >  props.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.openejb.client.RemoteInitialContextFactory");
>  >  >             props.put(Context.PROVIDER_URL,"ejbd://127.0.0.1:4201");
>  >  >             props.setProperty(Context.SECURITY_PRINCIPAL, "system");
>  >  >             props.setProperty(Context.SECURITY_CREDENTIALS, "manager");
>  >  >   // end
>  >  >                          context = new InitialContext(props);    <--- problem at this line
>  >  >
>  >  >  < end my code>
>  >  >
>  >  >  Error message
>  >  >  ==============
>  >  >  javax.naming.AuthenticationException: This principle is not
>  >  >  authorized. [Root exception is
>  >  >  javax.security.auth.login.LoginException: Invalid null input: name]
>  >  >         at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:162)
>  >  >
>  >  >         at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>  >  >         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>  >  >         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >  >         at javax.naming.InitialContext.init(InitialContext.java:223)
>  >  >         at javax.naming.InitialContext.<init>(InitialContext.java:197)
>  >  >         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:46)
>  >  >  Caused by: javax.security.auth.login.LoginException: Invalid null input: name
>  >  >         at javax.security.auth.login.LoginContext.init(LoginContext.java:229)
>  >  >         at javax.security.auth.login.LoginContext.<init>(LoginContext.java:367)
>  >  >         at javax.security.auth.login.LoginContext.<init>(LoginContext.java:444)
>  >  >         at org.apache.geronimo.security.ContextManager.login(ContextManager.java:74)
>  >  >         at org.apache.geronimo.openejb.GeronimoSecurityService.login(GeronimoSecurityService.java:52)
>  >  >         at org.apache.openejb.server.ejbd.AuthRequestHandler.processRequest(AuthRequestHandler.java:56)
>  >  >         at org.apache.openejb.server.ejbd.EjbDaemon.processAuthRequest(EjbDaemon.java:172)
>  >  >         at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:130)
>  >  >         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)
>  >  >
>  >  > Exception in thread "main" java.lang.RuntimeException:
>  >  >  javax.naming.AuthenticationException: This principle is not
>  >  >  authorized. [Root exception is
>  >  >  javax.security.auth.login.LoginException: Invalid null input: name]
>  >  >         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:57)
>  >  >  Caused by: javax.naming.AuthenticationException: This principle is not
>  >  >  authorized. [Root exception is
>  >  >  javax.security.auth.login.LoginException: Invalid null input: name]
>  >  >         at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:162)
>  >  >
>  >  >         at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>  >  >         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>  >  >         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >  >         at javax.naming.InitialContext.init(InitialContext.java:223)
>  >  >         at javax.naming.InitialContext.<init>(InitialContext.java:197)
>  >  >         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:46)
>  >  >  Caused by: javax.security.auth.login.LoginException: Invalid null input: name
>  >  >         at javax.security.auth.login.LoginContext.init(LoginContext.java:229)
>  >  >         at javax.security.auth.login.LoginContext.<init>(LoginContext.java:367)
>  >  >         at javax.security.auth.login.LoginContext.<init>(LoginContext.java:444)
>  >  >         at org.apache.geronimo.security.ContextManager.login(ContextManager.java:74)
>  >  >         at org.apache.geronimo.openejb.GeronimoSecurityService.login(GeronimoSecurityService.java:52)
>  >  >         at org.apache.openejb.server.ejbd.AuthRequestHandler.processRequest(AuthRequestHandler.java:56)
>  >  >         at org.apache.openejb.server.ejbd.EjbDaemon.processAuthRequest(EjbDaemon.java:172)
>  >  >         at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:130)
>  >  >         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)
>  >  >
>  >  >
>  >  >  Geronimo log
>  >  >  ===========
>  >  >  84387:  23:50:31,778 DEBUG [auth] AUTH REQUEST: null:system --
>  >  >  RESPONSE: AUTH_DENIED:javax.security.auth.login.LoginException:
>  >  >  Invalid null input: name
>  >  >  84388:  23:50:38,941 DEBUG [CoyoteAdapter] Requested cookie session id
>  >  >  is 27D8EC25DC047479A6FB368DDB730876
>  >  >  84389:  23:50:38,941 DEBUG [AuthenticatorBase] Security checking
>  >  >  request GET /console/portal//Server/Server%20Logs/__ac0x3console-base0x2LogViewer!1535651776|1
>  >  >  84390:  23:50:38,941 DEBUG [AuthenticatorBase] We have cached auth
>  >  >  type FORM for principal
>  >  >  org.apache.geronimo.tomcat.JAASTomcatPrincipal@194a7fb
>  >  >  84391:  23:50:38,941 DEBUG [AuthenticatorBase] Calling hasUserDataPermission()
>  >  >  84392:  23:50:38,941 DEBUG [AuthenticatorBase] Calling authenticate()
>  >  >  84393:  23:50:38,941 DEBUG [FormAuthenticator] Already authenticated 'system'
>  >  >  84394:  23:50:38,941 DEBUG [AuthenticatorBase] Calling accessControl()
>  >  >  84395:  23:50:38,941 DEBUG [AuthenticatorBase] Successfully passed all
>  >  >  security constraints
>  >  >  84396:  23:50:38,941 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  84397:  23:50:38,942 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  84398:  23:50:38,945 DEBUG [CoyoteAdapter] Requested cookie session id
>  >  >  is 27D8EC25DC047479A6FB368DDB730876
>  >  >  84399:  23:50:38,945 DEBUG [AuthenticatorBase] Security checking
>  >  >  request GET /console/portal//Server/Server%20Logs/__rp0x3console-base0x2LogViewer!1535651776|1_logFile/0x3home0x3super0x3bin0x3geronimo-tomcat6-javaee5-20x210x3var0x3log0x3geronimo0x2log/__rp0x3console-base0x2LogViewer!1535651776|1_action/search/__rp0x3console-base0x2LogViewer!1535651776|1_logLevel/TRACE/__rp0x3console-base0x2LogViewer!1535651776|1_maxRows/50
>  >  >  84400:  23:50:38,945 DEBUG [AuthenticatorBase] We have cached auth
>  >  >  type FORM for principal
>  >  >  org.apache.geronimo.tomcat.JAASTomcatPrincipal@194a7fb
>  >  >  84401:  23:50:38,945 DEBUG [AuthenticatorBase] Calling hasUserDataPermission()
>  >  >  84402:  23:50:38,945 DEBUG [AuthenticatorBase] Calling authenticate()
>  >  >  84403:  23:50:38,945 DEBUG [FormAuthenticator] Already authenticated 'system'
>  >  >  84404:  23:50:38,946 DEBUG [AuthenticatorBase] Calling accessControl()
>  >  >  84405:  23:50:38,946 DEBUG [AuthenticatorBase] Successfully passed all
>  >  >  security constraints
>  >  >  84406:  23:50:38,946 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  84407:  23:50:38,946 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  84408:  23:50:38,947 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  84409:  23:50:39,129 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  84410:  23:50:39,130 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  84411:  23:50:39,131 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  84412:  23:50:39,132 INFO [SupportedModesServiceImpl] Portlet mode
>  >  >  'edit' not found for portletId:
>  >  >  '/console-base.LogManager!1535651776|0'
>  >  >  84413:  23:50:39,140 TRACE [StandardWrapper] Returning non-STM instance
>  >  >  84414:  23:50:39,146 TRACE [StandardWrapper] Returning non-STM instance
>  >  >
>  >  >
>  >  >
>  >  >
>  >  >
>  >  >
>  >  >  On Tue, Apr 8, 2008 at 3:25 AM, David Blevins <da...@visi.com> wrote:
>  >  >  >
>  >  >  >  On Apr 7, 2008, at 8:36 AM, CG wrote:
>  >  >  >
>  >  >  > > Hi all,
>  >  >  > > After googling again,  I have solved the problem by changing the
>  >  >  > > jndi.properties , localhost:4201 to 127.0.0.1:4201.
>  >  >  > >
>  >  >  >
>  >  >  >  You can use "localhost" as a host, you just need to add
>  >  >  > "ejbd://localhost:4201" due to the way URIs are parsed.  In the openejb 3.0
>  >  >  > final up for a vote now, we check your provider url string a bit more before
>  >  >  > giving it to java.net.URI and make corrections.
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >  > > After solving that , another problem coming up , I still need time to
>  >  >  > > do more searching.
>  >  >  > >
>  >  >  >
>  >  >  >  Happy to help when you get the details.
>  >  >  >
>  >  >  >  -David
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >  > >
>  >  >  > >
>  >  >  > > CG
>  >  >  > >
>  >  >  > > On Mon, Apr 7, 2008 at 9:29 PM, CG <le...@gmail.com> wrote:
>  >  >  > >
>  >  >  > > > Forget to attach the error message in the previous mail, here it is.
>  >  >  > > >
>  >  >  > > > Error
>  >  >  > > > ====
>  >  >  > > > javax.naming.AuthenticationException: Cannot connect to server
>  >  >  > > > 'localhost:4201"; nested exception is:
>  >  >  > > >       java.io.IOException: Cannot  connect to server: 'localhost:4201'
>  >  >  > due
>  >  >  > > > to an unkown exception in the OpenEJB client:
>  >  >  > > > java.lang.IllegalArgumentException : port out of range:-1
>  >  >  > > >       at
>  >  >  > org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
>  >  >  > > >       at
>  >  >  > org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>  >  >  > > >       at
>  >  >  > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>  >  >  > > >
>  >  >  > > >       at
>  >  >  > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >  >  > > >       at javax.naming.InitialContext.init(InitialContext.java:223)
>  >  >  > > >       at javax.naming.InitialContext.<init>(InitialContext.java:175)
>  >  >  > > >       at
>  >  >  > test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
>  >  >  > > > Exception in thread "main" java.lang.RuntimeException:
>  >  >  > > > javax.naming.AuthenticationException: Cannot connect to server
>  >  >  > > > 'localhost:4201"; nested exception is:
>  >  >  > > >       java.io.IOException: Cannot  connect to server: 'localhost:4201'
>  >  >  > due
>  >  >  > > > to an unkown exception in the OpenEJB client:
>  >  >  > > > java.lang.IllegalArgumentException : port out of range:-1
>  >  >  > > >       at
>  >  >  > test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:50)
>  >  >  > > > Caused by: javax.naming.AuthenticationException: Cannot connect to
>  >  >  > > > server 'localhost:4201"; nested exception is:
>  >  >  > > >       java.io.IOException: Cannot  connect to server: 'localhost:4201'
>  >  >  > due
>  >  >  > > > to an unkown exception in the OpenEJB client:
>  >  >  > > > java.lang.IllegalArgumentException : port out of range:-1
>  >  >  > > >       at
>  >  >  > org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
>  >  >  > > >       at
>  >  >  > org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>  >  >  > > >       at
>  >  >  > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>  >  >  > > >
>  >  >  > > >       at
>  >  >  > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >  >  > > >       at javax.naming.InitialContext.init(InitialContext.java:223)
>  >  >  > > >       at javax.naming.InitialContext.<init>(InitialContext.java:175)
>  >  >  > > >       at
>  >  >  > test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
>  >  >  > > >
>  >  >  > > >
>  >  >  > > >
>  >  >  > > >
>  >  >  > > >
>  >  >  > > >
>  >  >  > > > On Mon, Apr 7, 2008 at 9:19 PM, CG <le...@gmail.com> wrote:
>  >  >  > > >
>  >  >  > > > > Hi all,
>  >  >  > > > > I have managed to add the appropriate library but encounter another
>  >  >  > problem.
>  >  >  > > > >
>  >  >  > > > > It seems like port 4201 does not have the JNDI provider service
>  >  >  > running.
>  >  >  > > > >
>  >  >  > > > > May I know whether geronimo built-in with JNDI provider service or
>  >  >  > not?
>  >  >  > > > > I noticed that there is LDAP service (which can be a JNDI provider
>  >  >  > > > > service to my understanding)running at port 1389  , and I tried to
>  >  >  > > > > change the jndi.properties to connect to port 1389 instead , however,
>  >  >  > > > > no luck , error still persist.
>  >  >  > > > >
>  >  >  > > > > any idea ?
>  >  >  > > > >
>  >  >  > > > > Thanks in advanced.
>  >  >  > > > >
>  >  >  > > > > CG
>  >  >  > > > >
>  >  >  > > > >
>  >  >  > > > >
>  >  >  > > > >
>  >  >  > > > > On Mon, Apr 7, 2008 at 7:56 PM, CG <le...@gmail.com> wrote:
>  >  >  > > > >
>  >  >  > > > > > thanks david.
>  >  >  > > > > >
>  >  >  > > > > > I just wonder how do I add those libraries in the classpath in
>  >  >  > eclipse
>  >  >  > > > > > ? Is it going to Build path > add external jar ?
>  >  >  > > > > >
>  >  >  > > > > > Isn't the GEP have added those thing automatically ?
>  >  >  > > > > >
>  >  >  > > > > > thanks for your patient  to guide a newbie of Java & eclipse.
>  >  >  > > > > >
>  >  >  > > > > >
>  >  >  > > > > >
>  >  >  > > > > >
>  >  >  > > > > > On Sun, Apr 6, 2008 at 11:21 PM, David Jencks
>  >  >  > <da...@yahoo.com> wrote:
>  >  >  > > > > >
>  >  >  > > > > > > The library you need in your client classpath is at
>  >  >  > > > > > >
>  >  >  > > > > > >
>  >  >  > repository/org/apache/openejb/openejb-client/*/openejb-client-*.jar
>  >  >  > > > > > >
>  >  >  > > > > > > thanks
>  >  >  > > > > > > david jencks
>  >  >  > > > > > >
>  >  >  > > > > > >
>  >  >  > > > > > >
>  >  >  > > > > > > On Apr 6, 2008, at 7:53 AM, CG wrote:
>  >  >  > > > > > >
>  >  >  > > > > > >
>  >  >  > > > > > >
>  >  >  > > > > > > > Hi, I am facing problem in using JNDI to do lookup. I have tried
>  >  >  > to
>  >  >  > > > > > > > solve several problem using google before hitting this
>  >  >  > > > > > > >
>  >  >  > > > > > > > I have materialType.properties and jndi.properties file deployed
>  >  >  > in
>  >  >  > > > > > > >
>  >  >  > > > > > > geronimo
>  >  >  > > > > > >
>  >  >  > > > > > > >
>  >  >  > > > > > > > materialType.properties
>  >  >  > > > > > > > ================
>  >  >  > > > > > > > jndi.process.ejb = java:comp/env/ejb/MaterialTestBean
>  >  >  > > > > > > >
>  >  >  > > > > > > > jndi.properties
>  >  >  > > > > > > > ============
>  >  >  > > > > > > >
>  >  >  > java.naming.factory.initial=org.openejb.client.RemoteInitialContextFactory
>  >  >  > > > > > > > java.naming.provider.url=localhost:4201
>  >  >  > > > > > > > java.naming.security.principal=system
>  >  >  > > > > > > > java.naming.security.credentials=manager
>  >  >  > > > > > > >
>  >  >  > > > > > > >
>  >  >  > > > > > > > The problem I face seems like not able to find the class
>  >  >  > > > > > > > org.openejb.client.RemoteInitialContextFactory .
>  >  >  > > > > > > > I think the reason should be openejb library missing or invalid
>  >  >  > but I
>  >  >  > > > > > > > can't figure out where the openejb library in geronimo ..
>  >  >  > > > > > > > Any help is appreciated , thanks.
>  >  >  > > > > > > >
>  >  >  > > > > > > >
>  >  >  > > > > > > >
>  >  >  > > > > > > > Error msg
>  >  >  > > > > > > > =========
>  >  >  > > > > > > >
>  >  >  > > > > > > > javax.naming.NoInitialContextException: Cannot instantiate
>  >  >  > class:
>  >  >  > > > > > > > org.openejb.client.RemoteInitialContextFactory [Root exception
>  >  >  > is
>  >  >  > > > > > > > java.lang.ClassNotFoundException:
>  >  >  > > > > > > > org.openejb.client.RemoteInitialContextFactory]
>  >  >  > > > > > > >      at
>  >  >  > > > > > > >
>  >  >  > > > > > >
>  >  >  > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
>  >  >  > > > > > >
>  >  >  > > > > > > >      at
>  >  >  > > > > > > >
>  >  >  > > > > > >
>  >  >  > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >  >  > > > > > >
>  >  >  > > > > > > >      at
>  >  >  > javax.naming.InitialContext.init(InitialContext.java:223)
>  >  >  > > > > > > >      at
>  >  >  > javax.naming.InitialContext.<init>(InitialContext.java:175)
>  >  >  > > > > > > >      at
>  >  >  > > > > > > >
>  >  >  > > > > > >
>  >  >  > test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
>  >  >  > > > > > >
>  >  >  > > > > > > > Caused by: java.lang.ClassNotFoundException:
>  >  >  > > > > > > > org.openejb.client.RemoteInitialContextFactory
>  >  >  > > > > > > >
>  >  >  > > > > > > >
>  >  >  > > > > > > >
>  >  >  > > > > > > > <more codes>
>  >  >  > > > > > > > ::
>  >  >  > > > > > > >              InitialContext context;
>  >  >  > > > > > > >              MaterialTestBeanRemote beanRemote = null;
>  >  >  > > > > > > >              ResourceBundle      bundle = null;
>  >  >  > > > > > > >
>  >  >  > > > > > > >            bundle = ResourceBundle.getBundle("materialType",
>  >  >  > > > > > > > Locale.getDefault(),
>  >  >  > FirstEJB3TutorialClient.class.getClassLoader());
>  >  >  > > > > > > >            String jndiName =
>  >  >  > bundle.getString("jndi.process.ejb");
>  >  >  > > > > > > >              try
>  >  >  > > > > > > >              {
>  >  >  > > > > > > >                       context = new InitialContext();
>  >  >  > > > > > > >                       beanRemote = (MaterialTestBeanRemote)
>  >  >  > > > > > > > context.lookup(MaterialTestBean.RemoteJNDIName);
>  >  >  > > > > > > >                       beanRemote.testMaterial();
>  >  >  > > > > > > >                       beanRemote.testMaterialType();
>  >  >  > > > > > > >             }
>  >  >  > > > > > > >
>  >  >  > > > > > > > <more codes>
>  >  >  > > > > > > >
>  >  >  > > > > > > >
>  >  >  > > > > > >
>  >  >  > > > > > >
>  >  >  > > > > > >
>  >  >  > > > > >
>  >  >  > > > > >
>  >  >  > > > >
>  >  >  > > > >
>  >  >  > > >
>  >  >  > > >
>  >  >  > >
>  >  >  > >
>  >  >  >
>  >  >  >
>  >  >
>  >
>

Re: problem JNDI lookup in geronimo

Posted by CG <le...@gmail.com>.
Thx Nguyen. This solved the problem.

I am facing another problem now , which hv troubled me for 2 days and
could find solution on google.


It is still stuck at     context = new InitialContext(props);

The error is
Cannot read the response from the server.  The class for an object
being returned is not located in this system

I'm not sure which class is the refer to in the error , is it related
to the JNDI of the ejb ?


Koa


Full error
=======
javax.naming.AuthenticationException: Cannot read the response from
the server.  The class for an object being returned is not located in
this system:; nested exception is:
	java.lang.ClassNotFoundException: org.apache.geronimo.security.SubjectId
	at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
	at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
	at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
	at javax.naming.InitialContext.init(InitialContext.java:223)
	at javax.naming.InitialContext.<init>(InitialContext.java:197)
	at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:47)
Exception in thread "main" java.lang.RuntimeException:
javax.naming.AuthenticationException: Cannot read the response from
the server.  The class for an object being returned is not located in
this system:; nested exception is:
	java.lang.ClassNotFoundException: org.apache.geronimo.security.SubjectId
	at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:58)
Caused by: javax.naming.AuthenticationException: Cannot read the
response from the server.  The class for an object being returned is
not located in this system:; nested exception is:
	java.lang.ClassNotFoundException: org.apache.geronimo.security.SubjectId
	at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
	at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
	at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
	at javax.naming.InitialContext.init(InitialContext.java:223)
	at javax.naming.InitialContext.<init>(InitialContext.java:197)
	at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:47)








On Wed, Apr 9, 2008 at 12:37 AM, Viet Nguyen <vh...@gmail.com> wrote:
> You also need to specify the security realm in which you want to
>  authenticate against. Try adding this to your props
>
>                 props.setProperty("openejb.authentication.realmName",
>  "geronimo-admin");
>
>  Regards,
>  Viet
>
>
>
>  On Tue, Apr 8, 2008 at 11:38 AM, CG <le...@gmail.com> wrote:
>  > hi, thanks for the feedback.
>  >
>  >  I have tried to settle the new problem but no luck , it is out of my ability.
>  >  I can confirm the user and password works.
>  >
>  >  But the error msg seems like telling me that authentication failed ..
>  >
>  >  Any hints will be appreciated .. thx.
>  >
>  >  CG
>  >
>  >  <my code>
>  >  // initially has no this part , manually added to isolate the possible
>  >  problem of properties file
>  >             Properties props = new Properties();
>  >  props.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.openejb.client.RemoteInitialContextFactory");
>  >             props.put(Context.PROVIDER_URL,"ejbd://127.0.0.1:4201");
>  >             props.setProperty(Context.SECURITY_PRINCIPAL, "system");
>  >             props.setProperty(Context.SECURITY_CREDENTIALS, "manager");
>  >   // end
>  >                          context = new InitialContext(props);    <--- problem at this line
>  >
>  >  < end my code>
>  >
>  >  Error message
>  >  ==============
>  >  javax.naming.AuthenticationException: This principle is not
>  >  authorized. [Root exception is
>  >  javax.security.auth.login.LoginException: Invalid null input: name]
>  >         at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:162)
>  >
>  >         at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>  >         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>  >         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >         at javax.naming.InitialContext.init(InitialContext.java:223)
>  >         at javax.naming.InitialContext.<init>(InitialContext.java:197)
>  >         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:46)
>  >  Caused by: javax.security.auth.login.LoginException: Invalid null input: name
>  >         at javax.security.auth.login.LoginContext.init(LoginContext.java:229)
>  >         at javax.security.auth.login.LoginContext.<init>(LoginContext.java:367)
>  >         at javax.security.auth.login.LoginContext.<init>(LoginContext.java:444)
>  >         at org.apache.geronimo.security.ContextManager.login(ContextManager.java:74)
>  >         at org.apache.geronimo.openejb.GeronimoSecurityService.login(GeronimoSecurityService.java:52)
>  >         at org.apache.openejb.server.ejbd.AuthRequestHandler.processRequest(AuthRequestHandler.java:56)
>  >         at org.apache.openejb.server.ejbd.EjbDaemon.processAuthRequest(EjbDaemon.java:172)
>  >         at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:130)
>  >         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)
>  >
>  > Exception in thread "main" java.lang.RuntimeException:
>  >  javax.naming.AuthenticationException: This principle is not
>  >  authorized. [Root exception is
>  >  javax.security.auth.login.LoginException: Invalid null input: name]
>  >         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:57)
>  >  Caused by: javax.naming.AuthenticationException: This principle is not
>  >  authorized. [Root exception is
>  >  javax.security.auth.login.LoginException: Invalid null input: name]
>  >         at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:162)
>  >
>  >         at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>  >         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>  >         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >         at javax.naming.InitialContext.init(InitialContext.java:223)
>  >         at javax.naming.InitialContext.<init>(InitialContext.java:197)
>  >         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:46)
>  >  Caused by: javax.security.auth.login.LoginException: Invalid null input: name
>  >         at javax.security.auth.login.LoginContext.init(LoginContext.java:229)
>  >         at javax.security.auth.login.LoginContext.<init>(LoginContext.java:367)
>  >         at javax.security.auth.login.LoginContext.<init>(LoginContext.java:444)
>  >         at org.apache.geronimo.security.ContextManager.login(ContextManager.java:74)
>  >         at org.apache.geronimo.openejb.GeronimoSecurityService.login(GeronimoSecurityService.java:52)
>  >         at org.apache.openejb.server.ejbd.AuthRequestHandler.processRequest(AuthRequestHandler.java:56)
>  >         at org.apache.openejb.server.ejbd.EjbDaemon.processAuthRequest(EjbDaemon.java:172)
>  >         at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:130)
>  >         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)
>  >
>  >
>  >  Geronimo log
>  >  ===========
>  >  84387:  23:50:31,778 DEBUG [auth] AUTH REQUEST: null:system --
>  >  RESPONSE: AUTH_DENIED:javax.security.auth.login.LoginException:
>  >  Invalid null input: name
>  >  84388:  23:50:38,941 DEBUG [CoyoteAdapter] Requested cookie session id
>  >  is 27D8EC25DC047479A6FB368DDB730876
>  >  84389:  23:50:38,941 DEBUG [AuthenticatorBase] Security checking
>  >  request GET /console/portal//Server/Server%20Logs/__ac0x3console-base0x2LogViewer!1535651776|1
>  >  84390:  23:50:38,941 DEBUG [AuthenticatorBase] We have cached auth
>  >  type FORM for principal
>  >  org.apache.geronimo.tomcat.JAASTomcatPrincipal@194a7fb
>  >  84391:  23:50:38,941 DEBUG [AuthenticatorBase] Calling hasUserDataPermission()
>  >  84392:  23:50:38,941 DEBUG [AuthenticatorBase] Calling authenticate()
>  >  84393:  23:50:38,941 DEBUG [FormAuthenticator] Already authenticated 'system'
>  >  84394:  23:50:38,941 DEBUG [AuthenticatorBase] Calling accessControl()
>  >  84395:  23:50:38,941 DEBUG [AuthenticatorBase] Successfully passed all
>  >  security constraints
>  >  84396:  23:50:38,941 TRACE [StandardWrapper] Returning non-STM instance
>  >  84397:  23:50:38,942 TRACE [StandardWrapper] Returning non-STM instance
>  >  84398:  23:50:38,945 DEBUG [CoyoteAdapter] Requested cookie session id
>  >  is 27D8EC25DC047479A6FB368DDB730876
>  >  84399:  23:50:38,945 DEBUG [AuthenticatorBase] Security checking
>  >  request GET /console/portal//Server/Server%20Logs/__rp0x3console-base0x2LogViewer!1535651776|1_logFile/0x3home0x3super0x3bin0x3geronimo-tomcat6-javaee5-20x210x3var0x3log0x3geronimo0x2log/__rp0x3console-base0x2LogViewer!1535651776|1_action/search/__rp0x3console-base0x2LogViewer!1535651776|1_logLevel/TRACE/__rp0x3console-base0x2LogViewer!1535651776|1_maxRows/50
>  >  84400:  23:50:38,945 DEBUG [AuthenticatorBase] We have cached auth
>  >  type FORM for principal
>  >  org.apache.geronimo.tomcat.JAASTomcatPrincipal@194a7fb
>  >  84401:  23:50:38,945 DEBUG [AuthenticatorBase] Calling hasUserDataPermission()
>  >  84402:  23:50:38,945 DEBUG [AuthenticatorBase] Calling authenticate()
>  >  84403:  23:50:38,945 DEBUG [FormAuthenticator] Already authenticated 'system'
>  >  84404:  23:50:38,946 DEBUG [AuthenticatorBase] Calling accessControl()
>  >  84405:  23:50:38,946 DEBUG [AuthenticatorBase] Successfully passed all
>  >  security constraints
>  >  84406:  23:50:38,946 TRACE [StandardWrapper] Returning non-STM instance
>  >  84407:  23:50:38,946 TRACE [StandardWrapper] Returning non-STM instance
>  >  84408:  23:50:38,947 TRACE [StandardWrapper] Returning non-STM instance
>  >  84409:  23:50:39,129 TRACE [StandardWrapper] Returning non-STM instance
>  >  84410:  23:50:39,130 TRACE [StandardWrapper] Returning non-STM instance
>  >  84411:  23:50:39,131 TRACE [StandardWrapper] Returning non-STM instance
>  >  84412:  23:50:39,132 INFO [SupportedModesServiceImpl] Portlet mode
>  >  'edit' not found for portletId:
>  >  '/console-base.LogManager!1535651776|0'
>  >  84413:  23:50:39,140 TRACE [StandardWrapper] Returning non-STM instance
>  >  84414:  23:50:39,146 TRACE [StandardWrapper] Returning non-STM instance
>  >
>  >
>  >
>  >
>  >
>  >
>  >  On Tue, Apr 8, 2008 at 3:25 AM, David Blevins <da...@visi.com> wrote:
>  >  >
>  >  >  On Apr 7, 2008, at 8:36 AM, CG wrote:
>  >  >
>  >  > > Hi all,
>  >  > > After googling again,  I have solved the problem by changing the
>  >  > > jndi.properties , localhost:4201 to 127.0.0.1:4201.
>  >  > >
>  >  >
>  >  >  You can use "localhost" as a host, you just need to add
>  >  > "ejbd://localhost:4201" due to the way URIs are parsed.  In the openejb 3.0
>  >  > final up for a vote now, we check your provider url string a bit more before
>  >  > giving it to java.net.URI and make corrections.
>  >  >
>  >  >
>  >  >
>  >  > > After solving that , another problem coming up , I still need time to
>  >  > > do more searching.
>  >  > >
>  >  >
>  >  >  Happy to help when you get the details.
>  >  >
>  >  >  -David
>  >  >
>  >  >
>  >  >
>  >  >
>  >  > >
>  >  > >
>  >  > > CG
>  >  > >
>  >  > > On Mon, Apr 7, 2008 at 9:29 PM, CG <le...@gmail.com> wrote:
>  >  > >
>  >  > > > Forget to attach the error message in the previous mail, here it is.
>  >  > > >
>  >  > > > Error
>  >  > > > ====
>  >  > > > javax.naming.AuthenticationException: Cannot connect to server
>  >  > > > 'localhost:4201"; nested exception is:
>  >  > > >       java.io.IOException: Cannot  connect to server: 'localhost:4201'
>  >  > due
>  >  > > > to an unkown exception in the OpenEJB client:
>  >  > > > java.lang.IllegalArgumentException : port out of range:-1
>  >  > > >       at
>  >  > org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
>  >  > > >       at
>  >  > org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>  >  > > >       at
>  >  > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>  >  > > >
>  >  > > >       at
>  >  > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >  > > >       at javax.naming.InitialContext.init(InitialContext.java:223)
>  >  > > >       at javax.naming.InitialContext.<init>(InitialContext.java:175)
>  >  > > >       at
>  >  > test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
>  >  > > > Exception in thread "main" java.lang.RuntimeException:
>  >  > > > javax.naming.AuthenticationException: Cannot connect to server
>  >  > > > 'localhost:4201"; nested exception is:
>  >  > > >       java.io.IOException: Cannot  connect to server: 'localhost:4201'
>  >  > due
>  >  > > > to an unkown exception in the OpenEJB client:
>  >  > > > java.lang.IllegalArgumentException : port out of range:-1
>  >  > > >       at
>  >  > test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:50)
>  >  > > > Caused by: javax.naming.AuthenticationException: Cannot connect to
>  >  > > > server 'localhost:4201"; nested exception is:
>  >  > > >       java.io.IOException: Cannot  connect to server: 'localhost:4201'
>  >  > due
>  >  > > > to an unkown exception in the OpenEJB client:
>  >  > > > java.lang.IllegalArgumentException : port out of range:-1
>  >  > > >       at
>  >  > org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
>  >  > > >       at
>  >  > org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>  >  > > >       at
>  >  > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>  >  > > >
>  >  > > >       at
>  >  > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >  > > >       at javax.naming.InitialContext.init(InitialContext.java:223)
>  >  > > >       at javax.naming.InitialContext.<init>(InitialContext.java:175)
>  >  > > >       at
>  >  > test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
>  >  > > >
>  >  > > >
>  >  > > >
>  >  > > >
>  >  > > >
>  >  > > >
>  >  > > > On Mon, Apr 7, 2008 at 9:19 PM, CG <le...@gmail.com> wrote:
>  >  > > >
>  >  > > > > Hi all,
>  >  > > > > I have managed to add the appropriate library but encounter another
>  >  > problem.
>  >  > > > >
>  >  > > > > It seems like port 4201 does not have the JNDI provider service
>  >  > running.
>  >  > > > >
>  >  > > > > May I know whether geronimo built-in with JNDI provider service or
>  >  > not?
>  >  > > > > I noticed that there is LDAP service (which can be a JNDI provider
>  >  > > > > service to my understanding)running at port 1389  , and I tried to
>  >  > > > > change the jndi.properties to connect to port 1389 instead , however,
>  >  > > > > no luck , error still persist.
>  >  > > > >
>  >  > > > > any idea ?
>  >  > > > >
>  >  > > > > Thanks in advanced.
>  >  > > > >
>  >  > > > > CG
>  >  > > > >
>  >  > > > >
>  >  > > > >
>  >  > > > >
>  >  > > > > On Mon, Apr 7, 2008 at 7:56 PM, CG <le...@gmail.com> wrote:
>  >  > > > >
>  >  > > > > > thanks david.
>  >  > > > > >
>  >  > > > > > I just wonder how do I add those libraries in the classpath in
>  >  > eclipse
>  >  > > > > > ? Is it going to Build path > add external jar ?
>  >  > > > > >
>  >  > > > > > Isn't the GEP have added those thing automatically ?
>  >  > > > > >
>  >  > > > > > thanks for your patient  to guide a newbie of Java & eclipse.
>  >  > > > > >
>  >  > > > > >
>  >  > > > > >
>  >  > > > > >
>  >  > > > > > On Sun, Apr 6, 2008 at 11:21 PM, David Jencks
>  >  > <da...@yahoo.com> wrote:
>  >  > > > > >
>  >  > > > > > > The library you need in your client classpath is at
>  >  > > > > > >
>  >  > > > > > >
>  >  > repository/org/apache/openejb/openejb-client/*/openejb-client-*.jar
>  >  > > > > > >
>  >  > > > > > > thanks
>  >  > > > > > > david jencks
>  >  > > > > > >
>  >  > > > > > >
>  >  > > > > > >
>  >  > > > > > > On Apr 6, 2008, at 7:53 AM, CG wrote:
>  >  > > > > > >
>  >  > > > > > >
>  >  > > > > > >
>  >  > > > > > > > Hi, I am facing problem in using JNDI to do lookup. I have tried
>  >  > to
>  >  > > > > > > > solve several problem using google before hitting this
>  >  > > > > > > >
>  >  > > > > > > > I have materialType.properties and jndi.properties file deployed
>  >  > in
>  >  > > > > > > >
>  >  > > > > > > geronimo
>  >  > > > > > >
>  >  > > > > > > >
>  >  > > > > > > > materialType.properties
>  >  > > > > > > > ================
>  >  > > > > > > > jndi.process.ejb = java:comp/env/ejb/MaterialTestBean
>  >  > > > > > > >
>  >  > > > > > > > jndi.properties
>  >  > > > > > > > ============
>  >  > > > > > > >
>  >  > java.naming.factory.initial=org.openejb.client.RemoteInitialContextFactory
>  >  > > > > > > > java.naming.provider.url=localhost:4201
>  >  > > > > > > > java.naming.security.principal=system
>  >  > > > > > > > java.naming.security.credentials=manager
>  >  > > > > > > >
>  >  > > > > > > >
>  >  > > > > > > > The problem I face seems like not able to find the class
>  >  > > > > > > > org.openejb.client.RemoteInitialContextFactory .
>  >  > > > > > > > I think the reason should be openejb library missing or invalid
>  >  > but I
>  >  > > > > > > > can't figure out where the openejb library in geronimo ..
>  >  > > > > > > > Any help is appreciated , thanks.
>  >  > > > > > > >
>  >  > > > > > > >
>  >  > > > > > > >
>  >  > > > > > > > Error msg
>  >  > > > > > > > =========
>  >  > > > > > > >
>  >  > > > > > > > javax.naming.NoInitialContextException: Cannot instantiate
>  >  > class:
>  >  > > > > > > > org.openejb.client.RemoteInitialContextFactory [Root exception
>  >  > is
>  >  > > > > > > > java.lang.ClassNotFoundException:
>  >  > > > > > > > org.openejb.client.RemoteInitialContextFactory]
>  >  > > > > > > >      at
>  >  > > > > > > >
>  >  > > > > > >
>  >  > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
>  >  > > > > > >
>  >  > > > > > > >      at
>  >  > > > > > > >
>  >  > > > > > >
>  >  > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >  > > > > > >
>  >  > > > > > > >      at
>  >  > javax.naming.InitialContext.init(InitialContext.java:223)
>  >  > > > > > > >      at
>  >  > javax.naming.InitialContext.<init>(InitialContext.java:175)
>  >  > > > > > > >      at
>  >  > > > > > > >
>  >  > > > > > >
>  >  > test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
>  >  > > > > > >
>  >  > > > > > > > Caused by: java.lang.ClassNotFoundException:
>  >  > > > > > > > org.openejb.client.RemoteInitialContextFactory
>  >  > > > > > > >
>  >  > > > > > > >
>  >  > > > > > > >
>  >  > > > > > > > <more codes>
>  >  > > > > > > > ::
>  >  > > > > > > >              InitialContext context;
>  >  > > > > > > >              MaterialTestBeanRemote beanRemote = null;
>  >  > > > > > > >              ResourceBundle      bundle = null;
>  >  > > > > > > >
>  >  > > > > > > >            bundle = ResourceBundle.getBundle("materialType",
>  >  > > > > > > > Locale.getDefault(),
>  >  > FirstEJB3TutorialClient.class.getClassLoader());
>  >  > > > > > > >            String jndiName =
>  >  > bundle.getString("jndi.process.ejb");
>  >  > > > > > > >              try
>  >  > > > > > > >              {
>  >  > > > > > > >                       context = new InitialContext();
>  >  > > > > > > >                       beanRemote = (MaterialTestBeanRemote)
>  >  > > > > > > > context.lookup(MaterialTestBean.RemoteJNDIName);
>  >  > > > > > > >                       beanRemote.testMaterial();
>  >  > > > > > > >                       beanRemote.testMaterialType();
>  >  > > > > > > >             }
>  >  > > > > > > >
>  >  > > > > > > > <more codes>
>  >  > > > > > > >
>  >  > > > > > > >
>  >  > > > > > >
>  >  > > > > > >
>  >  > > > > > >
>  >  > > > > >
>  >  > > > > >
>  >  > > > >
>  >  > > > >
>  >  > > >
>  >  > > >
>  >  > >
>  >  > >
>  >  >
>  >  >
>  >
>

Re: problem JNDI lookup in geronimo

Posted by Viet Nguyen <vh...@gmail.com>.
You also need to specify the security realm in which you want to
authenticate against. Try adding this to your props

                props.setProperty("openejb.authentication.realmName",
"geronimo-admin");

Regards,
Viet

On Tue, Apr 8, 2008 at 11:38 AM, CG <le...@gmail.com> wrote:
> hi, thanks for the feedback.
>
>  I have tried to settle the new problem but no luck , it is out of my ability.
>  I can confirm the user and password works.
>
>  But the error msg seems like telling me that authentication failed ..
>
>  Any hints will be appreciated .. thx.
>
>  CG
>
>  <my code>
>  // initially has no this part , manually added to isolate the possible
>  problem of properties file
>             Properties props = new Properties();
>  props.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.openejb.client.RemoteInitialContextFactory");
>             props.put(Context.PROVIDER_URL,"ejbd://127.0.0.1:4201");
>             props.setProperty(Context.SECURITY_PRINCIPAL, "system");
>             props.setProperty(Context.SECURITY_CREDENTIALS, "manager");
>   // end
>                          context = new InitialContext(props);    <--- problem at this line
>
>  < end my code>
>
>  Error message
>  ==============
>  javax.naming.AuthenticationException: This principle is not
>  authorized. [Root exception is
>  javax.security.auth.login.LoginException: Invalid null input: name]
>         at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:162)
>
>         at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>         at javax.naming.InitialContext.init(InitialContext.java:223)
>         at javax.naming.InitialContext.<init>(InitialContext.java:197)
>         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:46)
>  Caused by: javax.security.auth.login.LoginException: Invalid null input: name
>         at javax.security.auth.login.LoginContext.init(LoginContext.java:229)
>         at javax.security.auth.login.LoginContext.<init>(LoginContext.java:367)
>         at javax.security.auth.login.LoginContext.<init>(LoginContext.java:444)
>         at org.apache.geronimo.security.ContextManager.login(ContextManager.java:74)
>         at org.apache.geronimo.openejb.GeronimoSecurityService.login(GeronimoSecurityService.java:52)
>         at org.apache.openejb.server.ejbd.AuthRequestHandler.processRequest(AuthRequestHandler.java:56)
>         at org.apache.openejb.server.ejbd.EjbDaemon.processAuthRequest(EjbDaemon.java:172)
>         at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:130)
>         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)
>
> Exception in thread "main" java.lang.RuntimeException:
>  javax.naming.AuthenticationException: This principle is not
>  authorized. [Root exception is
>  javax.security.auth.login.LoginException: Invalid null input: name]
>         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:57)
>  Caused by: javax.naming.AuthenticationException: This principle is not
>  authorized. [Root exception is
>  javax.security.auth.login.LoginException: Invalid null input: name]
>         at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:162)
>
>         at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>         at javax.naming.InitialContext.init(InitialContext.java:223)
>         at javax.naming.InitialContext.<init>(InitialContext.java:197)
>         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:46)
>  Caused by: javax.security.auth.login.LoginException: Invalid null input: name
>         at javax.security.auth.login.LoginContext.init(LoginContext.java:229)
>         at javax.security.auth.login.LoginContext.<init>(LoginContext.java:367)
>         at javax.security.auth.login.LoginContext.<init>(LoginContext.java:444)
>         at org.apache.geronimo.security.ContextManager.login(ContextManager.java:74)
>         at org.apache.geronimo.openejb.GeronimoSecurityService.login(GeronimoSecurityService.java:52)
>         at org.apache.openejb.server.ejbd.AuthRequestHandler.processRequest(AuthRequestHandler.java:56)
>         at org.apache.openejb.server.ejbd.EjbDaemon.processAuthRequest(EjbDaemon.java:172)
>         at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:130)
>         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)
>
>
>  Geronimo log
>  ===========
>  84387:  23:50:31,778 DEBUG [auth] AUTH REQUEST: null:system --
>  RESPONSE: AUTH_DENIED:javax.security.auth.login.LoginException:
>  Invalid null input: name
>  84388:  23:50:38,941 DEBUG [CoyoteAdapter] Requested cookie session id
>  is 27D8EC25DC047479A6FB368DDB730876
>  84389:  23:50:38,941 DEBUG [AuthenticatorBase] Security checking
>  request GET /console/portal//Server/Server%20Logs/__ac0x3console-base0x2LogViewer!1535651776|1
>  84390:  23:50:38,941 DEBUG [AuthenticatorBase] We have cached auth
>  type FORM for principal
>  org.apache.geronimo.tomcat.JAASTomcatPrincipal@194a7fb
>  84391:  23:50:38,941 DEBUG [AuthenticatorBase] Calling hasUserDataPermission()
>  84392:  23:50:38,941 DEBUG [AuthenticatorBase] Calling authenticate()
>  84393:  23:50:38,941 DEBUG [FormAuthenticator] Already authenticated 'system'
>  84394:  23:50:38,941 DEBUG [AuthenticatorBase] Calling accessControl()
>  84395:  23:50:38,941 DEBUG [AuthenticatorBase] Successfully passed all
>  security constraints
>  84396:  23:50:38,941 TRACE [StandardWrapper] Returning non-STM instance
>  84397:  23:50:38,942 TRACE [StandardWrapper] Returning non-STM instance
>  84398:  23:50:38,945 DEBUG [CoyoteAdapter] Requested cookie session id
>  is 27D8EC25DC047479A6FB368DDB730876
>  84399:  23:50:38,945 DEBUG [AuthenticatorBase] Security checking
>  request GET /console/portal//Server/Server%20Logs/__rp0x3console-base0x2LogViewer!1535651776|1_logFile/0x3home0x3super0x3bin0x3geronimo-tomcat6-javaee5-20x210x3var0x3log0x3geronimo0x2log/__rp0x3console-base0x2LogViewer!1535651776|1_action/search/__rp0x3console-base0x2LogViewer!1535651776|1_logLevel/TRACE/__rp0x3console-base0x2LogViewer!1535651776|1_maxRows/50
>  84400:  23:50:38,945 DEBUG [AuthenticatorBase] We have cached auth
>  type FORM for principal
>  org.apache.geronimo.tomcat.JAASTomcatPrincipal@194a7fb
>  84401:  23:50:38,945 DEBUG [AuthenticatorBase] Calling hasUserDataPermission()
>  84402:  23:50:38,945 DEBUG [AuthenticatorBase] Calling authenticate()
>  84403:  23:50:38,945 DEBUG [FormAuthenticator] Already authenticated 'system'
>  84404:  23:50:38,946 DEBUG [AuthenticatorBase] Calling accessControl()
>  84405:  23:50:38,946 DEBUG [AuthenticatorBase] Successfully passed all
>  security constraints
>  84406:  23:50:38,946 TRACE [StandardWrapper] Returning non-STM instance
>  84407:  23:50:38,946 TRACE [StandardWrapper] Returning non-STM instance
>  84408:  23:50:38,947 TRACE [StandardWrapper] Returning non-STM instance
>  84409:  23:50:39,129 TRACE [StandardWrapper] Returning non-STM instance
>  84410:  23:50:39,130 TRACE [StandardWrapper] Returning non-STM instance
>  84411:  23:50:39,131 TRACE [StandardWrapper] Returning non-STM instance
>  84412:  23:50:39,132 INFO [SupportedModesServiceImpl] Portlet mode
>  'edit' not found for portletId:
>  '/console-base.LogManager!1535651776|0'
>  84413:  23:50:39,140 TRACE [StandardWrapper] Returning non-STM instance
>  84414:  23:50:39,146 TRACE [StandardWrapper] Returning non-STM instance
>
>
>
>
>
>
>  On Tue, Apr 8, 2008 at 3:25 AM, David Blevins <da...@visi.com> wrote:
>  >
>  >  On Apr 7, 2008, at 8:36 AM, CG wrote:
>  >
>  > > Hi all,
>  > > After googling again,  I have solved the problem by changing the
>  > > jndi.properties , localhost:4201 to 127.0.0.1:4201.
>  > >
>  >
>  >  You can use "localhost" as a host, you just need to add
>  > "ejbd://localhost:4201" due to the way URIs are parsed.  In the openejb 3.0
>  > final up for a vote now, we check your provider url string a bit more before
>  > giving it to java.net.URI and make corrections.
>  >
>  >
>  >
>  > > After solving that , another problem coming up , I still need time to
>  > > do more searching.
>  > >
>  >
>  >  Happy to help when you get the details.
>  >
>  >  -David
>  >
>  >
>  >
>  >
>  > >
>  > >
>  > > CG
>  > >
>  > > On Mon, Apr 7, 2008 at 9:29 PM, CG <le...@gmail.com> wrote:
>  > >
>  > > > Forget to attach the error message in the previous mail, here it is.
>  > > >
>  > > > Error
>  > > > ====
>  > > > javax.naming.AuthenticationException: Cannot connect to server
>  > > > 'localhost:4201"; nested exception is:
>  > > >       java.io.IOException: Cannot  connect to server: 'localhost:4201'
>  > due
>  > > > to an unkown exception in the OpenEJB client:
>  > > > java.lang.IllegalArgumentException : port out of range:-1
>  > > >       at
>  > org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
>  > > >       at
>  > org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>  > > >       at
>  > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>  > > >
>  > > >       at
>  > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  > > >       at javax.naming.InitialContext.init(InitialContext.java:223)
>  > > >       at javax.naming.InitialContext.<init>(InitialContext.java:175)
>  > > >       at
>  > test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
>  > > > Exception in thread "main" java.lang.RuntimeException:
>  > > > javax.naming.AuthenticationException: Cannot connect to server
>  > > > 'localhost:4201"; nested exception is:
>  > > >       java.io.IOException: Cannot  connect to server: 'localhost:4201'
>  > due
>  > > > to an unkown exception in the OpenEJB client:
>  > > > java.lang.IllegalArgumentException : port out of range:-1
>  > > >       at
>  > test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:50)
>  > > > Caused by: javax.naming.AuthenticationException: Cannot connect to
>  > > > server 'localhost:4201"; nested exception is:
>  > > >       java.io.IOException: Cannot  connect to server: 'localhost:4201'
>  > due
>  > > > to an unkown exception in the OpenEJB client:
>  > > > java.lang.IllegalArgumentException : port out of range:-1
>  > > >       at
>  > org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
>  > > >       at
>  > org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>  > > >       at
>  > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>  > > >
>  > > >       at
>  > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  > > >       at javax.naming.InitialContext.init(InitialContext.java:223)
>  > > >       at javax.naming.InitialContext.<init>(InitialContext.java:175)
>  > > >       at
>  > test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
>  > > >
>  > > >
>  > > >
>  > > >
>  > > >
>  > > >
>  > > > On Mon, Apr 7, 2008 at 9:19 PM, CG <le...@gmail.com> wrote:
>  > > >
>  > > > > Hi all,
>  > > > > I have managed to add the appropriate library but encounter another
>  > problem.
>  > > > >
>  > > > > It seems like port 4201 does not have the JNDI provider service
>  > running.
>  > > > >
>  > > > > May I know whether geronimo built-in with JNDI provider service or
>  > not?
>  > > > > I noticed that there is LDAP service (which can be a JNDI provider
>  > > > > service to my understanding)running at port 1389  , and I tried to
>  > > > > change the jndi.properties to connect to port 1389 instead , however,
>  > > > > no luck , error still persist.
>  > > > >
>  > > > > any idea ?
>  > > > >
>  > > > > Thanks in advanced.
>  > > > >
>  > > > > CG
>  > > > >
>  > > > >
>  > > > >
>  > > > >
>  > > > > On Mon, Apr 7, 2008 at 7:56 PM, CG <le...@gmail.com> wrote:
>  > > > >
>  > > > > > thanks david.
>  > > > > >
>  > > > > > I just wonder how do I add those libraries in the classpath in
>  > eclipse
>  > > > > > ? Is it going to Build path > add external jar ?
>  > > > > >
>  > > > > > Isn't the GEP have added those thing automatically ?
>  > > > > >
>  > > > > > thanks for your patient  to guide a newbie of Java & eclipse.
>  > > > > >
>  > > > > >
>  > > > > >
>  > > > > >
>  > > > > > On Sun, Apr 6, 2008 at 11:21 PM, David Jencks
>  > <da...@yahoo.com> wrote:
>  > > > > >
>  > > > > > > The library you need in your client classpath is at
>  > > > > > >
>  > > > > > >
>  > repository/org/apache/openejb/openejb-client/*/openejb-client-*.jar
>  > > > > > >
>  > > > > > > thanks
>  > > > > > > david jencks
>  > > > > > >
>  > > > > > >
>  > > > > > >
>  > > > > > > On Apr 6, 2008, at 7:53 AM, CG wrote:
>  > > > > > >
>  > > > > > >
>  > > > > > >
>  > > > > > > > Hi, I am facing problem in using JNDI to do lookup. I have tried
>  > to
>  > > > > > > > solve several problem using google before hitting this
>  > > > > > > >
>  > > > > > > > I have materialType.properties and jndi.properties file deployed
>  > in
>  > > > > > > >
>  > > > > > > geronimo
>  > > > > > >
>  > > > > > > >
>  > > > > > > > materialType.properties
>  > > > > > > > ================
>  > > > > > > > jndi.process.ejb = java:comp/env/ejb/MaterialTestBean
>  > > > > > > >
>  > > > > > > > jndi.properties
>  > > > > > > > ============
>  > > > > > > >
>  > java.naming.factory.initial=org.openejb.client.RemoteInitialContextFactory
>  > > > > > > > java.naming.provider.url=localhost:4201
>  > > > > > > > java.naming.security.principal=system
>  > > > > > > > java.naming.security.credentials=manager
>  > > > > > > >
>  > > > > > > >
>  > > > > > > > The problem I face seems like not able to find the class
>  > > > > > > > org.openejb.client.RemoteInitialContextFactory .
>  > > > > > > > I think the reason should be openejb library missing or invalid
>  > but I
>  > > > > > > > can't figure out where the openejb library in geronimo ..
>  > > > > > > > Any help is appreciated , thanks.
>  > > > > > > >
>  > > > > > > >
>  > > > > > > >
>  > > > > > > > Error msg
>  > > > > > > > =========
>  > > > > > > >
>  > > > > > > > javax.naming.NoInitialContextException: Cannot instantiate
>  > class:
>  > > > > > > > org.openejb.client.RemoteInitialContextFactory [Root exception
>  > is
>  > > > > > > > java.lang.ClassNotFoundException:
>  > > > > > > > org.openejb.client.RemoteInitialContextFactory]
>  > > > > > > >      at
>  > > > > > > >
>  > > > > > >
>  > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
>  > > > > > >
>  > > > > > > >      at
>  > > > > > > >
>  > > > > > >
>  > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  > > > > > >
>  > > > > > > >      at
>  > javax.naming.InitialContext.init(InitialContext.java:223)
>  > > > > > > >      at
>  > javax.naming.InitialContext.<init>(InitialContext.java:175)
>  > > > > > > >      at
>  > > > > > > >
>  > > > > > >
>  > test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
>  > > > > > >
>  > > > > > > > Caused by: java.lang.ClassNotFoundException:
>  > > > > > > > org.openejb.client.RemoteInitialContextFactory
>  > > > > > > >
>  > > > > > > >
>  > > > > > > >
>  > > > > > > > <more codes>
>  > > > > > > > ::
>  > > > > > > >              InitialContext context;
>  > > > > > > >              MaterialTestBeanRemote beanRemote = null;
>  > > > > > > >              ResourceBundle      bundle = null;
>  > > > > > > >
>  > > > > > > >            bundle = ResourceBundle.getBundle("materialType",
>  > > > > > > > Locale.getDefault(),
>  > FirstEJB3TutorialClient.class.getClassLoader());
>  > > > > > > >            String jndiName =
>  > bundle.getString("jndi.process.ejb");
>  > > > > > > >              try
>  > > > > > > >              {
>  > > > > > > >                       context = new InitialContext();
>  > > > > > > >                       beanRemote = (MaterialTestBeanRemote)
>  > > > > > > > context.lookup(MaterialTestBean.RemoteJNDIName);
>  > > > > > > >                       beanRemote.testMaterial();
>  > > > > > > >                       beanRemote.testMaterialType();
>  > > > > > > >             }
>  > > > > > > >
>  > > > > > > > <more codes>
>  > > > > > > >
>  > > > > > > >
>  > > > > > >
>  > > > > > >
>  > > > > > >
>  > > > > >
>  > > > > >
>  > > > >
>  > > > >
>  > > >
>  > > >
>  > >
>  > >
>  >
>  >
>

Re: problem JNDI lookup in geronimo

Posted by CG <le...@gmail.com>.
hi, thanks for the feedback.

I have tried to settle the new problem but no luck , it is out of my ability.
I can confirm the user and password works.

But the error msg seems like telling me that authentication failed ..

Any hints will be appreciated .. thx.

CG

<my code>
// initially has no this part , manually added to isolate the possible
problem of properties file
            Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.openejb.client.RemoteInitialContextFactory");
            props.put(Context.PROVIDER_URL,"ejbd://127.0.0.1:4201");
            props.setProperty(Context.SECURITY_PRINCIPAL, "system");
            props.setProperty(Context.SECURITY_CREDENTIALS, "manager");
  // end
			 context = new InitialContext(props);    <--- problem at this line

< end my code>

Error message
==============
javax.naming.AuthenticationException: This principle is not
authorized. [Root exception is
javax.security.auth.login.LoginException: Invalid null input: name]
	at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:162)
	at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
	at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
	at javax.naming.InitialContext.init(InitialContext.java:223)
	at javax.naming.InitialContext.<init>(InitialContext.java:197)
	at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:46)
Caused by: javax.security.auth.login.LoginException: Invalid null input: name
	at javax.security.auth.login.LoginContext.init(LoginContext.java:229)
	at javax.security.auth.login.LoginContext.<init>(LoginContext.java:367)
	at javax.security.auth.login.LoginContext.<init>(LoginContext.java:444)
	at org.apache.geronimo.security.ContextManager.login(ContextManager.java:74)
	at org.apache.geronimo.openejb.GeronimoSecurityService.login(GeronimoSecurityService.java:52)
	at org.apache.openejb.server.ejbd.AuthRequestHandler.processRequest(AuthRequestHandler.java:56)
	at org.apache.openejb.server.ejbd.EjbDaemon.processAuthRequest(EjbDaemon.java:172)
	at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:130)
	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)
Exception in thread "main" java.lang.RuntimeException:
javax.naming.AuthenticationException: This principle is not
authorized. [Root exception is
javax.security.auth.login.LoginException: Invalid null input: name]
	at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:57)
Caused by: javax.naming.AuthenticationException: This principle is not
authorized. [Root exception is
javax.security.auth.login.LoginException: Invalid null input: name]
	at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:162)
	at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
	at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
	at javax.naming.InitialContext.init(InitialContext.java:223)
	at javax.naming.InitialContext.<init>(InitialContext.java:197)
	at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:46)
Caused by: javax.security.auth.login.LoginException: Invalid null input: name
	at javax.security.auth.login.LoginContext.init(LoginContext.java:229)
	at javax.security.auth.login.LoginContext.<init>(LoginContext.java:367)
	at javax.security.auth.login.LoginContext.<init>(LoginContext.java:444)
	at org.apache.geronimo.security.ContextManager.login(ContextManager.java:74)
	at org.apache.geronimo.openejb.GeronimoSecurityService.login(GeronimoSecurityService.java:52)
	at org.apache.openejb.server.ejbd.AuthRequestHandler.processRequest(AuthRequestHandler.java:56)
	at org.apache.openejb.server.ejbd.EjbDaemon.processAuthRequest(EjbDaemon.java:172)
	at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:130)
	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)


Geronimo log
===========
84387:  23:50:31,778 DEBUG [auth] AUTH REQUEST: null:system --
RESPONSE: AUTH_DENIED:javax.security.auth.login.LoginException:
Invalid null input: name
84388:  23:50:38,941 DEBUG [CoyoteAdapter] Requested cookie session id
is 27D8EC25DC047479A6FB368DDB730876
84389:  23:50:38,941 DEBUG [AuthenticatorBase] Security checking
request GET /console/portal//Server/Server%20Logs/__ac0x3console-base0x2LogViewer!1535651776|1
84390:  23:50:38,941 DEBUG [AuthenticatorBase] We have cached auth
type FORM for principal
org.apache.geronimo.tomcat.JAASTomcatPrincipal@194a7fb
84391:  23:50:38,941 DEBUG [AuthenticatorBase] Calling hasUserDataPermission()
84392:  23:50:38,941 DEBUG [AuthenticatorBase] Calling authenticate()
84393:  23:50:38,941 DEBUG [FormAuthenticator] Already authenticated 'system'
84394:  23:50:38,941 DEBUG [AuthenticatorBase] Calling accessControl()
84395:  23:50:38,941 DEBUG [AuthenticatorBase] Successfully passed all
security constraints
84396:  23:50:38,941 TRACE [StandardWrapper] Returning non-STM instance
84397:  23:50:38,942 TRACE [StandardWrapper] Returning non-STM instance
84398:  23:50:38,945 DEBUG [CoyoteAdapter] Requested cookie session id
is 27D8EC25DC047479A6FB368DDB730876
84399:  23:50:38,945 DEBUG [AuthenticatorBase] Security checking
request GET /console/portal//Server/Server%20Logs/__rp0x3console-base0x2LogViewer!1535651776|1_logFile/0x3home0x3super0x3bin0x3geronimo-tomcat6-javaee5-20x210x3var0x3log0x3geronimo0x2log/__rp0x3console-base0x2LogViewer!1535651776|1_action/search/__rp0x3console-base0x2LogViewer!1535651776|1_logLevel/TRACE/__rp0x3console-base0x2LogViewer!1535651776|1_maxRows/50
84400:  23:50:38,945 DEBUG [AuthenticatorBase] We have cached auth
type FORM for principal
org.apache.geronimo.tomcat.JAASTomcatPrincipal@194a7fb
84401:  23:50:38,945 DEBUG [AuthenticatorBase] Calling hasUserDataPermission()
84402:  23:50:38,945 DEBUG [AuthenticatorBase] Calling authenticate()
84403:  23:50:38,945 DEBUG [FormAuthenticator] Already authenticated 'system'
84404:  23:50:38,946 DEBUG [AuthenticatorBase] Calling accessControl()
84405:  23:50:38,946 DEBUG [AuthenticatorBase] Successfully passed all
security constraints
84406:  23:50:38,946 TRACE [StandardWrapper] Returning non-STM instance
84407:  23:50:38,946 TRACE [StandardWrapper] Returning non-STM instance
84408:  23:50:38,947 TRACE [StandardWrapper] Returning non-STM instance
84409:  23:50:39,129 TRACE [StandardWrapper] Returning non-STM instance
84410:  23:50:39,130 TRACE [StandardWrapper] Returning non-STM instance
84411:  23:50:39,131 TRACE [StandardWrapper] Returning non-STM instance
84412:  23:50:39,132 INFO [SupportedModesServiceImpl] Portlet mode
'edit' not found for portletId:
'/console-base.LogManager!1535651776|0'
84413:  23:50:39,140 TRACE [StandardWrapper] Returning non-STM instance
84414:  23:50:39,146 TRACE [StandardWrapper] Returning non-STM instance




On Tue, Apr 8, 2008 at 3:25 AM, David Blevins <da...@visi.com> wrote:
>
>  On Apr 7, 2008, at 8:36 AM, CG wrote:
>
> > Hi all,
> > After googling again,  I have solved the problem by changing the
> > jndi.properties , localhost:4201 to 127.0.0.1:4201.
> >
>
>  You can use "localhost" as a host, you just need to add
> "ejbd://localhost:4201" due to the way URIs are parsed.  In the openejb 3.0
> final up for a vote now, we check your provider url string a bit more before
> giving it to java.net.URI and make corrections.
>
>
>
> > After solving that , another problem coming up , I still need time to
> > do more searching.
> >
>
>  Happy to help when you get the details.
>
>  -David
>
>
>
>
> >
> >
> > CG
> >
> > On Mon, Apr 7, 2008 at 9:29 PM, CG <le...@gmail.com> wrote:
> >
> > > Forget to attach the error message in the previous mail, here it is.
> > >
> > > Error
> > > ====
> > > javax.naming.AuthenticationException: Cannot connect to server
> > > 'localhost:4201"; nested exception is:
> > >       java.io.IOException: Cannot  connect to server: 'localhost:4201'
> due
> > > to an unkown exception in the OpenEJB client:
> > > java.lang.IllegalArgumentException : port out of range:-1
> > >       at
> org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
> > >       at
> org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
> > >       at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
> > >
> > >       at
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
> > >       at javax.naming.InitialContext.init(InitialContext.java:223)
> > >       at javax.naming.InitialContext.<init>(InitialContext.java:175)
> > >       at
> test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
> > > Exception in thread "main" java.lang.RuntimeException:
> > > javax.naming.AuthenticationException: Cannot connect to server
> > > 'localhost:4201"; nested exception is:
> > >       java.io.IOException: Cannot  connect to server: 'localhost:4201'
> due
> > > to an unkown exception in the OpenEJB client:
> > > java.lang.IllegalArgumentException : port out of range:-1
> > >       at
> test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:50)
> > > Caused by: javax.naming.AuthenticationException: Cannot connect to
> > > server 'localhost:4201"; nested exception is:
> > >       java.io.IOException: Cannot  connect to server: 'localhost:4201'
> due
> > > to an unkown exception in the OpenEJB client:
> > > java.lang.IllegalArgumentException : port out of range:-1
> > >       at
> org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
> > >       at
> org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
> > >       at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
> > >
> > >       at
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
> > >       at javax.naming.InitialContext.init(InitialContext.java:223)
> > >       at javax.naming.InitialContext.<init>(InitialContext.java:175)
> > >       at
> test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
> > >
> > >
> > >
> > >
> > >
> > >
> > > On Mon, Apr 7, 2008 at 9:19 PM, CG <le...@gmail.com> wrote:
> > >
> > > > Hi all,
> > > > I have managed to add the appropriate library but encounter another
> problem.
> > > >
> > > > It seems like port 4201 does not have the JNDI provider service
> running.
> > > >
> > > > May I know whether geronimo built-in with JNDI provider service or
> not?
> > > > I noticed that there is LDAP service (which can be a JNDI provider
> > > > service to my understanding)running at port 1389  , and I tried to
> > > > change the jndi.properties to connect to port 1389 instead , however,
> > > > no luck , error still persist.
> > > >
> > > > any idea ?
> > > >
> > > > Thanks in advanced.
> > > >
> > > > CG
> > > >
> > > >
> > > >
> > > >
> > > > On Mon, Apr 7, 2008 at 7:56 PM, CG <le...@gmail.com> wrote:
> > > >
> > > > > thanks david.
> > > > >
> > > > > I just wonder how do I add those libraries in the classpath in
> eclipse
> > > > > ? Is it going to Build path > add external jar ?
> > > > >
> > > > > Isn't the GEP have added those thing automatically ?
> > > > >
> > > > > thanks for your patient  to guide a newbie of Java & eclipse.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On Sun, Apr 6, 2008 at 11:21 PM, David Jencks
> <da...@yahoo.com> wrote:
> > > > >
> > > > > > The library you need in your client classpath is at
> > > > > >
> > > > > >
> repository/org/apache/openejb/openejb-client/*/openejb-client-*.jar
> > > > > >
> > > > > > thanks
> > > > > > david jencks
> > > > > >
> > > > > >
> > > > > >
> > > > > > On Apr 6, 2008, at 7:53 AM, CG wrote:
> > > > > >
> > > > > >
> > > > > >
> > > > > > > Hi, I am facing problem in using JNDI to do lookup. I have tried
> to
> > > > > > > solve several problem using google before hitting this
> > > > > > >
> > > > > > > I have materialType.properties and jndi.properties file deployed
> in
> > > > > > >
> > > > > > geronimo
> > > > > >
> > > > > > >
> > > > > > > materialType.properties
> > > > > > > ================
> > > > > > > jndi.process.ejb = java:comp/env/ejb/MaterialTestBean
> > > > > > >
> > > > > > > jndi.properties
> > > > > > > ============
> > > > > > >
> java.naming.factory.initial=org.openejb.client.RemoteInitialContextFactory
> > > > > > > java.naming.provider.url=localhost:4201
> > > > > > > java.naming.security.principal=system
> > > > > > > java.naming.security.credentials=manager
> > > > > > >
> > > > > > >
> > > > > > > The problem I face seems like not able to find the class
> > > > > > > org.openejb.client.RemoteInitialContextFactory .
> > > > > > > I think the reason should be openejb library missing or invalid
> but I
> > > > > > > can't figure out where the openejb library in geronimo ..
> > > > > > > Any help is appreciated , thanks.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > Error msg
> > > > > > > =========
> > > > > > >
> > > > > > > javax.naming.NoInitialContextException: Cannot instantiate
> class:
> > > > > > > org.openejb.client.RemoteInitialContextFactory [Root exception
> is
> > > > > > > java.lang.ClassNotFoundException:
> > > > > > > org.openejb.client.RemoteInitialContextFactory]
> > > > > > >      at
> > > > > > >
> > > > > >
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
> > > > > >
> > > > > > >      at
> > > > > > >
> > > > > >
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
> > > > > >
> > > > > > >      at
> javax.naming.InitialContext.init(InitialContext.java:223)
> > > > > > >      at
> javax.naming.InitialContext.<init>(InitialContext.java:175)
> > > > > > >      at
> > > > > > >
> > > > > >
> test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
> > > > > >
> > > > > > > Caused by: java.lang.ClassNotFoundException:
> > > > > > > org.openejb.client.RemoteInitialContextFactory
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > <more codes>
> > > > > > > ::
> > > > > > >              InitialContext context;
> > > > > > >              MaterialTestBeanRemote beanRemote = null;
> > > > > > >              ResourceBundle      bundle = null;
> > > > > > >
> > > > > > >            bundle = ResourceBundle.getBundle("materialType",
> > > > > > > Locale.getDefault(),
> FirstEJB3TutorialClient.class.getClassLoader());
> > > > > > >            String jndiName =
> bundle.getString("jndi.process.ejb");
> > > > > > >              try
> > > > > > >              {
> > > > > > >                       context = new InitialContext();
> > > > > > >                       beanRemote = (MaterialTestBeanRemote)
> > > > > > > context.lookup(MaterialTestBean.RemoteJNDIName);
> > > > > > >                       beanRemote.testMaterial();
> > > > > > >                       beanRemote.testMaterialType();
> > > > > > >             }
> > > > > > >
> > > > > > > <more codes>
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>

Re: problem JNDI lookup in geronimo

Posted by David Blevins <da...@visi.com>.
On Apr 7, 2008, at 8:36 AM, CG wrote:
> Hi all,
> After googling again,  I have solved the problem by changing the
> jndi.properties , localhost:4201 to 127.0.0.1:4201.

You can use "localhost" as a host, you just need to add "ejbd:// 
localhost:4201" due to the way URIs are parsed.  In the openejb 3.0  
final up for a vote now, we check your provider url string a bit more  
before giving it to java.net.URI and make corrections.

> After solving that , another problem coming up , I still need time to
> do more searching.

Happy to help when you get the details.

-David

>
>
> CG
>
> On Mon, Apr 7, 2008 at 9:29 PM, CG <le...@gmail.com> wrote:
>> Forget to attach the error message in the previous mail, here it is.
>>
>> Error
>> ====
>> javax.naming.AuthenticationException: Cannot connect to server
>> 'localhost:4201"; nested exception is:
>>        java.io.IOException: Cannot  connect to server: 'localhost: 
>> 4201' due
>> to an unkown exception in the OpenEJB client:
>> java.lang.IllegalArgumentException : port out of range:-1
>>        at  
>> org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java: 
>> 150)
>>        at  
>> org 
>> .apache 
>> .openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>>        at  
>> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java: 
>> 667)
>>
>>        at  
>> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java: 
>> 288)
>>        at javax.naming.InitialContext.init(InitialContext.java:223)
>>        at javax.naming.InitialContext.<init>(InitialContext.java:175)
>>        at  
>> test 
>> .com 
>> .quesofttech 
>> .FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
>> Exception in thread "main" java.lang.RuntimeException:
>> javax.naming.AuthenticationException: Cannot connect to server
>> 'localhost:4201"; nested exception is:
>>        java.io.IOException: Cannot  connect to server: 'localhost: 
>> 4201' due
>> to an unkown exception in the OpenEJB client:
>> java.lang.IllegalArgumentException : port out of range:-1
>>        at  
>> test 
>> .com 
>> .quesofttech 
>> .FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:50)
>> Caused by: javax.naming.AuthenticationException: Cannot connect to
>> server 'localhost:4201"; nested exception is:
>>        java.io.IOException: Cannot  connect to server: 'localhost: 
>> 4201' due
>> to an unkown exception in the OpenEJB client:
>> java.lang.IllegalArgumentException : port out of range:-1
>>        at  
>> org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java: 
>> 150)
>>        at  
>> org 
>> .apache 
>> .openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>>        at  
>> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java: 
>> 667)
>>
>>        at  
>> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java: 
>> 288)
>>        at javax.naming.InitialContext.init(InitialContext.java:223)
>>        at javax.naming.InitialContext.<init>(InitialContext.java:175)
>>        at  
>> test 
>> .com 
>> .quesofttech 
>> .FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
>>
>>
>>
>>
>>
>>
>> On Mon, Apr 7, 2008 at 9:19 PM, CG <le...@gmail.com> wrote:
>>> Hi all,
>>> I have managed to add the appropriate library but encounter  
>>> another problem.
>>>
>>> It seems like port 4201 does not have the JNDI provider service  
>>> running.
>>>
>>> May I know whether geronimo built-in with JNDI provider service or  
>>> not?
>>> I noticed that there is LDAP service (which can be a JNDI provider
>>> service to my understanding)running at port 1389  , and I tried to
>>> change the jndi.properties to connect to port 1389 instead ,  
>>> however,
>>> no luck , error still persist.
>>>
>>> any idea ?
>>>
>>> Thanks in advanced.
>>>
>>> CG
>>>
>>>
>>>
>>>
>>> On Mon, Apr 7, 2008 at 7:56 PM, CG <le...@gmail.com> wrote:
>>>> thanks david.
>>>>
>>>> I just wonder how do I add those libraries in the classpath in  
>>>> eclipse
>>>> ? Is it going to Build path > add external jar ?
>>>>
>>>> Isn't the GEP have added those thing automatically ?
>>>>
>>>> thanks for your patient  to guide a newbie of Java & eclipse.
>>>>
>>>>
>>>>
>>>>
>>>> On Sun, Apr 6, 2008 at 11:21 PM, David Jencks <david_jencks@yahoo.com 
>>>> > wrote:
>>>>> The library you need in your client classpath is at
>>>>>
>>>>> repository/org/apache/openejb/openejb-client/*/openejb-client- 
>>>>> *.jar
>>>>>
>>>>> thanks
>>>>> david jencks
>>>>>
>>>>>
>>>>>
>>>>> On Apr 6, 2008, at 7:53 AM, CG wrote:
>>>>>
>>>>>
>>>>>> Hi, I am facing problem in using JNDI to do lookup. I have  
>>>>>> tried to
>>>>>> solve several problem using google before hitting this
>>>>>>
>>>>>> I have materialType.properties and jndi.properties file  
>>>>>> deployed in
>>>>> geronimo
>>>>>>
>>>>>> materialType.properties
>>>>>> ================
>>>>>> jndi.process.ejb = java:comp/env/ejb/MaterialTestBean
>>>>>>
>>>>>> jndi.properties
>>>>>> ============
>>>>>> java 
>>>>>> .naming 
>>>>>> .factory.initial=org.openejb.client.RemoteInitialContextFactory
>>>>>> java.naming.provider.url=localhost:4201
>>>>>> java.naming.security.principal=system
>>>>>> java.naming.security.credentials=manager
>>>>>>
>>>>>>
>>>>>> The problem I face seems like not able to find the class
>>>>>> org.openejb.client.RemoteInitialContextFactory .
>>>>>> I think the reason should be openejb library missing or invalid  
>>>>>> but I
>>>>>> can't figure out where the openejb library in geronimo ..
>>>>>> Any help is appreciated , thanks.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Error msg
>>>>>> =========
>>>>>>
>>>>>> javax.naming.NoInitialContextException: Cannot instantiate class:
>>>>>> org.openejb.client.RemoteInitialContextFactory [Root exception is
>>>>>> java.lang.ClassNotFoundException:
>>>>>> org.openejb.client.RemoteInitialContextFactory]
>>>>>>       at
>>>>> javax 
>>>>> .naming.spi.NamingManager.getInitialContext(NamingManager.java: 
>>>>> 657)
>>>>>>       at
>>>>> javax 
>>>>> .naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>>>>>>       at javax.naming.InitialContext.init(InitialContext.java: 
>>>>>> 223)
>>>>>>       at javax.naming.InitialContext.<init>(InitialContext.java: 
>>>>>> 175)
>>>>>>       at
>>>>> test 
>>>>> .com 
>>>>> .quesofttech 
>>>>> .FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
>>>>>> Caused by: java.lang.ClassNotFoundException:
>>>>>> org.openejb.client.RemoteInitialContextFactory
>>>>>>
>>>>>>
>>>>>>
>>>>>> <more codes>
>>>>>> ::
>>>>>>               InitialContext context;
>>>>>>               MaterialTestBeanRemote beanRemote = null;
>>>>>>               ResourceBundle      bundle = null;
>>>>>>
>>>>>>             bundle = ResourceBundle.getBundle("materialType",
>>>>>> Locale.getDefault(),  
>>>>>> FirstEJB3TutorialClient.class.getClassLoader());
>>>>>>             String jndiName =  
>>>>>> bundle.getString("jndi.process.ejb");
>>>>>>               try
>>>>>>               {
>>>>>>                        context = new InitialContext();
>>>>>>                        beanRemote = (MaterialTestBeanRemote)
>>>>>> context.lookup(MaterialTestBean.RemoteJNDIName);
>>>>>>                        beanRemote.testMaterial();
>>>>>>                        beanRemote.testMaterialType();
>>>>>>              }
>>>>>>
>>>>>> <more codes>
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>


Re: problem JNDI lookup in geronimo

Posted by CG <le...@gmail.com>.
Hi all,
 After googling again,  I have solved the problem by changing the
jndi.properties , localhost:4201 to 127.0.0.1:4201.

After solving that , another problem coming up , I still need time to
do more searching.

CG

On Mon, Apr 7, 2008 at 9:29 PM, CG <le...@gmail.com> wrote:
> Forget to attach the error message in the previous mail, here it is.
>
>  Error
>  ====
>  javax.naming.AuthenticationException: Cannot connect to server
>  'localhost:4201"; nested exception is:
>         java.io.IOException: Cannot  connect to server: 'localhost:4201' due
>  to an unkown exception in the OpenEJB client:
>  java.lang.IllegalArgumentException : port out of range:-1
>         at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
>         at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>
>         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>         at javax.naming.InitialContext.init(InitialContext.java:223)
>         at javax.naming.InitialContext.<init>(InitialContext.java:175)
>         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
>  Exception in thread "main" java.lang.RuntimeException:
>  javax.naming.AuthenticationException: Cannot connect to server
>  'localhost:4201"; nested exception is:
>         java.io.IOException: Cannot  connect to server: 'localhost:4201' due
>  to an unkown exception in the OpenEJB client:
>  java.lang.IllegalArgumentException : port out of range:-1
>         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:50)
>  Caused by: javax.naming.AuthenticationException: Cannot connect to
>  server 'localhost:4201"; nested exception is:
>         java.io.IOException: Cannot  connect to server: 'localhost:4201' due
>  to an unkown exception in the OpenEJB client:
>  java.lang.IllegalArgumentException : port out of range:-1
>         at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
>         at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
>         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
>
>         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>         at javax.naming.InitialContext.init(InitialContext.java:223)
>         at javax.naming.InitialContext.<init>(InitialContext.java:175)
>         at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
>
>
>
>
>
>
> On Mon, Apr 7, 2008 at 9:19 PM, CG <le...@gmail.com> wrote:
>  > Hi all,
>  >  I have managed to add the appropriate library but encounter another problem.
>  >
>  >  It seems like port 4201 does not have the JNDI provider service running.
>  >
>  >  May I know whether geronimo built-in with JNDI provider service or not?
>  >  I noticed that there is LDAP service (which can be a JNDI provider
>  >  service to my understanding)running at port 1389  , and I tried to
>  >  change the jndi.properties to connect to port 1389 instead , however,
>  >  no luck , error still persist.
>  >
>  >  any idea ?
>  >
>  >  Thanks in advanced.
>  >
>  >  CG
>  >
>  >
>  >
>  >
>  >  On Mon, Apr 7, 2008 at 7:56 PM, CG <le...@gmail.com> wrote:
>  >  > thanks david.
>  >  >
>  >  >  I just wonder how do I add those libraries in the classpath in eclipse
>  >  >  ? Is it going to Build path > add external jar ?
>  >  >
>  >  >  Isn't the GEP have added those thing automatically ?
>  >  >
>  >  >  thanks for your patient  to guide a newbie of Java & eclipse.
>  >  >
>  >  >
>  >  >
>  >  >
>  >  >  On Sun, Apr 6, 2008 at 11:21 PM, David Jencks <da...@yahoo.com> wrote:
>  >  >  > The library you need in your client classpath is at
>  >  >  >
>  >  >  >  repository/org/apache/openejb/openejb-client/*/openejb-client-*.jar
>  >  >  >
>  >  >  >  thanks
>  >  >  >  david jencks
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >  >  On Apr 6, 2008, at 7:53 AM, CG wrote:
>  >  >  >
>  >  >  >
>  >  >  > > Hi, I am facing problem in using JNDI to do lookup. I have tried to
>  >  >  > > solve several problem using google before hitting this
>  >  >  > >
>  >  >  > > I have materialType.properties and jndi.properties file deployed in
>  >  >  > geronimo
>  >  >  > >
>  >  >  > > materialType.properties
>  >  >  > > ================
>  >  >  > > jndi.process.ejb = java:comp/env/ejb/MaterialTestBean
>  >  >  > >
>  >  >  > > jndi.properties
>  >  >  > > ============
>  >  >  > > java.naming.factory.initial=org.openejb.client.RemoteInitialContextFactory
>  >  >  > > java.naming.provider.url=localhost:4201
>  >  >  > > java.naming.security.principal=system
>  >  >  > > java.naming.security.credentials=manager
>  >  >  > >
>  >  >  > >
>  >  >  > > The problem I face seems like not able to find the class
>  >  >  > > org.openejb.client.RemoteInitialContextFactory .
>  >  >  > > I think the reason should be openejb library missing or invalid but I
>  >  >  > > can't figure out where the openejb library in geronimo ..
>  >  >  > > Any help is appreciated , thanks.
>  >  >  > >
>  >  >  > >
>  >  >  > >
>  >  >  > > Error msg
>  >  >  > > =========
>  >  >  > >
>  >  >  > > javax.naming.NoInitialContextException: Cannot instantiate class:
>  >  >  > > org.openejb.client.RemoteInitialContextFactory [Root exception is
>  >  >  > > java.lang.ClassNotFoundException:
>  >  >  > > org.openejb.client.RemoteInitialContextFactory]
>  >  >  > >        at
>  >  >  > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
>  >  >  > >        at
>  >  >  > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >  >  > >        at javax.naming.InitialContext.init(InitialContext.java:223)
>  >  >  > >        at javax.naming.InitialContext.<init>(InitialContext.java:175)
>  >  >  > >        at
>  >  >  > test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
>  >  >  > > Caused by: java.lang.ClassNotFoundException:
>  >  >  > > org.openejb.client.RemoteInitialContextFactory
>  >  >  > >
>  >  >  > >
>  >  >  > >
>  >  >  > > <more codes>
>  >  >  > >  ::
>  >  >  > >                InitialContext context;
>  >  >  > >                MaterialTestBeanRemote beanRemote = null;
>  >  >  > >                ResourceBundle      bundle = null;
>  >  >  > >
>  >  >  > >              bundle = ResourceBundle.getBundle("materialType",
>  >  >  > > Locale.getDefault(), FirstEJB3TutorialClient.class.getClassLoader());
>  >  >  > >              String jndiName = bundle.getString("jndi.process.ejb");
>  >  >  > >                try
>  >  >  > >                {
>  >  >  > >                         context = new InitialContext();
>  >  >  > >                         beanRemote = (MaterialTestBeanRemote)
>  >  >  > > context.lookup(MaterialTestBean.RemoteJNDIName);
>  >  >  > >                         beanRemote.testMaterial();
>  >  >  > >                         beanRemote.testMaterialType();
>  >  >  > >               }
>  >  >  > >
>  >  >  > >  <more codes>
>  >  >  > >
>  >  >  >
>  >  >  >
>  >  >
>  >
>

Re: problem JNDI lookup in geronimo

Posted by CG <le...@gmail.com>.
Forget to attach the error message in the previous mail, here it is.

Error
====
javax.naming.AuthenticationException: Cannot connect to server
'localhost:4201"; nested exception is:
	java.io.IOException: Cannot  connect to server: 'localhost:4201' due
to an unkown exception in the OpenEJB client:
java.lang.IllegalArgumentException : port out of range:-1
	at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
	at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
	at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
	at javax.naming.InitialContext.init(InitialContext.java:223)
	at javax.naming.InitialContext.<init>(InitialContext.java:175)
	at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
Exception in thread "main" java.lang.RuntimeException:
javax.naming.AuthenticationException: Cannot connect to server
'localhost:4201"; nested exception is:
	java.io.IOException: Cannot  connect to server: 'localhost:4201' due
to an unkown exception in the OpenEJB client:
java.lang.IllegalArgumentException : port out of range:-1
	at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:50)
Caused by: javax.naming.AuthenticationException: Cannot connect to
server 'localhost:4201"; nested exception is:
	java.io.IOException: Cannot  connect to server: 'localhost:4201' due
to an unkown exception in the OpenEJB client:
java.lang.IllegalArgumentException : port out of range:-1
	at org.apache.openejb.client.JNDIContext.authenticate(JNDIContext.java:150)
	at org.apache.openejb.client.JNDIContext.getInitialContext(JNDIContext.java:131)
	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
	at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
	at javax.naming.InitialContext.init(InitialContext.java:223)
	at javax.naming.InitialContext.<init>(InitialContext.java:175)
	at test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)




On Mon, Apr 7, 2008 at 9:19 PM, CG <le...@gmail.com> wrote:
> Hi all,
>  I have managed to add the appropriate library but encounter another problem.
>
>  It seems like port 4201 does not have the JNDI provider service running.
>
>  May I know whether geronimo built-in with JNDI provider service or not?
>  I noticed that there is LDAP service (which can be a JNDI provider
>  service to my understanding)running at port 1389  , and I tried to
>  change the jndi.properties to connect to port 1389 instead , however,
>  no luck , error still persist.
>
>  any idea ?
>
>  Thanks in advanced.
>
>  CG
>
>
>
>
>  On Mon, Apr 7, 2008 at 7:56 PM, CG <le...@gmail.com> wrote:
>  > thanks david.
>  >
>  >  I just wonder how do I add those libraries in the classpath in eclipse
>  >  ? Is it going to Build path > add external jar ?
>  >
>  >  Isn't the GEP have added those thing automatically ?
>  >
>  >  thanks for your patient  to guide a newbie of Java & eclipse.
>  >
>  >
>  >
>  >
>  >  On Sun, Apr 6, 2008 at 11:21 PM, David Jencks <da...@yahoo.com> wrote:
>  >  > The library you need in your client classpath is at
>  >  >
>  >  >  repository/org/apache/openejb/openejb-client/*/openejb-client-*.jar
>  >  >
>  >  >  thanks
>  >  >  david jencks
>  >  >
>  >  >
>  >  >
>  >  >  On Apr 6, 2008, at 7:53 AM, CG wrote:
>  >  >
>  >  >
>  >  > > Hi, I am facing problem in using JNDI to do lookup. I have tried to
>  >  > > solve several problem using google before hitting this
>  >  > >
>  >  > > I have materialType.properties and jndi.properties file deployed in
>  >  > geronimo
>  >  > >
>  >  > > materialType.properties
>  >  > > ================
>  >  > > jndi.process.ejb = java:comp/env/ejb/MaterialTestBean
>  >  > >
>  >  > > jndi.properties
>  >  > > ============
>  >  > > java.naming.factory.initial=org.openejb.client.RemoteInitialContextFactory
>  >  > > java.naming.provider.url=localhost:4201
>  >  > > java.naming.security.principal=system
>  >  > > java.naming.security.credentials=manager
>  >  > >
>  >  > >
>  >  > > The problem I face seems like not able to find the class
>  >  > > org.openejb.client.RemoteInitialContextFactory .
>  >  > > I think the reason should be openejb library missing or invalid but I
>  >  > > can't figure out where the openejb library in geronimo ..
>  >  > > Any help is appreciated , thanks.
>  >  > >
>  >  > >
>  >  > >
>  >  > > Error msg
>  >  > > =========
>  >  > >
>  >  > > javax.naming.NoInitialContextException: Cannot instantiate class:
>  >  > > org.openejb.client.RemoteInitialContextFactory [Root exception is
>  >  > > java.lang.ClassNotFoundException:
>  >  > > org.openejb.client.RemoteInitialContextFactory]
>  >  > >        at
>  >  > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
>  >  > >        at
>  >  > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  >  > >        at javax.naming.InitialContext.init(InitialContext.java:223)
>  >  > >        at javax.naming.InitialContext.<init>(InitialContext.java:175)
>  >  > >        at
>  >  > test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
>  >  > > Caused by: java.lang.ClassNotFoundException:
>  >  > > org.openejb.client.RemoteInitialContextFactory
>  >  > >
>  >  > >
>  >  > >
>  >  > > <more codes>
>  >  > >  ::
>  >  > >                InitialContext context;
>  >  > >                MaterialTestBeanRemote beanRemote = null;
>  >  > >                ResourceBundle      bundle = null;
>  >  > >
>  >  > >              bundle = ResourceBundle.getBundle("materialType",
>  >  > > Locale.getDefault(), FirstEJB3TutorialClient.class.getClassLoader());
>  >  > >              String jndiName = bundle.getString("jndi.process.ejb");
>  >  > >                try
>  >  > >                {
>  >  > >                         context = new InitialContext();
>  >  > >                         beanRemote = (MaterialTestBeanRemote)
>  >  > > context.lookup(MaterialTestBean.RemoteJNDIName);
>  >  > >                         beanRemote.testMaterial();
>  >  > >                         beanRemote.testMaterialType();
>  >  > >               }
>  >  > >
>  >  > >  <more codes>
>  >  > >
>  >  >
>  >  >
>  >
>

Re: problem JNDI lookup in geronimo

Posted by CG <le...@gmail.com>.
Hi all,
I have managed to add the appropriate library but encounter another problem.

It seems like port 4201 does not have the JNDI provider service running.

May I know whether geronimo built-in with JNDI provider service or not?
I noticed that there is LDAP service (which can be a JNDI provider
service to my understanding)running at port 1389  , and I tried to
change the jndi.properties to connect to port 1389 instead , however,
no luck , error still persist.

any idea ?

Thanks in advanced.

CG


On Mon, Apr 7, 2008 at 7:56 PM, CG <le...@gmail.com> wrote:
> thanks david.
>
>  I just wonder how do I add those libraries in the classpath in eclipse
>  ? Is it going to Build path > add external jar ?
>
>  Isn't the GEP have added those thing automatically ?
>
>  thanks for your patient  to guide a newbie of Java & eclipse.
>
>
>
>
>  On Sun, Apr 6, 2008 at 11:21 PM, David Jencks <da...@yahoo.com> wrote:
>  > The library you need in your client classpath is at
>  >
>  >  repository/org/apache/openejb/openejb-client/*/openejb-client-*.jar
>  >
>  >  thanks
>  >  david jencks
>  >
>  >
>  >
>  >  On Apr 6, 2008, at 7:53 AM, CG wrote:
>  >
>  >
>  > > Hi, I am facing problem in using JNDI to do lookup. I have tried to
>  > > solve several problem using google before hitting this
>  > >
>  > > I have materialType.properties and jndi.properties file deployed in
>  > geronimo
>  > >
>  > > materialType.properties
>  > > ================
>  > > jndi.process.ejb = java:comp/env/ejb/MaterialTestBean
>  > >
>  > > jndi.properties
>  > > ============
>  > > java.naming.factory.initial=org.openejb.client.RemoteInitialContextFactory
>  > > java.naming.provider.url=localhost:4201
>  > > java.naming.security.principal=system
>  > > java.naming.security.credentials=manager
>  > >
>  > >
>  > > The problem I face seems like not able to find the class
>  > > org.openejb.client.RemoteInitialContextFactory .
>  > > I think the reason should be openejb library missing or invalid but I
>  > > can't figure out where the openejb library in geronimo ..
>  > > Any help is appreciated , thanks.
>  > >
>  > >
>  > >
>  > > Error msg
>  > > =========
>  > >
>  > > javax.naming.NoInitialContextException: Cannot instantiate class:
>  > > org.openejb.client.RemoteInitialContextFactory [Root exception is
>  > > java.lang.ClassNotFoundException:
>  > > org.openejb.client.RemoteInitialContextFactory]
>  > >        at
>  > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
>  > >        at
>  > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
>  > >        at javax.naming.InitialContext.init(InitialContext.java:223)
>  > >        at javax.naming.InitialContext.<init>(InitialContext.java:175)
>  > >        at
>  > test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
>  > > Caused by: java.lang.ClassNotFoundException:
>  > > org.openejb.client.RemoteInitialContextFactory
>  > >
>  > >
>  > >
>  > > <more codes>
>  > >  ::
>  > >                InitialContext context;
>  > >                MaterialTestBeanRemote beanRemote = null;
>  > >                ResourceBundle      bundle = null;
>  > >
>  > >              bundle = ResourceBundle.getBundle("materialType",
>  > > Locale.getDefault(), FirstEJB3TutorialClient.class.getClassLoader());
>  > >              String jndiName = bundle.getString("jndi.process.ejb");
>  > >                try
>  > >                {
>  > >                         context = new InitialContext();
>  > >                         beanRemote = (MaterialTestBeanRemote)
>  > > context.lookup(MaterialTestBean.RemoteJNDIName);
>  > >                         beanRemote.testMaterial();
>  > >                         beanRemote.testMaterialType();
>  > >               }
>  > >
>  > >  <more codes>
>  > >
>  >
>  >
>

Re: problem JNDI lookup in geronimo

Posted by CG <le...@gmail.com>.
thanks david.

I just wonder how do I add those libraries in the classpath in eclipse
? Is it going to Build path > add external jar ?

Isn't the GEP have added those thing automatically ?

thanks for your patient  to guide a newbie of Java & eclipse.


On Sun, Apr 6, 2008 at 11:21 PM, David Jencks <da...@yahoo.com> wrote:
> The library you need in your client classpath is at
>
>  repository/org/apache/openejb/openejb-client/*/openejb-client-*.jar
>
>  thanks
>  david jencks
>
>
>
>  On Apr 6, 2008, at 7:53 AM, CG wrote:
>
>
> > Hi, I am facing problem in using JNDI to do lookup. I have tried to
> > solve several problem using google before hitting this
> >
> > I have materialType.properties and jndi.properties file deployed in
> geronimo
> >
> > materialType.properties
> > ================
> > jndi.process.ejb = java:comp/env/ejb/MaterialTestBean
> >
> > jndi.properties
> > ============
> > java.naming.factory.initial=org.openejb.client.RemoteInitialContextFactory
> > java.naming.provider.url=localhost:4201
> > java.naming.security.principal=system
> > java.naming.security.credentials=manager
> >
> >
> > The problem I face seems like not able to find the class
> > org.openejb.client.RemoteInitialContextFactory .
> > I think the reason should be openejb library missing or invalid but I
> > can't figure out where the openejb library in geronimo ..
> > Any help is appreciated , thanks.
> >
> >
> >
> > Error msg
> > =========
> >
> > javax.naming.NoInitialContextException: Cannot instantiate class:
> > org.openejb.client.RemoteInitialContextFactory [Root exception is
> > java.lang.ClassNotFoundException:
> > org.openejb.client.RemoteInitialContextFactory]
> >        at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
> >        at
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
> >        at javax.naming.InitialContext.init(InitialContext.java:223)
> >        at javax.naming.InitialContext.<init>(InitialContext.java:175)
> >        at
> test.com.quesofttech.FirstEJB3TutorialClient.main(FirstEJB3TutorialClient.java:39)
> > Caused by: java.lang.ClassNotFoundException:
> > org.openejb.client.RemoteInitialContextFactory
> >
> >
> >
> > <more codes>
> >  ::
> >                InitialContext context;
> >                MaterialTestBeanRemote beanRemote = null;
> >                ResourceBundle      bundle = null;
> >
> >              bundle = ResourceBundle.getBundle("materialType",
> > Locale.getDefault(), FirstEJB3TutorialClient.class.getClassLoader());
> >              String jndiName = bundle.getString("jndi.process.ejb");
> >                try
> >                {
> >                         context = new InitialContext();
> >                         beanRemote = (MaterialTestBeanRemote)
> > context.lookup(MaterialTestBean.RemoteJNDIName);
> >                         beanRemote.testMaterial();
> >                         beanRemote.testMaterialType();
> >               }
> >
> >  <more codes>
> >
>
>

Re: problem JNDI lookup in geronimo

Posted by David Jencks <da...@yahoo.com>.
The library you need in your client classpath is at

repository/org/apache/openejb/openejb-client/*/openejb-client-*.jar

thanks
david jencks

On Apr 6, 2008, at 7:53 AM, CG wrote:

> Hi, I am facing problem in using JNDI to do lookup. I have tried to
> solve several problem using google before hitting this
>
> I have materialType.properties and jndi.properties file deployed in  
> geronimo
>
> materialType.properties
> ================
> jndi.process.ejb = java:comp/env/ejb/MaterialTestBean
>
> jndi.properties
> ============
> java.naming.factory.initial=org.openejb.client.RemoteInitialContextFac 
> tory
> java.naming.provider.url=localhost:4201
> java.naming.security.principal=system
> java.naming.security.credentials=manager
>
>
> The problem I face seems like not able to find the class
> org.openejb.client.RemoteInitialContextFactory .
> I think the reason should be openejb library missing or invalid but I
> can't figure out where the openejb library in geronimo ..
> Any help is appreciated , thanks.
>
>
>
> Error msg
> =========
>
> javax.naming.NoInitialContextException: Cannot instantiate class:
> org.openejb.client.RemoteInitialContextFactory [Root exception is
> java.lang.ClassNotFoundException:
> org.openejb.client.RemoteInitialContextFactory]
> 	at javax.naming.spi.NamingManager.getInitialContext 
> (NamingManager.java:657)
> 	at javax.naming.InitialContext.getDefaultInitCtx 
> (InitialContext.java:288)
> 	at javax.naming.InitialContext.init(InitialContext.java:223)
> 	at javax.naming.InitialContext.<init>(InitialContext.java:175)
> 	at test.com.quesofttech.FirstEJB3TutorialClient.main 
> (FirstEJB3TutorialClient.java:39)
> Caused by: java.lang.ClassNotFoundException:
> org.openejb.client.RemoteInitialContextFactory
>
>
>
> <more codes>
>   ::
> 		InitialContext context;
> 		MaterialTestBeanRemote beanRemote = null;
> 		ResourceBundle      bundle = null;
>
> 	      bundle = ResourceBundle.getBundle("materialType",
> Locale.getDefault(), FirstEJB3TutorialClient.class.getClassLoader());
> 	      String jndiName = bundle.getString("jndi.process.ejb");
> 		try
> 		{
> 			 context = new InitialContext();
> 			 beanRemote = (MaterialTestBeanRemote)
> context.lookup(MaterialTestBean.RemoteJNDIName);
> 			 beanRemote.testMaterial();
> 			 beanRemote.testMaterialType();
>                }
>
>  <more codes>