Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Thread: Specification violation [EJB3 JPA 6.2.1.2] -You have not defined non-jta-data-source

  1. #11
    Join Date
    Sep 2010
    Posts
    19

    Default

    Hello Enrico Pizzi,

    Thanks for the reply. I will give a look at that link. I know about zk spring.

    I am trying example given on http://java.dzone.com/articles/using-desktop-model-view

    with same code.. but latest libraries.

    Anyways thanks for your time and help again.. I think now I need to find solution by myself or post it on zkoss forum so that someone can help.

    Thanks

  2. #12
    Join Date
    Oct 2009
    Location
    Taipei
    Posts
    6

    Default Use ZK Spring 3.0RC

    Hi amar4kintu,
    Frist, if you are working with Spring 3.x release please use ZK Spring 3.0RC release. You can download it from here
    Second, it seems you are using some code from zktodo2 application but haven't configured it properly as the root cause points to some Hibernate entity mapping problem

    14:31:39,359 INFO [AnnotationBinder] Binding entity from annotated class: org.zkforge.zktodo2.Reminder
    14:31:39,390 INFO [EntityBinder] Bind entity org.zkforge.zktodo2.Reminder on table REMINDER
    14:31:39,421 INFO [Version] Hibernate Validator 3.1.0.GA

    - Ashish

  3. #13
    Join Date
    Sep 2010
    Posts
    19

    Default

    Hello ashishlin,

    Thanks for the reply.

    Regarding configuration are you getting any idea. I have posted all my .xml files and jar files that I am using.

    I am new to both Zkoss and Spring.

    I need to use Zkoss 5.0.4 with Spring 3.0.3 and JPA on JBOSS 5.1 server.

    So I am trying to set this example.

    Thanks.

  4. #14
    Join Date
    Oct 2009
    Location
    Taipei
    Posts
    6

    Default Hibernate 3 jar files?

    are you sure you have hibernate 3 jar files in your WEB-INF/lib ?

  5. #15
    Join Date
    Sep 2010
    Posts
    19

    Default

    Hello ashishlin,

    Thanks for the reply.

    I am using JBOSS 5.1, so I am using its hibernate files.

    Following is list of files in my /WEB-INF/lib folder

    commons-dbcp-1.4.jar
    commons-io.jar
    fckez.jar
    groovy.jar
    jruby.jar
    js.jar
    jython.jar
    org.springframework.aop-3.0.3.RELEASE.jar
    org.springframework.asm-3.0.3.RELEASE.jar
    org.springframework.aspects-3.0.3.RELEASE.jar
    org.springframework.beans-3.0.3.RELEASE.jar
    org.springframework.context.support-3.0.3.RELEASE.jar
    org.springframework.context-3.0.3.RELEASE.jar
    org.springframework.core-3.0.3.RELEASE.jar
    org.springframework.expression-3.0.3.RELEASE.jar
    org.springframework.instrument.tomcat-3.0.3.RELEASE.jar
    org.springframework.instrument-3.0.3.RELEASE.jar
    org.springframework.jdbc-3.0.3.RELEASE.jar
    org.springframework.jms-3.0.3.RELEASE.jar
    org.springframework.orm-3.0.3.RELEASE.jar
    org.springframework.oxm-3.0.3.RELEASE.jar
    org.springframework.test-3.0.3.RELEASE.jar
    org.springframework.transaction-3.0.3.RELEASE.jar
    org.springframework.web.portlet-3.0.3.RELEASE.jar
    org.springframework.web.servlet-3.0.3.RELEASE.jar
    org.springframework.web.struts-3.0.3.RELEASE.jar
    org.springframework.web-3.0.3.RELEASE.jar
    zcommon.jar
    zcommons-el.jar
    zhtml.jar
    zk.jar
    zkplus.jar
    zul.jar
    zweb.jar


    Following is list of hibernate files in JBOSS server.

    C:\jboss\common\lib\hibernate-annotations.jar
    C:\jboss\common\lib\hibernate-commons-annotations.jar
    C:\jboss\common\lib\hibernate-core.jar
    C:\jboss\common\lib\hibernate-entitymanager.jar
    C:\jboss\common\lib\hibernate-jmx.jar
    C:\jboss\common\lib\hibernate-validator.jar


    Thanks.

  6. #16
    Join Date
    Sep 2010
    Posts
    19

    Default

    Hello friends,

    Problems seems to have with @Resource(name="toDoModel") in following code

    package org.zkforge.zktodo2;

    import static java.lang.System.out;

    import java.util.Date;
    import java.util.List;

    import javax.annotation.Resource;

    import org.zkoss.zk.ui.event.Event;
    import org.zkoss.zul.Datebox;
    import org.zkoss.zul.Intbox;
    import org.zkoss.zul.ListModel;
    import org.zkoss.zul.ListModelList;
    import org.zkoss.zul.Listbox;
    import org.zkoss.zul.Textbox;

    public class ZkToDoControllerV3 extends GenericSpringComposer {

    private static final long serialVersionUID = 2560535692993939331L;
    protected transient Textbox name;
    protected transient Intbox priority;
    protected transient Datebox date;
    protected transient Listbox list;

    public ZkToDoControllerV3(){
    return;
    }

    @Resource(name="toDoModel")
    protected transient ZkToDoModel toDoModel = null;

    public ZkToDoModel getToDoModel() {
    return toDoModel;
    }

    public void onClick$add(Event e) {
    Date dateValue = date.getValue();
    Integer priorityValue = priority.getValue();
    String nameValue = name.getValue();
    if( dateValue != null && priorityValue != null && nameValue != null ){
    Reminder reminder = new Reminder();
    reminder.setDate(date.getValue());
    reminder.setName(name.getValue());
    reminder.setPriority(priority.getValue());
    this.toDoModel.persistEvent(reminder);
    List<Reminder> reminders = this.toDoModel.findAll();
    ListModel listModel = this.list.getModel();
    ListModelList listModelList = (ListModelList)listModel;
    listModelList.clear();
    listModelList.addAll(reminders);
    }
    return;
    }

    public void onClick$update(Event e) {
    Reminder selectedReminder = this.toDoModel.getSelectedReminder();
    if( selectedReminder != null ){
    ListModelList listModelList = (ListModelList)this.list.getModel();
    try {
    this.toDoModel.mergeEvent(selectedReminder);
    } catch (EntityNotFoundException exception){
    int index = list.getSelectedIndex();
    listModelList.remove(index);
    alert("Reminder "+selectedReminder.getName()+" has been deleted by another user.");
    if( listModelList.size() > 0 ){
    selectedReminder = (Reminder)listModelList.get(0);
    list.setSelectedIndex(0);
    name.setValue(selectedReminder.getName());
    date.setValue(selectedReminder.getDate());
    priority.setValue(selectedReminder.getPriority());
    } else {
    selectedReminder = null;
    }
    }
    List<Reminder> reminders = toDoModel.findAll();
    listModelList.clear();
    listModelList.addAll(reminders);
    }
    }

    public void onClick$delete(Event e) {
    Reminder selectedReminder = this.toDoModel.getSelectedReminder();
    if( null != selectedReminder ){
    ListModel listModel = this.list.getModel();
    ListModelList listModelList = (ListModelList)listModel;
    int index = listModelList.indexOf(selectedReminder);
    try {
    this.toDoModel.deleteEvent(selectedReminder);
    } catch (EntityNotFoundException exception ){
    out.println("This is harmless as someone else has already deleted this item.");
    }
    listModelList.remove(selectedReminder);
    if( index >= listModelList.size() ){
    index = listModelList.size() - 1;
    }
    if( listModelList.size() > 0 ){
    selectedReminder = (Reminder)listModelList.get(index);
    list.setSelectedIndex(index);
    name.setValue(selectedReminder.getName());
    date.setValue(selectedReminder.getDate());
    priority.setValue(selectedReminder.getPriority());
    } else {
    selectedReminder = null;
    }
    }
    }
    }

    Following is my spring-context.xml file

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:tx="http://www.springframework.org/schema/tx"
    	xmlns:p="http://www.springframework.org/schema/p"
    	xmlns:aop="http://www.springframework.org/schema/aop"
    	xsi:schemaLocation="
    	http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    	http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
    	">
        
    	<!-- 
        JPA config   
        -->	
    
    	<tx:annotation-driven />
    
    	<bean id="entityManagerFactory"
    		class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
    		p:persistence-xml-location="classpath:META-INF/persistence.xml"
    		p:data-source-ref="dataSource"
    		>
    		<property name="jpaVendorAdapter">
    			<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
    				p:showSql="true"
    				p:generateDdl="true">
    			</bean>
    		</property>
    		<property name="jpaProperties">
    			<value>
    			hibernate.ejb.naming_strategy=org.hibernate.cfg.ImprovedNamingStrategy
    			hibernate.dialect=${hibernate.dialect}
    			hibernate.hbm2ddl.auto=${hibernate.hbm2ddl.auto}
    			</value>
    		</property>
    	</bean>
    
    	<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
    
        <!-- 
        JPA helpers
        --> 
        
        <bean id="basicDao" class="org.zkforge.zktodo2.BasicDao" />
    
        <!-- 
        First article classes
        --> 
    
    	<bean id="reminderService" class="org.zkforge.zktodo2.ReminderService" 
    		p:basicDao-ref="basicDao"
    	/>
    
    	<bean id="toDoControllerV1" class="org.zkforge.zktodo2.ZkToDoControllerV1" 
    		p:reminderService-ref="reminderService" scope="prototype"
    	/>
    
        <!-- 
        Data binding enhancement classes
        --> 
    
    	<!-- 
    	Note that the following bean is session scoped. 
    	--> 
    	<bean id="toDoModel" class="org.zkforge.zktodo2.ZkToDoModelImpl" 
    			p:reminderService-ref="reminderService" scope="session">
    		<!-- 
    		// scoped proxy is commented out as only referenced by a prototype bean
    		// if you wanted to pass this bean to a singleton you need to include
    		// the following configurration.   
    		<aop:scoped-proxy proxy-target-class="false"/>
    		-->	
    	</bean>
    
    	<bean id="toDoControllerV2" class="org.zkforge.zktodo2.ZkToDoControllerV2" 
    		p:toDoModel-ref="toDoModel" scope="prototype"
    	/>
        
    </beans>

    Can anyone help?

    Thanks.

  7. #17
    Join Date
    Oct 2009
    Location
    Taipei
    Posts
    6

    Default try mappedName instead

    try @Resource(mappedName="toDoModel") instead.
    Check this thread

  8. #18
    Join Date
    Sep 2010
    Posts
    19

    Default

    Hello ashishlin,

    Thanks for reply.

    I tried it and now it gives following error.

    Caused by: java.lang.ClassNotFoundException: org.aopalliance.intercept.MethodInterceptor

    Thanks.

  9. #19
    Join Date
    Oct 2009
    Location
    Taipei
    Posts
    6

    Default missing jar?

    generally it means you are missing some jar file. google about it.

  10. #20
    Join Date
    Sep 2010
    Posts
    19

    Default

    Hello ashishlin,

    After adding all missing jar files now it gives following error..

    14:37:55,265 INFO [ConnectionProviderFactory] Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceCon nectionProvider
    14:37:55,265 INFO [InjectedDataSourceConnectionProvider] Using provided datasource
    14:37:55,390 WARN [SettingsFactory] Could not obtain connection metadata
    org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (error in script file line: 1 Unexpected token UNIQUE, requires COLLATION in statement [SET DATABASE UNIQUE])
    at org.apache.commons.dbcp.BasicDataSource.createData Source(BasicDataSource.java:1225)
    at org.apache.commons.dbcp.BasicDataSource.getConnect ion(BasicDataSource.java:880)

    Caused by: java.sql.SQLException: error in script file line: 1 Unexpected token UNIQUE, requires COLLATION in statement [SET DATABASE UNIQUE]
    at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
    at org.hsqldb.jdbc.jdbcConnection.<init>(Unknown Source)

    Thanks.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •