Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tomcat Realm JDBCRealm Authentication Error [JDBC490] #529

Closed
firebird-automations opened this issue Apr 20, 2017 · 10 comments
Closed

Tomcat Realm JDBCRealm Authentication Error [JDBC490] #529

firebird-automations opened this issue Apr 20, 2017 · 10 comments

Comments

@firebird-automations
Copy link

Submitted by: Davide Z (davidz)

Relate to JDBC501

I have this error try start JDBCRealm on my tomcat application:

org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/exxxx]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1107)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1841)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [Realm[JDBCRealm]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5084)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 10 more
Caused by: java.util.ServiceConfigurationError: org.firebirdsql.gds.impl.GDSFactoryPlugin: Provider org.firebirdsql.gds.impl.wire.WireGDSFactoryPlugin not a subtype
at java.util.ServiceLoader.fail(ServiceLoader.java:239)
at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at org.firebirdsql.gds.impl.GDSFactory.loadPluginsFromClassLoader(GDSFactory.java:118)
at org.firebirdsql.gds.impl.GDSFactory.<clinit>(GDSFactory.java:75)
at org.firebirdsql.jdbc.FBDriver.connect(FBDriver.java:110)
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:670)
at org.apache.catalina.realm.JDBCRealm.startInternal(JDBCRealm.java:733)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 12 more

this is Realm extract from my application context.xml
<!-- JDBCRealm Authentication -->
<Realm className="org.apache.catalina.realm.JDBCRealm"
connectionURL="jdbc:firebirdsql://192.168.1.23:3050/dev?encoding=NONE"
connectionName="SYSDBA"
connectionPassword="masterkey"
driverName="org.firebirdsql.jdbc.FBDriver"
roleNameCol="sRolName"
userCredCol="sUsrPassword"
userNameCol="sUsrName"
userRoleTable="VUserRoles"
userTable="TUser"
/>

Commits: d023b1f

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Do you by any chance have the Jaybird driver both in the tomcat lib folder and in your web application? The error seems to point to WireGDSFactoryPlugin being loaded from a different classloader than the interface GDSFactoryPlugin.

@firebird-automations
Copy link
Author

Commented by: Davide Z (davidz)

You are rigth. I have the Jaybird driver (same Jaybird 3.0.0-beta-3 driver) in both folder.
Removed from web application and it works!

thanks

N.B. with FB2.5 and Jaybird 2.2.x it works with driver in both.

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Thanks. In comparison to Jaybird 2.2, I made a number of changes to how these pluggable parts of the implementation are loaded, but it looks like in this specific case that actually contributes to the problem. I'll see if I can make it more robust. However, in general, the driver should only be present once: either in tomcat or in the webapplication.

PS To avoid confusion: Jaybird 3 also works with Firebird 2.5 (just like Jaybird 2.2 also works with Firebird 3).

@firebird-automations
Copy link
Author

Commented by: Davide Z (davidz)

" the driver should only be present once: either in tomcat or in the webapplication. "

I agree

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Thanks for reporting, on closer inspection the problem is with an 'incomplete' catch. In Jaybird 3 we switched to java.util.ServiceLoader which throws a ServiceConfigurationError in case of incompatible class hierarchies, and subclasses of Error are - of course - not caught by a catch(Exception e) block, which means this error now bubbled all the way up.

In Jaybird 2.2 this same situation would lead to a ClassCastException which would then trigger a fallback scenario (which might again cause a ClassCastException, but that was then 'ignored' by a catch(Exception e) block.

I'm in the process of fixing this.

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Changed code to catch ServiceConfigurationError and made some other changes to improve robustness of loading the plugins.

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Fix Version: Jaybird 3.0.0 [ 10440 ]

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Link: This issue relate to JDBC501 [ JDBC501 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants