[jboss-user] [JNDI and Naming] - What does "Naming context is read-only" mean?

Manabu Yoneyama do-not-reply at jboss.com
Wed Sep 21 22:41:55 EDT 2011


Manabu Yoneyama [http://community.jboss.org/people/amadablam] created the discussion

"What does "Naming context is read-only" mean?"

To view the discussion, visit: http://community.jboss.org/message/627906#627906

--------------------------------------------------------------
I'd like to run a simple web application with Hibernate4 on a JBoss AS7.
But I have an error below.

java.lang.UnsupportedOperationException: Naming context is read-only

I wrote hibernate.cfg.xml (snippet),

<session-factory name="">
  <property name="connection.datasource">java:jboss/datasources/MySQL</property>
  <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
</sessioin-factory>

and source code: 

Configuration config = new Configuration().configure();
SessionFactory sessionFactory = config.buildSessionFactory(); // It might be causes the error.

I can connect datasouce "java:jboss/datasources/MySQL" use below code.

InitialContext context = new InitialContext();
ds = (DataSource)context.lookup("java:jboss/datasources/MySQL");
conn = ds.getConnection();

Does anyone know the reason for this?
Sorry for my english is poor.
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/627906#627906]

Start a new discussion in JNDI and Naming at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2083]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110921/433eb5ad/attachment.html 


More information about the jboss-user mailing list