• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Jboss-seam EJB 3.0 "not bound" error.....

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get this error when I try to persist/query data from DB using Jboss seam EJB 3.0 technologies.

Caused by: javax.naming.NameNotFoundException:GenerateChartFromDBDataAction not bound.

Here is my code:

Here is my bean:

package org.jboss.priscus;

import static org.jboss.seam.ScopeType.SESSION;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;

@Entity
@Name("databean")
@Scope(SESSION)
@Table(name="sarecord")
public class DataBean implements Serializable {

private long id;

private int time;

private int node;

public DataBean(){}

@Id
public long getId() {
return id;
}

public void setId(long id) {
this.id = id;
}

public int getNode() {
return node;
}

public void setNode(int node) {
this.node = node;
}

public int getTime() {
return time;
}

public void setTime(int time) {
this.time = time;
}

}


Here is my action class

package org.jboss.priscus;

import static org.jboss.seam.ScopeType.SESSION;

import java.util.List;

import javax.ejb.Remove;
import javax.ejb.Stateful;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Destroy;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;

@Stateful
@Name("genchartfromdb")
@Scope(SESSION)
public class GenerateChartFromDBDataAction implements GenerateChartFromDBData {

@In @Out
private DataBean databean;

private List<DataBean> listOfBeans;

@PersistenceContext
private EntityManager em;

public String getSomeData() {

try {

em.persist(databean);
find();
}

catch (Exception e) {
e.printStackTrace();
System.out.println("Problem in the GenerateChartFromDBActionclass....");
}
return "chartoutcomefromdbusingejb";

}

@Create
public void find () {
System.out.println("Find called");
listOfBeans = em.createQuery("select * from public.SARECORD")
.getResultList();
}

@Destroy @Remove
public void destroy() {}

}

Here is my interface

package org.jboss.priscus;

import javax.ejb.Local;

@Local
public interface GenerateChartFromDBData {

public String getSomeData();

}

Here is my persistence.xml file

<?xml version="1.0" encoding="UTF-8"?>
<persistence 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"
version="1.0">
<persistence-unit name="Priscus">
<provider>org.jpox.jpa.PersistenceProviderImpl</provider>
<jta-data-source>java:/PostgresDS</jta-data-source>

<class>org.jboss.priscus.DataBean</class>
<class>org.jboss.priscus.GenerateChartFromDBDataAction</class>

<properties>

<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
<property name="hibernate.transaction.flush_before_completion" value="true"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.show_sql" value="true"/>

</properties>
</persistence-unit>
</persistence>

Here is my components.xml file

<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://jboss.com/products/seam/components"
xmlns:core="http://jboss.com/products/seam/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://jboss.com/products/seam/core
http://jboss.com/products/seam/core-1.1.xsd
http://jboss.com/products/seam/components
http://jboss.com/products/seam/components-1.1.xsd">

<core:init jndi-pattern="Priscus/#{ejbName}/local" debug="false"/>

<core:manager conversation-timeout="120000"/>

</components>

Here is my ejb-jar.xml file

<ejb-jar>
<assembly-descriptor>
<interceptor-binding>
<ejb-name>Priscus</ejb-name>
<interceptor-class>
org.jboss.seam.ejb.SeamInterceptor
</interceptor-class>
</interceptor-binding>
</assembly-descriptor>
</ejb-jar>

Here is my postgres-ds.xml file

<?xml version="1.0" encoding="UTF-8"?>

<!-- ===================================================================== -->
<!-- -->
<!-- JBoss Server Configuration -->
<!-- -->
<!-- ===================================================================== -->

<!-- $Id: postgres-ds.xml 41016 2006-02-07 14:23:00Z acoliver $ -->
<!-- ==================================================================== -->
<!-- Datasource config for Postgres -->
<!-- ==================================================================== -->


<datasources>
<local-tx-datasource>
<jndi-name>PostgresDS</jndi-name>
<connection-url>jdbc ostgresql://localhost/DSMNT12</connection-url>;
<driver-class>org.postgresql.Driver</driver-class>
<user-name>postgres</user-name>
<password>oleksa</password>
<!-- sql to call when connection is created. Can be anything, select 1 is valid for PostgreSQL
<new-connection-sql>select 1</new-connection-sql>
-->

<!-- sql to call on an existing pooled connection when it is obtained from pool. Can be anything, select 1 is valid for PostgreSQL
<check-valid-connection-sql>select 1</check-valid-connection-sql>
-->

<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>PostgreSQL 7.2</type-mapping>
</metadata>
</local-tx-datasource>

</datasources>

What could I be possible missing...???

Thanks

Brian
 
Brian Oleksa
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry....

I forgot to mention that this is a j2EE web app.

I invoke the action class from my JSF page.

<s:link action="#{genchartfromdb.getSomeData}" value="Get Data" disabled="false"/>

Once I click the above link, I get the NOT BOUND error...
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please check your jndi-pattern declaration, in the Seam example I see the following:
<components xmlns="http://jboss.com/products/seam/components"
xmlns:core="http://jboss.com/products/seam/core">
<core:init jndi-pattern="@jndiPattern@"/>
</components>
 
Ranch Hand
Posts: 1880
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read this article for JBoss Seam Introduction:
http://www.javabeat.net/jboss-seam/2007/06/jboss-seam-introduction/
 
Whatever you say buddy! And I believe this tiny ad too:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic