Shiro suddenly stopped working Due to Hibernate Errors

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Shiro suddenly stopped working Due to Hibernate Errors

mixtou
This post was updated on .
I have 2 similar projects with shiro authentication.
Configuration is identical.

*First Project Conf. (shiro.ini)*

[main]
jwtg = gr.histopath.platform.lib.JWTGuard
jwtv =  gr.histopath.platform.lib.JWTVerifyingFilter

ds = com.mysql.cj.jdbc.MysqlDataSource
ds.serverName = 127.0.0.1
ds.port = 3306
ds.user = histopathUser
ds.password = **********
ds.databaseName = histopath.gr

jdbcRealm = gr.histopath.platform.lib.MyRealm
jdbcRealm.dataSource = $ds


credentialsMatcher =
org.apache.shiro.authc.credential.Sha512CredentialsMatcher
credentialsMatcher.hashIterations = 50000
credentialsMatcher.hashSalted = true
credentialsMatcher.storedCredentialsHexEncoded = false
jdbcRealm.credentialsMatcher = $credentialsMatcher


jdbcRealm.permissionsLookupEnabled = false

shiro.loginUrl = /authentication/login

cacheManager = org.apache.shiro.cache.MemoryConstrainedCacheManager
securityManager.cacheManager = $cacheManager

sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager
securityManager.sessionManager = $sessionManager
#securityManager.sessionManager.sessionIdCookieEnabled = false

# ssl.enabled = false

securityManager.realms = $jdbcRealm

[users]

[roles]

[urls]

/authentication/login = authc
# /authentication/logout = logout

/search/* = noSessionCreation, jwtv
/statistics/* = noSessionCreation, jwtv
/clinics/* = noSessionCreation, jwtv
/patients/* = noSessionCreation, jwtv
/incidents/* = noSessionCreation, jwtv
/doctors/* = noSessionCreation, jwtv

/users/new = noSessionCreation, anon
/users/details/* = noSessionCreation, anon
/users/* = noSessionCreation, jwtv

/* = anon



*Second Project Conf. (shiro.ini)*

[main]
jwtg = gr.gourvas.platform.lib.JWTGuard
jwtv =  gr.gourvas.platform.lib.JWTVerifyingFilter

ds = com.mysql.cj.jdbc.MysqlDataSource
ds.serverName = 127.0.0.1
ds.port = 3306
ds.user = gourvasUser
ds.password = ***********
ds.databaseName = gourvas_platform


jdbcRealm = gr.gourvas.platform.lib.MyRealm
jdbcRealm.dataSource = $ds

credentialsMatcher =
org.apache.shiro.authc.credential.Sha512CredentialsMatcher
credentialsMatcher.hashIterations = 50000
credentialsMatcher.hashSalted = true
credentialsMatcher.storedCredentialsHexEncoded = false
jdbcRealm.credentialsMatcher = $credentialsMatcher


jdbcRealm.permissionsLookupEnabled = false

shiro.loginUrl = /authentication/login

cacheManager = org.apache.shiro.cache.MemoryConstrainedCacheManager
securityManager.cacheManager = $cacheManager

sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager
securityManager.sessionManager = $sessionManager
#securityManager.sessionManager.sessionIdCookieEnabled = false

# ssl.enabled = false

securityManager.realms = $jdbcRealm

[users]

[roles]

[urls]

/authentication/login = authc
# /authentication/logout = logout

/search/* = noSessionCreation, jwtv
/statistics/* = noSessionCreation, jwtv
/clinics/* = noSessionCreation, jwtv
/patients/* = noSessionCreation, jwtv
/incidents/* = noSessionCreation, jwtv
/doctors/* = noSessionCreation, jwtv

/users/new = noSessionCreation, anon
/users/details/* = noSessionCreation, anon

/users/* = noSessionCreation, jwtv

/* = anon


The first one build and works normally.

*The second one fails to build with shiro error:
*
org.apache.shiro.config.ConfigurationException: Unable to instantiate class
[gr.gourvas.platform.lib.MyRealm] for object named 'jdbcRealm'.  Please
ensure you've specified the fully qualified class name correctly.

What is going on. Why the second project doesn't find MyRealm???

Any Ideas? I am banging my head for hours...



--
Sent from: http://shiro-user.582556.n2.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Shiro suddenly stopped working

Brian Demers
What does “MyRealm” look like?
Did anything change? What about the constructor?

-Brian

> On Nov 13, 2018, at 8:20 AM, mixtou <[hidden email]> wrote:
>
> MyRealm
Reply | Threaded
Open this post in threaded view
|

Re: Shiro suddenly stopped working

mixtou
*First Project Realm (The one that Works) *
package gr.histopath.platform.lib;

import gr.histopath.platform.model.DAO.UserDAO;
import gr.histopath.platform.model.TransferObjects.User;
import org.apache.shiro.authc.*;
import org.apache.shiro.codec.Base64;
import org.apache.shiro.realm.jdbc.JdbcRealm;
import org.apache.shiro.util.ByteSource;

public class  MyRealm extends JdbcRealm {

    private UserDAO userDAO;
    private User user;
    private String password;
    private ByteSource salt;


    public MyRealm() {
        this.userDAO = new UserDAO();
        setSaltStyle(SaltStyle.COLUMN);
    }

    @Override
    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken
token) throws AuthenticationException {
        // identify account to log to
        UsernamePasswordToken userPassToken = (UsernamePasswordToken) token;
        String username = userPassToken.getUsername();

        if (username.equals(null)) {
            System.out.println("Username is null.");
            return null;
        }

        // read password hash and salt from db
        System.out.println("Username: " + username);
        this.user = userDAO.getByUsername(username);
        this.userDAO.closeEntityManager();
        System.out.println("user's email: " + this.user.getUsername());

        if (this.user == null) {
            System.out.println("No account found for user [" + username +
"]");
            return null;
        }
        this.password = this.user.getPassword();
        this.salt =
ByteSource.Util.bytes(Base64.decode(this.user.getSalt()));

        SaltedAuthenticationInfo info = new SimpleAuthenticationInfo(user,
password, salt, getName());
//        SimpleAccount simpleAccount = new SimpleAccount(this.user,
this.password, this.salt, getName());

        return info;
//        return simpleAccount;
    }

}


*The Second MyRealm (the one that fails)*

package gr.gourvas.platform.lib;

import gr.gourvas.platform.model.DAO.UserDAO;
import gr.gourvas.platform.model.TransferObjects.User;
import org.apache.shiro.authc.*;
import org.apache.shiro.codec.Base64;
import org.apache.shiro.realm.jdbc.JdbcRealm;
import org.apache.shiro.util.ByteSource;

public class MyRealm extends JdbcRealm {

    private UserDAO userDAO;
    private User user;
    private String password;
    private ByteSource salt;


    public MyRealm() {
        this.userDAO = new UserDAO();
        setSaltStyle(SaltStyle.COLUMN);
    }

    @Override
    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken
token) throws AuthenticationException {
        // identify account to log to
        UsernamePasswordToken userPassToken = (UsernamePasswordToken) token;
        String username = userPassToken.getUsername();

        if (username.equals(null)) {
            System.out.println("Username is null.");
            return null;
        }

        // read password hash and salt from db
        System.out.println("Username: " + username);
        this.user = userDAO.getByUsername(username);
        this.userDAO.closeEntityManager();
        System.out.println("user's email: " + this.user.getUsername());

        if (this.user == null) {
            System.out.println("No account found for user [" + username +
"]");
            return null;
        }
        this.password = this.user.getPassword();
        this.salt =
ByteSource.Util.bytes(Base64.decode(this.user.getSalt()));

        SaltedAuthenticationInfo info = new
SimpleAuthenticationInfo(this.user, this.password, this.salt, getName());
//        SimpleAccount simpleAccount = new SimpleAccount(this.user,
this.password, this.salt, getName());

        return info;
//        return simpleAccount;
    }

}




They are identical.



--
Sent from: http://shiro-user.582556.n2.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Shiro suddenly stopped working

Brian Demers
What is the full stacktrace?

On Tue, Nov 13, 2018 at 8:51 AM mixtou <[hidden email]> wrote:
*First Project Realm (The one that Works) *
package gr.histopath.platform.lib;

import gr.histopath.platform.model.DAO.UserDAO;
import gr.histopath.platform.model.TransferObjects.User;
import org.apache.shiro.authc.*;
import org.apache.shiro.codec.Base64;
import org.apache.shiro.realm.jdbc.JdbcRealm;
import org.apache.shiro.util.ByteSource;

public class  MyRealm extends JdbcRealm {

    private UserDAO userDAO;
    private User user;
    private String password;
    private ByteSource salt;


    public MyRealm() {
        this.userDAO = new UserDAO();
        setSaltStyle(SaltStyle.COLUMN);
    }

    @Override
    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken
token) throws AuthenticationException {
        // identify account to log to
        UsernamePasswordToken userPassToken = (UsernamePasswordToken) token;
        String username = userPassToken.getUsername();

        if (username.equals(null)) {
            System.out.println("Username is null.");
            return null;
        }

        // read password hash and salt from db
        System.out.println("Username: " + username);
        this.user = userDAO.getByUsername(username);
        this.userDAO.closeEntityManager();
        System.out.println("user's email: " + this.user.getUsername());

        if (this.user == null) {
            System.out.println("No account found for user [" + username +
"]");
            return null;
        }
        this.password = this.user.getPassword();
        this.salt =
ByteSource.Util.bytes(Base64.decode(this.user.getSalt()));

        SaltedAuthenticationInfo info = new SimpleAuthenticationInfo(user,
password, salt, getName());
//        SimpleAccount simpleAccount = new SimpleAccount(this.user,
this.password, this.salt, getName());

        return info;
//        return simpleAccount;
    }

}


*The Second MyRealm (the one that fails)*

package gr.gourvas.platform.lib;

import gr.gourvas.platform.model.DAO.UserDAO;
import gr.gourvas.platform.model.TransferObjects.User;
import org.apache.shiro.authc.*;
import org.apache.shiro.codec.Base64;
import org.apache.shiro.realm.jdbc.JdbcRealm;
import org.apache.shiro.util.ByteSource;

public class MyRealm extends JdbcRealm {

    private UserDAO userDAO;
    private User user;
    private String password;
    private ByteSource salt;


    public MyRealm() {
        this.userDAO = new UserDAO();
        setSaltStyle(SaltStyle.COLUMN);
    }

    @Override
    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken
token) throws AuthenticationException {
        // identify account to log to
        UsernamePasswordToken userPassToken = (UsernamePasswordToken) token;
        String username = userPassToken.getUsername();

        if (username.equals(null)) {
            System.out.println("Username is null.");
            return null;
        }

        // read password hash and salt from db
        System.out.println("Username: " + username);
        this.user = userDAO.getByUsername(username);
        this.userDAO.closeEntityManager();
        System.out.println("user's email: " + this.user.getUsername());

        if (this.user == null) {
            System.out.println("No account found for user [" + username +
"]");
            return null;
        }
        this.password = this.user.getPassword();
        this.salt =
ByteSource.Util.bytes(Base64.decode(this.user.getSalt()));

        SaltedAuthenticationInfo info = new
SimpleAuthenticationInfo(this.user, this.password, this.salt, getName());
//        SimpleAccount simpleAccount = new SimpleAccount(this.user,
this.password, this.salt, getName());

        return info;
//        return simpleAccount;
    }

}




They are identical.



--
Sent from: http://shiro-user.582556.n2.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Shiro suddenly stopped working

mixtou
This post was updated on .
FULL STACK TRACE

JAVA RUN OUTPUT STACK TRACE

13-Nov-2018 16:32:38.027 INFO [RMI TCP Connection(2)-127.0.0.1] com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource. Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@64a7a15e [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@b258231 [ acquireIncrement -> 1, acquireRetryAttempts -> 1, acquireRetryDelay -> 250, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, debugUnreturnedConnectionStackTraces -> false, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, identityToken -> 1hge13s9z3qqd5o127reqb|6ffdc108, idleConnectionTestPeriod -> 60, initialPoolSize -> 5, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 20, maxStatements -> 50, maxStatementsPerConnection -> 0, minPoolSize -> 5, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@b4f13878 [ description -> null, driverClass -> null, factoryClassLocation -> null, forceUseNamedDriverClass -> false, identityToken -> 1hge13s9z3qqd5o127reqb|772538d9, jdbcUrl -> jdbc:mysql://localhost:3306/gourvas_platform?useSSL=false&useLegacyDatetimeCode=false&serverTimezone=Europe/Athens, properties -> {useUnicode=true, user=******, password=******, CharSet=utf8, characterEncoding=utf8} ], preferredTestQuery -> null, privilegeSpawnedThreads -> false, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false; userOverrides: {} ], dataSourceName -> null, extensions -> {}, factoryClassLocation -> null, identityToken -> 1hge13s9z3qqd5o127reqb|77a5c8e3, numHelperThreads -> 3 ]
13-Nov-2018 16:32:38.989 SEVERE [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
13-Nov-2018 16:32:38.993 SEVERE [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors
13-Nov-2018 16:32:38.999 WARNING [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [ROOT] registered the JDBC driver [com.mysql.cj.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
[2018-11-13 04:32:39,011] Artifact Gourvas-Platform-Web-App-Exploded: Error during artifact deployment. See server log for details.
13-Nov-2018 16:32:40.815 INFO [Abandoned connection cleanup thread] org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
 java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
        at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1329)
        at org.apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:1006)
        at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.checkContextClassLoaders(AbandonedConnectionCleanupThread.java:96)
        at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:69)
        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)

13-Nov-2018 16:32:40.877 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/Users/mixtou/apache-tomcat-9.0.10/webapps/manager]
13-Nov-2018 16:32:40.913 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/Users/mixtou/apache-tomcat-9.0.10/webapps/manager] has finished in [36] ms
13-Nov-2018 16:33:38.053 INFO [C3P0PooledConnectionPoolManager[identityToken->1hge13s9z3qqd5o127reqb|77a5c8e3]-AdminTaskTimer] org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. Could not load [com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
 java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
        at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1329)
        at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1317)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1176)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1138)
        at com.mchange.v2.resourcepool.BasicResourcePool.checkIdleResources(BasicResourcePool.java:1635)
        at com.mchange.v2.resourcepool.BasicResourcePool.access$2000(BasicResourcePool.java:44)
        at com.mchange.v2.resourcepool.BasicResourcePool$CheckIdleResourcesTask.run(BasicResourcePool.java:2176)
        at java.util.TimerThread.mainLoop(Timer.java:555)
        at java.util.TimerThread.run(Timer.java:505)

Exception in thread "C3P0PooledConnectionPoolManager[identityToken->1hge13s9z3qqd5o127reqb|77a5c8e3]-AdminTaskTimer" java.lang.NoClassDefFoundError: com/mchange/v2/resourcepool/BasicResourcePool$AsyncTestIdleResourceTask
        at com.mchange.v2.resourcepool.BasicResourcePool.checkIdleResources(BasicResourcePool.java:1635)
        at com.mchange.v2.resourcepool.BasicResourcePool.access$2000(BasicResourcePool.java:44)
        at com.mchange.v2.resourcepool.BasicResourcePool$CheckIdleResourcesTask.run(BasicResourcePool.java:2176)
        at java.util.TimerThread.mainLoop(Timer.java:555)
        at java.util.TimerThread.run(Timer.java:505)
Caused by: java.lang.ClassNotFoundException: Illegal access: this web application instance has been stopped already. Could not load [com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
        at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1319)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1176)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1138)
        ... 5 more
Caused by: java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
        at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1329)
        at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1317)
        ... 7 more
[2018-11-13 05:14:58,023] Artifact Gourvas-Platform-Web-App-Exploded: Artifact is not deployed. Press 'Deploy' to start deployment

TOMCAT LOG

13-Nov-2018 16:32:35.624 INFO [RMI TCP Connection(2)-127.0.0.1]
org.apache.catalina.core.ApplicationContext.log Initializing Shiro
environment
13-Nov-2018 16:32:38.989 SEVERE [RMI TCP Connection(2)-127.0.0.1]
org.apache.catalina.core.StandardContext.listenerStart Exception sending
context initialized event to listener instance of class
[org.apache.shiro.web.env.EnvironmentLoaderListener]
 org.apache.shiro.config.ConfigurationException: Unable to instantiate class
[gr.gourvas.platform.lib.MyRealm] for object named 'jdbcRealm'.  Please
ensure you've specified the fully qualified class name correctly.
        at
org.apache.shiro.config.ReflectionBuilder.createNewInstance(ReflectionBuilder.java:309)
        at
org.apache.shiro.config.ReflectionBuilder$InstantiationStatement.doExecute(ReflectionBuilder.java:927)
        at
org.apache.shiro.config.ReflectionBuilder$Statement.execute(ReflectionBuilder.java:887)
        at
org.apache.shiro.config.ReflectionBuilder$BeanConfigurationProcessor.execute(ReflectionBuilder.java:765)
        at
org.apache.shiro.config.ReflectionBuilder.buildObjects(ReflectionBuilder.java:260)
        at
org.apache.shiro.config.IniSecurityManagerFactory.buildInstances(IniSecurityManagerFactory.java:167)
        at
org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:130)
        at
org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:108)
        at
org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:94)
        at
org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:46)
        at
org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:123)
        at
org.apache.shiro.util.AbstractFactory.getInstance(AbstractFactory.java:47)
        at
org.apache.shiro.web.env.IniWebEnvironment.createWebSecurityManager(IniWebEnvironment.java:203)
        at
org.apache.shiro.web.env.IniWebEnvironment.configure(IniWebEnvironment.java:99)
        at
org.apache.shiro.web.env.IniWebEnvironment.init(IniWebEnvironment.java:92)
        at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:45)
        at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:40)
        at
org.apache.shiro.web.env.EnvironmentLoader.createEnvironment(EnvironmentLoader.java:221)
        at
org.apache.shiro.web.env.EnvironmentLoader.initEnvironment(EnvironmentLoader.java:133)
        at
org.apache.shiro.web.env.EnvironmentLoaderListener.contextInitialized(EnvironmentLoaderListener.java:58)
        at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4643)
        at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5109)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:742)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:718)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:703)
        at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1737)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at
org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:287)
        at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
        at
org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:457)
        at
org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:406)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at
org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:287)
        at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
        at
javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1471)
        at
javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
        at
javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1312)
        at
javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1404)
        at
javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:832)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)
        at sun.rmi.transport.Transport$1.run(Transport.java:200)
        at sun.rmi.transport.Transport$1.run(Transport.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
        at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
        at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$256(TCPTransport.java:683)
        at java.security.AccessController.doPrivileged(Native Method)
        at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
        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.shiro.util.InstantiationException: Unable to
instantiate class [gr.gourvas.platform.lib.MyRealm]
        at org.apache.shiro.util.ClassUtils.newInstance(ClassUtils.java:183)
        at org.apache.shiro.util.ClassUtils.newInstance(ClassUtils.java:168)
        at
org.apache.shiro.config.ReflectionBuilder.createNewInstance(ReflectionBuilder.java:302)
        ... 64 more
Caused by: javax.persistence.PersistenceException: [PersistenceUnit:
PersistenceUnit] Unable to build Hibernate SessionFactory
        at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:1016)
        at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:942)
        at
org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:56)
        at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
        at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
        at
gr.gourvas.platform.model.DAO.SingletonFactory.<init>(SingletonFactory.java:13)
        at gr.gourvas.platform.model.DAO.AbstractDAO.<init>(AbstractDAO.java:14)
        at gr.gourvas.platform.model.DAO.UserDAO.<init>(UserDAO.java:8)
        at gr.gourvas.platform.lib.MyRealm.<init>(MyRealm.java:19)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
        at java.lang.Class.newInstance(Class.java:442)
        at org.apache.shiro.util.ClassUtils.newInstance(ClassUtils.java:181)
        ... 66 more
Caused by: org.hibernate.MappingException: Composite-id class must implement
Serializable: gr.gourvas.platform.model.TransferObjects.Incident
        at
org.hibernate.mapping.RootClass.checkCompositeIdentifier(RootClass.java:293)
        at org.hibernate.mapping.RootClass.validate(RootClass.java:276)
        at org.hibernate.boot.internal.MetadataImpl.validate(MetadataImpl.java:347)
        at
org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:466)
        at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:939)
        ... 79 more

13-Nov-2018 16:32:38.997 INFO [RMI TCP Connection(2)-127.0.0.1]
org.apache.catalina.core.ApplicationContext.log Cleaning up Shiro
Environment




--
Sent from: http://shiro-user.582556.n2.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Shiro suddenly stopped working

Brian Demers
Did your database change or implementation change?  This is the root cause:

```
Caused by: org.hibernate.MappingException: Composite-id class must implement
Serializable: gr.gourvas.platform.model.TransferObjects.Incident
        at org.hibernate.mapping.RootClass.checkCompositeIdentifier(RootClass.java:293)
        at org.hibernate.mapping.RootClass.validate(RootClass.java:276)
        at org.hibernate.boot.internal.MetadataImpl.validate(MetadataImpl.java:347)
        at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:466)
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:939)
        ... 79 more
```

On Tue, Nov 13, 2018 at 10:09 AM mixtou <[hidden email]> wrote:
FULL STACK TRACE

13-Nov-2018 16:32:35.624 INFO [RMI TCP Connection(2)-127.0.0.1]
org.apache.catalina.core.ApplicationContext.log Initializing Shiro
environment
13-Nov-2018 16:32:38.989 SEVERE [RMI TCP Connection(2)-127.0.0.1]
org.apache.catalina.core.StandardContext.listenerStart Exception sending
context initialized event to listener instance of class
[org.apache.shiro.web.env.EnvironmentLoaderListener]
 org.apache.shiro.config.ConfigurationException: Unable to instantiate class
[gr.gourvas.platform.lib.MyRealm] for object named 'jdbcRealm'.  Please
ensure you've specified the fully qualified class name correctly.
        at
org.apache.shiro.config.ReflectionBuilder.createNewInstance(ReflectionBuilder.java:309)
        at
org.apache.shiro.config.ReflectionBuilder$InstantiationStatement.doExecute(ReflectionBuilder.java:927)
        at
org.apache.shiro.config.ReflectionBuilder$Statement.execute(ReflectionBuilder.java:887)
        at
org.apache.shiro.config.ReflectionBuilder$BeanConfigurationProcessor.execute(ReflectionBuilder.java:765)
        at
org.apache.shiro.config.ReflectionBuilder.buildObjects(ReflectionBuilder.java:260)
        at
org.apache.shiro.config.IniSecurityManagerFactory.buildInstances(IniSecurityManagerFactory.java:167)
        at
org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:130)
        at
org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:108)
        at
org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:94)
        at
org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:46)
        at
org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:123)
        at
org.apache.shiro.util.AbstractFactory.getInstance(AbstractFactory.java:47)
        at
org.apache.shiro.web.env.IniWebEnvironment.createWebSecurityManager(IniWebEnvironment.java:203)
        at
org.apache.shiro.web.env.IniWebEnvironment.configure(IniWebEnvironment.java:99)
        at
org.apache.shiro.web.env.IniWebEnvironment.init(IniWebEnvironment.java:92)
        at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:45)
        at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:40)
        at
org.apache.shiro.web.env.EnvironmentLoader.createEnvironment(EnvironmentLoader.java:221)
        at
org.apache.shiro.web.env.EnvironmentLoader.initEnvironment(EnvironmentLoader.java:133)
        at
org.apache.shiro.web.env.EnvironmentLoaderListener.contextInitialized(EnvironmentLoaderListener.java:58)
        at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4643)
        at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5109)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:742)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:718)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:703)
        at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1737)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at
org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:287)
        at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
        at
org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:457)
        at
org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:406)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at
org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:287)
        at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
        at
javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1471)
        at
javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
        at
javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1312)
        at
javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1404)
        at
javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:832)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)
        at sun.rmi.transport.Transport$1.run(Transport.java:200)
        at sun.rmi.transport.Transport$1.run(Transport.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
        at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
        at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$256(TCPTransport.java:683)
        at java.security.AccessController.doPrivileged(Native Method)
        at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
        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.shiro.util.InstantiationException: Unable to
instantiate class [gr.gourvas.platform.lib.MyRealm]
        at org.apache.shiro.util.ClassUtils.newInstance(ClassUtils.java:183)
        at org.apache.shiro.util.ClassUtils.newInstance(ClassUtils.java:168)
        at
org.apache.shiro.config.ReflectionBuilder.createNewInstance(ReflectionBuilder.java:302)
        ... 64 more
Caused by: javax.persistence.PersistenceException: [PersistenceUnit:
PersistenceUnit] Unable to build Hibernate SessionFactory
        at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:1016)
        at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:942)
        at
org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:56)
        at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
        at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
        at
gr.gourvas.platform.model.DAO.SingletonFactory.<init>(SingletonFactory.java:13)
        at gr.gourvas.platform.model.DAO.AbstractDAO.<init>(AbstractDAO.java:14)
        at gr.gourvas.platform.model.DAO.UserDAO.<init>(UserDAO.java:8)
        at gr.gourvas.platform.lib.MyRealm.<init>(MyRealm.java:19)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
        at java.lang.Class.newInstance(Class.java:442)
        at org.apache.shiro.util.ClassUtils.newInstance(ClassUtils.java:181)
        ... 66 more
Caused by: org.hibernate.MappingException: Composite-id class must implement
Serializable: gr.gourvas.platform.model.TransferObjects.Incident
        at
org.hibernate.mapping.RootClass.checkCompositeIdentifier(RootClass.java:293)
        at org.hibernate.mapping.RootClass.validate(RootClass.java:276)
        at org.hibernate.boot.internal.MetadataImpl.validate(MetadataImpl.java:347)
        at
org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:466)
        at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:939)
        ... 79 more

13-Nov-2018 16:32:38.997 INFO [RMI TCP Connection(2)-127.0.0.1]
org.apache.catalina.core.ApplicationContext.log Cleaning up Shiro
Environment




--
Sent from: http://shiro-user.582556.n2.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Shiro suddenly stopped working

mixtou
Yes i changed database and Transfer Objects Accordingly because of
customizations the client asked. The problem also disappeared when i
implemented Serializable  in the Incident TransferObject. Changes occurred
in other tables and transfer objects but i don't get any errors about them.
Is this normal? Should this be happening?? Can you explain a bit more?? Why
on the initial project build it doesn't complain and builds successfully???
Why in the new customized project i don't get errors about other changed
Entities/Table and Transfer Objects?

Thanks in advance,

Toutoudakis Michail



--
Sent from: http://shiro-user.582556.n2.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Shiro suddenly stopped working

mixtou
This happened to this Transfer Object (Incident) because accidentally a
second column was annotated with @id instead of @Basic. So this created a
composite-id which lead to the Serialization Error. By replacing @id
annotation in the second column/field with @Basic project builds normally
without the implementation of Serializable.



--
Sent from: http://shiro-user.582556.n2.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Shiro suddenly stopped working

Brian Demers
Thanks for the follow up!!

-Brian

> On Nov 14, 2018, at 4:21 AM, mixtou <[hidden email]> wrote:
>
> This happened to this Transfer Object (Incident) because accidentally a
> second column was annotated with @id instead of @Basic. So this created a
> composite-id which lead to the Serialization Error. By replacing @id
> annotation in the second column/field with @Basic project builds normally
> without the implementation of Serializable.
>
>
>
> --
> Sent from: http://shiro-user.582556.n2.nabble.com/