• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

how debug a CMP entity error?

 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any particular rule for discover the real problem when i receive a jboss console error?
Error on server or on Ejb? If that on deploy or on code?

The problem is that the report is to big and ununderstandalbe for a beginner as me.

For example now i had an error that i can' t understand. In this report i cannot find refer to my code an so i do not know how to debug.
Somebody could help me?

CMP 2.0 using MyEclipse and JBoss 4.0 and XDoc

 
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

The problem seems to be in JBoss.xml file

ObjectName: jboss.j2ee:jndiName=ejb/Cabin,service=EJB
state: FAILED
I Depend On:
Depends On Me: java.lang.ClassCastException: org.jnp.interfaces.NamingContext



i.e. jndi name of bean has to be just Cabin in Jboss.xml and not ejb/Cabin
 
Marco Vanoli
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem was the jbosscmp-jdbc.xml.
If i delete it the jboss deploy regullary.
The example is tested but i have now a question:
whithout jbosscmp-jdbc.xml the server doesn' t map the database and so it is impossible persistence. Only entity beans are created but they don' save data. Is it right?

my file that give error
 
Damanjit Kaur
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

The problem is not jbosscmp-jdbc.xml file. This file is required to configure EJB container for CMP beans. The problem is in jboss.xml for bean jndi name. The alternative to jbosscmp-jdbc.xml file is standardjbosscmp-jdbc.xml file on server which is not a customised files as the one you are using.
 
Marco Vanoli
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok i understand the cmp config files, if i delete jbosscmp-jdbc.xml from my project is used the default setting.
In this case without jbosscmp-jdbc.xml the project will deploy and i can interrogate the bean using ejb/Cabin JNDI.
So it is a right path.

If i add jbosscmp-jdbc.xml(because i want to use mysql and not hypessonic) the jboss give me the error. So i think it is a problem of the cmp descriptor but i cannot understand where...
 
Damanjit Kaur
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

If i add jbosscmp-jdbc.xml(because i want to use mysql and not hypessonic) the jboss give me the error. So i think it is a problem of the cmp descriptor but i cannot understand where...



Have you defined following in jbosscmp-jdbc.xml file -
<jbosscmp-jdbc>
<defaults>
<datasource>MysqlDS</datasource>
<datasource-mapping>PLEASE_MODIFY_THIS</datasource-mapping>
<preferred-relation-mapping>PLEASE_MODIFY_THIS</preferred-relation-mapping>
</defaults>

and also on jboss server directory in login-config.xml file ( This is optional. )

<application-policy name = "MysqlDbRealm">
<authentication>
<login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule"
flag = "required">
<module-option name = "principal">sa</module-option>
<module-option name = "userName">sa</module-option>
<module-option name = "password"></module-option>
<module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=MysqlDS</module-option>
</login-module>
</authentication>
</application-policy>


Then in mysql-ds.xml or other xml file for mysql in deploy directory -

<!-- Use the security domain defined in conf/login-config.xml -->
<security-domain>MysqlDbRealm</security-domain>

for datasource in same file above -
<datasources>
<local-tx-datasource>
<jndi-name>MysqlDS</jndi-name>
<connection-url>ConnectionStringtoMysqlDatabase</connection-url>
<driver-class>sqlDriverClassName</driver-class>
<user-name>someuser</user-name>
<password>userpassword</password>
<!-- sql to call when connection is created
<new-connection-sql>select * from something</new-connection-sql>

and also have you copied mysql driver file in lib directory of jboss server that you are using in your applicaiton.
 
BWA HA HA HA HA HA HA! Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic