-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Hibernate Not bound - Jboss, JMX Service
PostPosted: Tue Nov 04, 2003 4:30 pm 
Beginner
Beginner

Joined: Tue Nov 04, 2003 2:31 pm
Posts: 28
Location: Florida, US
I am a evaluating Hibernate as part of one Proof Of Concept. I am encountering one problem. I appreciate if someone from the community helps me a way out.

My JMX configuration file is
Code:
<server>
<mbean code="net.sf.hibernate.jmx.HibernateService" name="jboss.jca:service=HibernateFactory, name=HibernateFactory">
    <depends>jboss.jca:service=RARDeployer</depends>
    <!-- Make it deploy ONLY after DataSource had been started -->
    <depends>jboss.jca:service=LocalTxCM,name=jdbc/SybaseDB</depends>
    <attribute name="MapResources">
      mappings/program.hbm.xml
    </attribute>
    <attribute name="JndiName">java:/hibernate/HibernateFactory</attribute>
    <attribute name="Datasource">jdbc/SybaseDB</attribute>
    <attribute name="Dialect">net.sf.hibernate.dialect.SybaseDialect</attribute>
    <attribute name="TransactionStrategy">net.sf.hibernate.transaction.JTATransactionFactory</attribute>
    <attribute name="TransactionManagerLookupStrategy">
        net.sf.hibernate.transaction.JBossTransactionManagerLookup
    </attribute>
    <attribute name="UseOuterJoin">false</attribute>
    <attribute name="ShowSql">false</attribute>
    <attribute name="UserTransactionName">java:/UserTransaction</attribute>
</mbean>
</server>



My Stateless Session bean code is like this
Code:
      Properties props = new Properties();
      props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
      props.setProperty("java.naming.provider.url", "jnp://localhost:1099");
      props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");

      InitialContext ctx = new InitialContext(props);
      Object objref = ctx.lookup("java:/hibernate/HibernateFactory");
      sessionFactory = (SessionFactory)PortableRemoteObject.narrow(objref, SessionFactory.class);

    }
    catch (Exception exc) {
      System.out.println("Exception while creating the session context");
      exc.printStackTrace();
    }
    try {
      Session session = sessionFactory.openSession();
      Transaction transaction = session.beginTransaction();
      session.save(program);
      transaction.commit();
      session.close();
    }
    catch (HibernateException hiberExcep) {
      System.out.println("HibernateException!!!");
    }


This is the stack trace of my error.

Code:
15:22:38,382 INFO  [STDOUT] Exception while creating the session context
15:22:38,382 ERROR [STDERR] javax.naming.NameNotFoundException: hibernate not bo
und
15:22:38,382 ERROR [STDERR]     at org.jnp.server.NamingServer.getBinding(Naming
Server.java:490)
15:22:38,382 ERROR [STDERR]     at org.jnp.server.NamingServer.getBinding(Naming
Server.java:498)
15:22:38,382 ERROR [STDERR]     at org.jnp.server.NamingServer.getObject(NamingS
erver.java:504)
15:22:38,382 ERROR [STDERR]     at org.jnp.server.NamingServer.lookup(NamingServ
er.java:248)
15:22:38,382 ERROR [STDERR]     at org.jnp.interfaces.NamingContext.lookup(Namin
gContext.java:500)
15:22:38,382 ERROR [STDERR]     at org.jnp.interfaces.NamingContext.lookup(Namin
gContext.java:479)
15:22:38,382 ERROR [STDERR]     at javax.naming.InitialContext.lookup(InitialCon
text.java:347)
15:22:38,382 ERROR [STDERR]     at com.nielsenmedia.myEVNTS.server.ProcessEchoEJ
B.createProgram(ProcessEchoEJB.java:50)
15:22:38,382 ERROR [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke0(
Native Method)
15:22:38,382 ERROR [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke(N
ativeMethodAccessorImpl.java:39)
15:22:38,382 ERROR [STDERR]     at sun.reflect.DelegatingMethodAccessorImpl.invo
ke(DelegatingMethodAccessorImpl.java:25)
15:22:38,382 ERROR [STDERR]     at java.lang.reflect.Method.invoke(Method.java:3
24)
15:22:38,382 ERROR [STDERR]     at org.jboss.ejb.StatelessSessionContainer$Conta
inerInterceptor.invoke(StatelessSessionContainer.java:550)
15:22:38,398 ERROR [STDERR]     at org.jboss.resource.connectionmanager.CachedCo
nnectionInterceptor.invoke(CachedConnectionInterceptor.java:114)
15:22:38,398 ERROR [STDERR]     at org.jboss.ejb.plugins.StatelessSessionInstanc
eInterceptor.invoke(StatelessSessionInstanceInterceptor.java:47)
15:22:38,398 ERROR [STDERR]     at org.jboss.ejb.plugins.TxSupport.invokeInOurTx
(TxSupport.java:213)
15:22:38,398 ERROR [STDERR]     at org.jboss.ejb.plugins.TxSupport$Required.serv
erInvoke(TxSupport.java:655)
15:22:38,398 ERROR [STDERR]     at org.jboss.ejb.plugins.TxInterceptorCMT.intern
alInvoke(TxInterceptorCMT.java:104)
15:22:38,398 ERROR [STDERR]     at org.jboss.ejb.plugins.TxInterceptorCMT.invoke
(TxInterceptorCMT.java:56)
15:22:38,398 ERROR [STDERR]     at org.jboss.security.RunAsSecurityInterceptor.i
nvoke(RunAsSecurityInterceptor.java:61)
15:22:38,398 ERROR [STDERR]     at org.jboss.security.RoleBasedAuthorizationInte
rceptor.invoke(RoleBasedAuthorizationInterceptor.java:54)
15:22:38,398 ERROR [STDERR]     at org.jboss.security.AuthenticationInterceptor.
invoke(AuthenticationInterceptor.java:65)
15:22:38,398 ERROR [STDERR]     at org.jboss.ejb.plugins.LogInterceptor.invoke(L
ogInterceptor.java:117)
15:22:38,398 ERROR [STDERR]     at org.jboss.ejb.plugins.ProxyFactoryFinderInter
ceptor.invoke(ProxyFactoryFinderInterceptor.java:102)
15:22:38,398 ERROR [STDERR]     at org.jboss.ejb.Container.invoke(Container.java
:1159)
15:22:38,398 ERROR [STDERR]     at org.jboss.ejb.Container.invoke(Container.java
:1281)
15:22:38,398 ERROR [STDERR]     at org.jboss.mx.server.RawDynamicInvoker.invoke(
RawDynamicInvoker.java:72)
15:22:38,398 ERROR [STDERR]     at org.jboss.mx.server.MBeanServerImpl.invoke(MB
eanServerImpl.java:544)
15:22:38,398 ERROR [STDERR]     at org.jboss.invocation.local.LocalInvoker.invok
e(LocalInvoker.java:90)
15:22:38,398 ERROR [STDERR]     at org.jboss.invocation.InvokerInterceptor.invok
e(InvokerInterceptor.java:89)
15:22:38,398 ERROR [STDERR]     at org.jboss.ejb.plugins.TxSupport$Required.clie
ntInvoke(TxSupport.java:644)
15:22:38,398 ERROR [STDERR]     at org.jboss.proxy.TransactionInterceptor.invoke
(TransactionInterceptor.java:129)
15:22:38,398 ERROR [STDERR]     at org.jboss.proxy.SecurityInterceptor.invoke(Se
curityInterceptor.java:81)
15:22:38,398 ERROR [STDERR]     at org.jboss.proxy.ejb.StatelessSessionIntercept
or.invoke(StatelessSessionInterceptor.java:110)
15:22:38,398 ERROR [STDERR]     at org.jboss.proxy.ClientContainer.invoke(Client
Container.java:84)
15:22:38,398 ERROR [STDERR]     at $Proxy56.createProgram(Unknown Source)
15:22:38,398 ERROR [STDERR]     at org.apache.jsp.RequestProcessor_jsp._jspServi
ce(RequestProcessor_jsp.java:57)
15:22:38,398 ERROR [STDERR]     at org.apache.jasper.runtime.HttpJspBase.service
(HttpJspBase.java:137)
15:22:38,398 ERROR [STDERR]     at javax.servlet.http.HttpServlet.service(HttpSe
rvlet.java:853)
15:22:38,398 ERROR [STDERR]     at org.apache.jasper.servlet.JspServletWrapper.s
ervice(JspServletWrapper.java:210)
15:22:38,398 ERROR [STDERR]     at org.apache.jasper.servlet.JspServlet.serviceJ
spFile(JspServlet.java:295)
15:22:38,398 ERROR [STDERR]     at org.apache.jasper.servlet.JspServlet.service(
JspServlet.java:241)
15:22:38,398 ERROR [STDERR]     at javax.servlet.http.HttpServlet.service(HttpSe
rvlet.java:853)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.ApplicationFilterCha
in.internalDoFilter(ApplicationFilterChain.java:247)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.ApplicationFilterCha
in.doFilter(ApplicationFilterChain.java:193)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.StandardWrapperValve
.invoke(StandardWrapperValve.java:256)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.StandardPipeline$Sta
ndardPipelineValveContext.invokeNext(StandardPipeline.java:643)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.StandardPipeline.inv
oke(StandardPipeline.java:480)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.ContainerBase.invoke
(ContainerBase.java:995)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.StandardContextValve
.invoke(StandardContextValve.java:191)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.StandardPipeline$Sta
ndardPipelineValveContext.invokeNext(StandardPipeline.java:643)
15:22:38,398 ERROR [STDERR]     at org.jboss.web.catalina.security.JBossSecurity
MgrRealm.invoke(JBossSecurityMgrRealm.java:236)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.StandardPipeline$Sta
ndardPipelineValveContext.invokeNext(StandardPipeline.java:641)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.valves.CertificatesValve.
invoke(CertificatesValve.java:246)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.StandardPipeline$Sta
ndardPipelineValveContext.invokeNext(StandardPipeline.java:641)
15:22:38,398 ERROR [STDERR]     at org.jboss.web.catalina.statistics.ContainerSt
atsValve.invoke(ContainerStatsValve.java:75)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.StandardPipeline$Sta
ndardPipelineValveContext.invokeNext(StandardPipeline.java:641)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.StandardPipeline.inv
oke(StandardPipeline.java:480)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.ContainerBase.invoke
(ContainerBase.java:995)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.StandardContext.invo
ke(StandardContext.java:2415)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.StandardHostValve.in
voke(StandardHostValve.java:180)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.StandardPipeline$Sta
ndardPipelineValveContext.invokeNext(StandardPipeline.java:643)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.valves.ErrorDispatcherVal
ve.invoke(ErrorDispatcherValve.java:171)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.StandardPipeline$Sta
ndardPipelineValveContext.invokeNext(StandardPipeline.java:641)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.valves.ErrorReportValve.i
nvoke(ErrorReportValve.java:172)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.StandardPipeline$Sta
ndardPipelineValveContext.invokeNext(StandardPipeline.java:641)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.valves.AccessLogValve.inv
oke(AccessLogValve.java:509)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.StandardPipeline$Sta
ndardPipelineValveContext.invokeNext(StandardPipeline.java:641)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.StandardPipeline.inv
oke(StandardPipeline.java:480)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.ContainerBase.invoke
(ContainerBase.java:995)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.StandardEngineValve.
invoke(StandardEngineValve.java:174)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.StandardPipeline$Sta
ndardPipelineValveContext.invokeNext(StandardPipeline.java:643)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.StandardPipeline.inv
oke(StandardPipeline.java:480)
15:22:38,398 ERROR [STDERR]     at org.apache.catalina.core.ContainerBase.invoke
(ContainerBase.java:995)
15:22:38,398 ERROR [STDERR]     at org.apache.coyote.tomcat4.CoyoteAdapter.servi
ce(CoyoteAdapter.java:223)
15:22:38,398 ERROR [STDERR]     at org.apache.coyote.http11.Http11Processor.proc
ess(Http11Processor.java:594)
15:22:38,398 ERROR [STDERR]     at org.apache.coyote.http11.Http11Protocol$Http1
1ConnectionHandler.processConnection(Http11Protocol.java:392)
15:22:38,398 ERROR [STDERR]     at org.apache.tomcat.util.net.TcpWorkerThread.ru
nIt(PoolTcpEndpoint.java:565)
15:22:38,398 ERROR [STDERR]     at org.apache.tomcat.util.threads.ThreadPool$Con
trolRunnable.run(ThreadPool.java:619)
15:22:38,398 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:534)
15:22:38,398 ERROR [LogInterceptor] RuntimeException:
java.lang.NullPointerException
        at com.nielsenmedia.myEVNTS.server.ProcessEchoEJB.createProgram(ProcessE
choEJB.java:61)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(S
tatelessSessionContainer.java:550)
        at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invo
ke(CachedConnectionInterceptor.java:114)
        at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(Stat
elessSessionInstanceInterceptor.java:47)
        at org.jboss.ejb.plugins.TxSupport.invokeInOurTx(TxSupport.java:213)
        at org.jboss.ejb.plugins.TxSupport$Required.serverInvoke(TxSupport.java:
655)
        at org.jboss.ejb.plugins.TxInterceptorCMT.internalInvoke(TxInterceptorCM
T.java:104)
        at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:5
6)
        at org.jboss.security.RunAsSecurityInterceptor.invoke(RunAsSecurityInter
ceptor.java:61)
        at org.jboss.security.RoleBasedAuthorizationInterceptor.invoke(RoleBased
AuthorizationInterceptor.java:54)
        at org.jboss.security.AuthenticationInterceptor.invoke(AuthenticationInt
erceptor.java:65)
        at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:117)
        at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFacto
ryFinderInterceptor.java:102)
        at org.jboss.ejb.Container.invoke(Container.java:1159)
        at org.jboss.ejb.Container.invoke(Container.java:1281)
        at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:7
2)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:544)
        at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:90)
        at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.jav
a:89)
        at org.jboss.ejb.plugins.TxSupport$Required.clientInvoke(TxSupport.java:
644)
        at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.
java:129)
        at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:8
1)
        at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessi
onInterceptor.java:110)


[/code]


Top
 Profile  
 
 Post subject: SOS
PostPosted: Tue Nov 04, 2003 5:16 pm 
Beginner
Beginner

Joined: Tue Nov 04, 2003 2:31 pm
Posts: 28
Location: Florida, US
Pl help me out. I am struck with this for a long time. I know I must be making some silly mistake.


Top
 Profile  
 
 Post subject: JNDI statuc
PostPosted: Wed Nov 05, 2003 6:23 am 
Newbie

Joined: Tue Nov 04, 2003 12:06 am
Posts: 3
If you are using jboss then you can check the JNDI registry by going to the jmx-console like:

http://127.0.0.1:8080/jmx-console (use your-server-name)

finding the mbean/service named 'JNDIView' and select it

scroll down until you see the function called 'list()' at the bottom.

and check if and where the name is actually registered.

good luck


Top
 Profile  
 
 Post subject: Yet another problem
PostPosted: Thu Nov 06, 2003 3:41 pm 
Beginner
Beginner

Joined: Tue Nov 04, 2003 2:31 pm
Posts: 28
Location: Florida, US
You are correct. The MBean did not get deployed for various reasons.
The change I made is to the jboss-service.xml
It was earlier
<attribute name="Datasource">jdbc/SybaseDB</attribute>
Now I changed it to
<attribute name="Datasource">java:jdbc/SybaseDB</attribute>

As simple as that!!!

Finally, I could get my program running. I tried to persist one object called DistributorProgram. But I am not seeing it in the database. I am just confused. The mapping is as below

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
    PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
    <class name="com.nielsenmedia.myEVNTS.DistributorProgram" table="dist_program">

        <!-- A 32 hex character is our surrogate key. It's automatically
            generated by Hibernate with the UUID pattern. -->
   <id name="programID" type="string" unsaved-value="null" >
            <column name="PROGRAM_ID" sql-type="char(32)" not-null="true"/>
            <generator class="uuid.hex"/>
        </id>


      <!-- A program has to have a name, but it shouldn' be too long. -->
      <property name="programName">
           <column name="PROGRAM_NAME" sql-type="varchar(16)" not-null="true"/>
      </property>

      <!-- A program has to have a name, but it shouldn' be too long. -->
      <property name="duration">
           <column name="PROGRAM_DURATION" sql-type="int" not-null="true"/>
      </property>
    </class>
</hibernate-mapping>

[/code]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.