xuzhf / crmdipity

Automatically exported from code.google.com/p/crmdipity
0 stars 0 forks source link

Login Issue #20

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. download and unzip the Serendipity-0.6.0.zip
2. import the project into Eclipse
3. add external jars for smartgwt 2.4
4. run Debug as -> web application in development mode
5. open http://127.0.0.1:8888/Serendipity.html?gwt.codesvr=127.0.0.1:9997
6. login using Login = "Administrator" and Password = "N0More$ecrets" but there 
was no response.
7. follow the comments from 
http://uptick.com.au/content/gwt-login-security#comment-103

>>>Use the AccountTestCase to populate the 'User', 'Account' and 'Report' 
tables (see step 6) and don't forget to update the "hibernate.hbm2ddl.auto" 
property (e.g. run the JUnit test with value="create" then comment it out) in 
the persistence.xml file.

8. run JUnit test against au.com.uptick.serendipity.server.AccountTestCase 
under test folder in eclipse after enabling <property 
name="hibernate.hbm2ddl.auto" value="create" /> in Persistence.xml
9. get the following exceptions under JUnit console:

What is the expected output? What do you see instead?

java.lang.ExceptionInInitializerError
    at au.com.uptick.serendipity.server.AccountTestCase.createUsers(AccountTestCase.java:93)
    at au.com.uptick.serendipity.server.AccountTestCase.testAccountDao(AccountTestCase.java:66)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: 
au.com.uptick.serendipity] Unable to configure EntityManagerFactory
    at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:374)
    at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:56)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32)
    at au.com.uptick.serendipity.server.dao.BaseDao.<clinit>(BaseDao.java:31)
    ... 27 more
Caused by: org.hibernate.HibernateException: Unable to get the default Bean 
Validation factory
    at org.hibernate.cfg.beanvalidation.BeanValidationActivator.applyDDL(BeanValidationActivator.java:127)
    at org.hibernate.cfg.Configuration.applyBeanValidationConstraintsOnDDL(Configuration.java:1674)
    at org.hibernate.cfg.Configuration.applyConstraintsToDDL(Configuration.java:1624)
    at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1415)
    at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1345)
    at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1477)
    at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:193)
    at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1096)
    at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:278)
    at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:362)
    ... 31 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.hibernate.cfg.beanvalidation.BeanValidationActivator.applyDDL(BeanValidationActivator.java:118)
    ... 40 more
Caused by: org.hibernate.HibernateException: Unable to build the default 
ValidatorFactory
    at org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.java:345)
    at org.hibernate.cfg.beanvalidation.TypeSafeActivator.applyDDL(TypeSafeActivator.java:106)
    ... 45 more
Caused by: javax.validation.ValidationException: Unable to find a default 
provider
    at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
    at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
    at org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.java:342)
    ... 46 more

What version of the product are you using? On what operating system?

1. Eclipse 
Version: Helios Service Release 2
Build id: 20110218-0911

2. GWT SDK 2.3.0

3. JVM:

java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)

4. Mac OS X version 10.6.7

Please provide any additional information below.

Any help?

Thanks,

-Guoqian

Original issue reported on code.google.com by jiang.gu...@gmail.com on 5 Jul 2011 at 11:55

GoogleCodeExporter commented 9 years ago
Hi,

Based on the "Caused by:" lines in your stack trace it would appear that the 
issue is related to JPA/Hibernate.

Are you new to JPA?  If so take a look at this post -> 
http://blog.m1key.me/2010/06/eclipse-jpa-with-hibernate-hsqldb-part_23.html and 
try and get a simple test case up and running in you environment.

Also take a look at the persistence.xml file:

->

  <!-- Database connection settings -->
  <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver" />
  <property name="hibernate.connection.url" value="jdbc:hsqldb:file:/db/serendipitydb" />
  <property name="hibernate.connection.username" value="sa" />
  <property name="hibernate.connection.password" value="" />

->

Do you have write permissions to "/db"?

Cheers
Rob

Original comment by rob.ferg...@gtempaccount.com on 5 Jul 2011 at 8:39

GoogleCodeExporter commented 9 years ago
Hi,

Thanks for the link and it helps me a lot about jpa, hibernate and hsqldb. I 
was able to set up a hsql db server and to access a hsql db - serendipitydb 
through eclipse (ping successful).

However, I still could not pass the JUnit test for 
au.com.uptick.serendipity.server.AccountTestCase (Run as -> Junit Test in 
Eclipse). Each time the same exceptions above occurred.

I have tried a number of db connection settings as follows:

<!-- Database connection settings -->
  <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver" />
  <property name="hibernate.connection.url" value="jdbc:hsqldb:file:/path/db/serendipitydb" />
  <property name="hibernate.connection.username" value="sa" />
  <property name="hibernate.connection.password" value="" />

or

<!-- Database connection settings -->
  <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver" />
  <property name="hibernate.connection.url" value="jdbc:hsqldb:hsql://localhost/serendipitydb" />
  <property name="hibernate.connection.username" value="sa" />
  <property name="hibernate.connection.password" value="" />

Am I missing anything?

Thanks,

-Guoqian

Original comment by jiang.gu...@gmail.com on 6 Jul 2011 at 4:35

GoogleCodeExporter commented 9 years ago
Hi,

The entries look fine.

You might try moving the HSLQDB jar into your webs server's lib directory.

Cheers
Rob

Original comment by rob.ferg...@gtempaccount.com on 8 Jul 2011 at 2:30

GoogleCodeExporter commented 9 years ago
As far as I can tell, this is because you are using GWT 2.3.  I had the same 
issue and, even though I changed the project's GWT SDK from 2.3 to 2.2, the 
exception still occurred.  It wasn't until I manually removed 
validation-api-1.0.0.GA.jar from the buildpath (which is part of GWT 2.3 and 
not GWT 2.2) that the problem was fixed.

I actually removed Google Web Toolkit from the Eclipse project first 
(Properties -> Google -> Web Toolkit - unchecked the "Use Google Web Toolkit" 
box).  Afterwards, I removed validation-api-1.0.0.GA.jar, 
validation-api-1.0.0.GA-sources.jar, gwt-dev.jar and gwt-user.jar (which for 
some reason stayed on the buildpath) and added Google Web Toolkit (GWT 2.2) 
again.

Original comment by dev.kyle...@gmail.com on 26 Jul 2011 at 6:47

GoogleCodeExporter commented 9 years ago
Hi,

Very good point. GWTP 5.1 doesn't support GWT 2.3.

You have to be very careful when trying to mix and match components and 
versions.

That's why I have the statement (in bold) on the CRMdipity Project Home Page 
(http://code.google.com/p/crmdipity/):

->

New: Serendipty version 0.6.0 - includes support for Login security, CSV file 
import/export and visualisations (GWT 2.2.0, GWTP 0.5.1 and smartGWT 2.4).

->

The next release of Serendipity will include support for Maven.

Cheers
Rob

Original comment by rob.ferg...@uptick.com.au on 26 Jul 2011 at 10:25

GoogleCodeExporter commented 9 years ago
I did exactly as the op except that I use GWT 2.2.0. The test case passes 
without an error. 

However when I click the "sign in" button in dev mode, the UI does not respond, 
and I get error messages in the Console (see attachment). By debugging I found 
that the error is thrown from the following line in LoginHander.excute() :

    try {
      User user = userDao.retrieveUser(action.getLogin());

If I input an invalid password, a popup dialog tells me it's a wrong password.

Original comment by warren.c...@gmail.com on 2 Aug 2011 at 1:07

Attachments:

GoogleCodeExporter commented 9 years ago
The log and script files for HSQLDB are also attached.

Original comment by warren.c...@gmail.com on 2 Aug 2011 at 2:09

Attachments:

GoogleCodeExporter commented 9 years ago
The problem is that I need to comment out the following line in persistence.xml 
after the test case has been finished and before I run the project in dev mode:

<property name="hibernate.hbm2ddl.auto" value="create" />

Another thing to notice is that I set the connection url in absolute path, 
otherwise it is relative to the root of the drive where JVM is starting from:

<property name="hibernate.connection.url" 
value="jdbc:hsqldb:file:d:/temp/db/serendipitydb" />

Original comment by warren.c...@gmail.com on 3 Aug 2011 at 3:03