Access to database denied

15 views
Skip to first unread message

Matthias

unread,
Apr 8, 2008, 11:38:37 AM4/8/08
to webical-developers
Hi,

I tried now to setup webical but I failed.
My system is FreeBSD 7 with tomcat 6.0.14, mysql-connector-java-5.1.6
and diablo-jdk-1.5.0.07.01_9 installed.
I created a symlink for the mysql-connector in the directory apache-
tomcat-6.0/lib
0 lrwxr-xr-x 1 root wheel 54 Apr 7 19:17 mysql-connector-
java.jar -> /usr/local/share/java/classes/mysql-connector-java.jar

Then I created a database webical and created a user webical which can
access that database (with a different password like in the
documentation).
Then I imported the two sql files into the database so that the tables
are created and the first user for authentification is created (there
I changed the username and password, like in the manual described).
Tested with the tool mysql if the user can connect with the password
to that database and everything works fine.

Then I deployed the webical.war with the tomcat manager interface and
edited the file webical/META-INF/context.xml to use the correct
password.
<Realm className="org.apache.catalina.realm.JDBCRealm"
debug="4"
driverName="com.mysql.jdbc.Driver"
connectionName="webical"
connectionPassword="deleted here"
connectionURL="jdbc:mysql://localhost:3306/webical?
autoReconnect=true"
userTable="_auth_user"
userNameCol="username"
userCredCol="userpass"
userRoleTable="_auth_userrole"
roleNameCol="role"/>
<Resource
name="jdbc/calendarDataBase"
auth="Container"
type="javax.sql.DataSource"

factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
username="webical"
password="deleted here"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/webical?
autoReconnect=true" />

Then I restarted my tomcat that everything will be loaded freshly, but
I got a lot of error lines in log/webical.log, I think the important
ones are:
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:
288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:
413)
Caused by:
com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Could
not create connection to database server. Attempted reconnect 3 times.
Giving up.
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:
980)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:
956)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:
926)
at
com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2253)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:
718)
at
com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:298)
at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:
282)
at
org.apache.tomcat.dbcp.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:
38)
at
org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:
294)
at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:
1247)
at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:
1221)
... 45 more
Caused by: java.sql.SQLException: Access denied for user
'webical'@'localhost' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:
1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:
956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:910)
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3923)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1273)
at
com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2181)
... 52 more
2008-04-08 17:24:50,224 WARN JDBCExceptionReporter - SQL Error: 0,
SQLState: null


It looks like it cannot access the database, but username, password,
database everything looks fine in that file.
Do you have an idea how to solve that problem?

Best regards,
Matthias

Zoran Kovacevic

unread,
Apr 8, 2008, 12:00:30 PM4/8/08
to webical-d...@googlegroups.com
Hi Matthias,

> I tried now to setup webical but I failed.

Connecting to MySQL can be a pain. But should work!

> Then I created a database webical and created a user webical which can
> access that database (with a different password like in the
> documentation).
> Then I imported the two sql files into the database so that the tables
> are created and the first user for authentification is created (there
> I changed the username and password, like in the manual described).
> Tested with the tool mysql if the user can connect with the password
> to that database and everything works fine.

Are your MySQL and Tomcat on the same machine?

Are you just connecting or also using the database? E.g. use webical;
show tables;

--
Zoran Kovacevic
Func. Internet Integration
W http://www.func.nl
M +31 6 48104284
T +31 20 4230000
F +31 20 4223500
GPG http://www.func.nl/keys/z.kov...@func.nl-public.txt

Ivo van Dongen

unread,
Apr 8, 2008, 1:53:12 PM4/8/08
to webical-d...@googlegroups.com
Hi Matthias,

When trying the connection manually you're connecting as
webical@localhost and not webical@anyotherhost? In mysql there is a
distinction between those two categories. It's possible that the user
does has rights from any host (which means any host except localhost in
mysql) and not localhost. I suggest you try that out.

Good luck,
Ivo

Matthias Fechner

unread,
Apr 8, 2008, 3:06:05 PM4/8/08
to webical-d...@googlegroups.com
Hi Zoran,

Zoran Kovacevic wrote:
> Connecting to MySQL can be a pain. But should work!

hehe, I had never problems with perl or php or C++ with mysql :)

> Are your MySQL and Tomcat on the same machine?

yes they are on the same machine.

> Are you just connecting or also using the database? E.g. use webical;
> show tables;

I connected and did also queries the database and the rights should be
ok. But acces to database is limited to localhost:

grant all privileges on webical.* to 'webical'@'localhost' identified by
'thesecretpassword gg';

I'm sure it is a small issue but it is my first time I work with tomcat :)

Best regards,
Matthias

--
"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook

Ivo van Dongen

unread,
Apr 10, 2008, 4:38:47 AM4/10/08
to webical-d...@googlegroups.com
Hi Matthias,

Weird, this shouldn't pose to much of a problem. Perhaps it's an idea to start over with all the default settings and passwords, get that going first. Once you have it running you can then try changing the configuration with a different user.

Good luck,
Ivo
--
Ivo van Dongen

Func. Internet Integration
W http://www.func.nl

Matthias Fechner

unread,
Apr 11, 2008, 11:50:52 AM4/11/08
to webical-d...@googlegroups.com
Hi Ivo,

Ivo van Dongen wrote:
> Weird, this shouldn't pose to much of a problem. Perhaps it's an idea to
> start over with all the default settings and passwords, get that going
> first. Once you have it running you can then try changing the
> configuration with a different user.

so I reseted the password now and now it works, is there a limitation in
the length of the password?

But now I get the next problem.
Webical asks for configuration.
The first page I filled out and now it asks for Name and some calendar
option (start of week, date display and so on).
I fill that out but now I get the following errormessage:

The application returned the following error message:

Method onFormSubmitted of interface
org.apache.wicket.markup.html.form.IFormSubmitListener targeted at
component [MarkupContainer [Component id = userSettingsForm, page =
org.webical.web.pages.BasePage, path =
4:contentPanel:settingsTabs:panel:userSettingsForm.UserSettingsPanel$1,
isVisible = true, isVersioned = true]] threw an exception
Causes

The application returned the following (possible) causes for the error:

* Illegal pattern character 't'

The stack trace says:

org.apache.wicket.WicketRuntimeException: Method onFormSubmitted of
interface org.apache.wicket.markup.html.form.IFormSubmitListener
targeted at component [MarkupContainer [Component id = userSettingsForm,
page = org.webical.web.pages.BasePage, path =
4:contentPanel:settingsTabs:panel:userSettingsForm.UserSettingsPanel$1,
isVisible = true, isVersioned = true]] threw an exception
at
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:194)
at
org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)
at
org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:90)
at
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1094)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1169)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1248)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:489)
at
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:343)
at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:193)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
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:585)
at
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:183)
... 21 more
Caused by: java.lang.IllegalArgumentException: Illegal pattern character 't'
at java.text.SimpleDateFormat.compile(SimpleDateFormat.java:678)
at java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:497)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:446)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:427)
at
org.apache.wicket.extensions.markup.html.form.DateTextField$1.getDateFormat(DateTextField.java:133)
at
org.apache.wicket.util.convert.converters.DateConverter.convertToObject(DateConverter.java:45)
at
org.apache.wicket.markup.html.form.FormComponent.convertInput(FormComponent.java:1134)
at
org.apache.wicket.markup.html.form.FormComponent.validate(FormComponent.java:1016)
at org.apache.wicket.markup.html.form.Form$15.validate(Form.java:1644)
at
org.apache.wicket.markup.html.form.Form$ValidationVisitor.formComponent(Form.java:152)
at
org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrderHelper(FormComponent.java:400)
at
org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrderHelper(FormComponent.java:387)
at
org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrder(FormComponent.java:365)
at
org.apache.wicket.markup.html.form.Form.visitFormComponentsPostOrder(Form.java:982)
at
org.apache.wicket.markup.html.form.Form.validateComponents(Form.java:1640)
at org.apache.wicket.markup.html.form.Form.validate(Form.java:1631)
at org.apache.wicket.markup.html.form.Form.process(Form.java:794)
at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:766)
... 26 more


The only t I filled out is the t in my first name.


Best regards

Ivo van Dongen

unread,
Apr 11, 2008, 4:14:29 PM4/11/08
to webical-d...@googlegroups.com
Hi Matthias,

Matthias Fechner wrote:
> Hi Ivo,
>
> Ivo van Dongen wrote:
>
>> Weird, this shouldn't pose to much of a problem. Perhaps it's an idea to
>> start over with all the default settings and passwords, get that going
>> first. Once you have it running you can then try changing the
>> configuration with a different user.
>>
>
> so I reseted the password now and now it works, is there a limitation in
> the length of the password?
>

There shouldn't be. I'll try it out.


> But now I get the next problem.
> Webical asks for configuration.
> The first page I filled out and now it asks for Name and some calendar
> option (start of week, date display and so on).
> I fill that out but now I get the following errormessage:
>
> The application returned the following error message:
>
> Method onFormSubmitted of interface
> org.apache.wicket.markup.html.form.IFormSubmitListener targeted at
> component [MarkupContainer [Component id = userSettingsForm, page =
> org.webical.web.pages.BasePage, path =
> 4:contentPanel:settingsTabs:panel:userSettingsForm.UserSettingsPanel$1,
> isVisible = true, isVersioned = true]] threw an exception
> Causes
>
> The application returned the following (possible) causes for the error:
>
>

You're not having to much luck are you :)


> The only t I filled out is the t in my first name.
>

Could you send me exactly what you filled out in the form? I'll try to
reproduce it here on my development setup and check what the problem is.

Thanks for your patience,
Ivo

Ivo van Dongen

unread,
Apr 14, 2008, 6:18:40 AM4/14/08
to webical-d...@googlegroups.com
Hi Matthias,


Could you send me exactly what you filled out in the form? I'll try to reproduce it here on my development setup and check what the problem is.

ok, I filled out:
First Name: Matthias
Last name prefix: nothing
Last Name: Fechner
Birtdate: 02/10/1978

First weekday: Monday
Default calendar view: week view
date display: 11/04/2008
Time display: 17:55

Same error message like in the mail before.

Thanks, I'll try to figure this out at home.

Regards,
Ivo

Ivo van Dongen

unread,
Apr 18, 2008, 3:32:33 AM4/18/08
to webical-d...@googlegroups.com
Hi Matthias,

I'm having a hard time reproducing this bug. I did however come across a whole bunch of other bugs and decided to revise the whole thing when I have the chance. I hope to fix your bug at the same time.

Sorry I can't help you out further,
Ivo

Matthias Fechner

unread,
Apr 18, 2008, 3:43:00 AM4/18/08
to webical-d...@googlegroups.com
Hi Ivo,

Ivo van Dongen wrote:
> I'm having a hard time reproducing this bug. I did however come across a
> whole bunch of other bugs and decided to revise the whole thing when I
> have the chance. I hope to fix your bug at the same time.

no problem keep your time.
Please inform me if you found and fixed the problem so I can retry the
new version.

Bye,

Reply all
Reply to author
Forward
0 new messages