0 Replies Latest reply on May 12, 2008 12:27 AM by Suren_kancherla

    Log4j versioning problem while accessing Remote EJB

    Suren_kancherla
      Hello All,
      I'm using CF 8. I'm trying to
      access EJBs from jboss4.2.0. And I'm getting this error.
      Could not access a java object field called TRACE.

      I have no problem with CF 8 and jboss4.2. When I did some research on the
      error, it says the issue could be log4j version and it should be later than
      1.2.10. CF 8 comes with 1.2.12 which is valid. I searched in my machine and I
      have 1.2.9 used in cfeclipse but I don't see that in my classpath. I even
      checked in CF admin and that jar file is not in CF server class path as well as
      java class path. So I'm confused. Any help?.

      Error happens in the line where I'm accessing the reference to home object

      Here's my code

      <!--- Create the Context object to get at the static fields. --->
      <CFOBJECT
      action=create
      name=ctx
      type="JAVA"
      class="javax.naming.Context">

      <!--- Create the Properties object and call an explicit constructor--->
      <CFOBJECT
      action=create
      name=prop
      type="JAVA"
      class="java.util.Properties">

      <!--- Call the init method (provided by cfobject)
      to invoke the Properties object constructor. --->
      <cfset prop.init()>

      <!--- Specify the properties These are required for a remote server only --->
      <cfset prop.put(ctx.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory")>
      <cfset prop.put(ctx.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces")>
      <cfset prop.put(ctx.PROVIDER_URL, "jnp://servername:port")>
      <!--- Create the InitialContext --->
      <CFOBJECT
      action=create
      name=initContext
      type="JAVA"
      class="javax.naming.InitialContext">

      <!--- Call the init method (provided through cfobject)
      to pass the properties to the InitialContext constructor. --->
      <cfset initContext.init(prop)>

      <!--- Get reference to home object. --->
      <cfset home = initContext.lookup("TravelAgentBean/remote")>

      <!--- Create new instance of entity bean.
      (hard-wired account number). Alternatively,
      you would use a find method to locate an existing entity bean. --->
      <cfset myMessage = home.create()>



      <!--- Call a method in the entity bean. --->
      <cfset customers = myMessage.getAllCustomers()>

      <cfoutput>
      Record Count is : #customers#<br>
      </cfoutput>

      <!--- Close the context. --->
      <cfset initContext.close()>

      Thanks in Advance,
      Surendra.