Getting "java.lang.NoClassDefFoundError: weblogic/application/ApplicationStateListener" while deploying application into Weblogic server - weblogic

Getting NoClassDefFoundError after adding listener "ADFApplicationStateListener" in weblogic-appliations.xml.
Earlier weblogic-applications.xml has listener "ADFApplicationLifecycleListener". I am able to deploy the application with this listener.
But as per the mandates specified in the section "Custom ADF application Deployment requirements" of JDeveloper documentation in the below link, I have configured with the "ADFApplicationStateListener" listener.
http://www.oracle.com/technetwork/developer-tools/jdev/documentation/121200-rn-1917713.html
How can I resolve this error ?
Thanks,
Gopal.
Caused by: java.lang.NoClassDefFoundError: weblogic/application/ApplicationStateListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
at weblogic.utils.classloaders.FilteringClassLoader.findClass(FilteringClassLoader.java:101)
at weblogic.utils.classloaders.FilteringClassLoader.loadClass(FilteringClassLoader.java:86)
at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at weblogic.application.internal.flow.BaseLifecycleFlow$CreateListenerAction.run(BaseLifecycleFlow.java:140)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.application.internal.flow.BaseLifecycleFlow$BaseAction.invoke(BaseLifecycleFlow.java:104)
at weblogic.application.internal.flow.HeadLifecycleFlow.createListener(HeadLifecycleFlow.java:117)

ApplicationStateListener is introduced in Weblogic server as part of following bug fix :-
Here the bug is there is no callback for cleanup the ADF resources while stopping the application in weblogic server.
Actually postStop() method of ApplicationLifecycleListener will do this while removal or undeployment of the application.
But when an application requires only restart, i.e stop the application and start it again (no need to undeploy & deploy) then there is no callback for ADF MDS related resources cleanup.
So, ApplicationStateListener is introduced to have a callback for resource cleanup while stopping the application.
My Weblogic server(version 10.3.6.0) is not applied with the patch (patch 56MM) which has the above bug fix.
So, if want to continue with ApplicationStateListener I have to apply the patch, otherwise I have to continue with the ApplicationLifecycleListener.

Related

SecurityException in google play services?

Fatal Exception: java.lang.SecurityException: Unknown calling package name 'com.my.package.name'.
at android.os.Parcel.readException(Parcel.java:1546)
at android.os.Parcel.readException(Parcel.java:1499)
at com.google.android.gms.common.internal.zzv$zza$zza.zza(Unknown Source)
at com.google.android.gms.common.internal.zzf.zza(Unknown Source)
at com.google.android.gms.internal.zzaaj$zzc.zzvA(Unknown Source)
at com.google.android.gms.internal.zzaaj$zzf.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at com.google.android.gms.internal.zzacv.run(Unknown Source)
at java.lang.Thread.run(Thread.java:818)
Seeing a securityException in google play services most recently. This crash is happening in Android 4.4, 5.0, 6.0.
Anyone had faced this issue before?
SecurityException was usually thrown by the security manager to indicate a security violation. If the Google Play services client library version is greater than 8.1, the app throws a security exception if a required runtime permission is missing from AndroidManifest.xml. You may check on this GitHub thread if it helps.
Similar issue was also posted. You can file in this link if you think this is a bug so the Engineers can look into it.

Dbfit: Login failed for user 'dev\abc'. Client connectionId:a12f7cab

I am trying to connect sqlserver from dbfit, and getting below error:
com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user
'DEV\abc'. ClientConnectionId:a12f7cab-7261-4fa7-8064-ea355f03f883 at
com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)
at
com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:254)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:84)
at
com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:2908)
at
com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:2234)
at
com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:41)
at
com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:2220)
at
com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
at
com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
at
com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1326)
at
com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991)
at
com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
at
com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
at java.sql.DriverManager.getConnection(DriverManager.java:664) at
java.sql.DriverManager.getConnection(DriverManager.java:208) at
dbfit.api.AbstractDbEnvironment.connect(AbstractDbEnvironment.java:51)
at
dbfit.environment.SqlServerEnvironment.connect(SqlServerEnvironment.java:53)
at
dbfit.api.AbstractDbEnvironment.connect(AbstractDbEnvironment.java:78)
at
dbfit.fixture.DatabaseEnvironment.connect(DatabaseEnvironment.java:52)
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
fitlibrary.closure.MethodClosure.invoke(MethodClosure.java:35) at
fitlibrary.closure.MethodClosure.invokeTyped(MethodClosure.java:28)
at
fitlibrary.closure.CalledMethodTarget.invokeTyped(CalledMethodTarget.java:77)
at
fitlibrary.closure.CalledMethodTarget.invokeTyped(CalledMethodTarget.java:95)
at
fitlibrary.closure.CalledMethodTarget.invokeAndWrap(CalledMethodTarget.java:358)
at
fitlibrary.traverse.workflow.caller.ActionCaller.run(ActionCaller.java:37)
at
fitlibrary.traverse.workflow.DoTraverseInterpreter.interpretRow(DoTraverseInterpreter.java:176)
at
fitlibrary.traverse.workflow.DoTraverseInterpreter.interpretAfterFirstRow(DoTraverseInterpreter.java:66)
at
fitlibrary.traverse.workflow.DoTraverseInterpreter.interpretInFlow(DoTraverseInterpreter.java:151)
at fitlibrary.DoFixture.interpretAfterFirstRow(DoFixture.java:47) at
fitlibrary.FitLibraryFixture.doTable(FitLibraryFixture.java:83) at
dbfit.fixture.DatabaseEnvironment.doTable(DatabaseEnvironment.java:22)
at fit.Fixture.interpretFollowingTables(Fixture.java:121) at
fit.Fixture.interpretTables(Fixture.java:107) at
fit.Fixture.doTables(Fixture.java:81) at
fit.FitServer.process(FitServer.java:81) at
fit.FitServer.run(FitServer.java:56) at
fit.FitServer.main(FitServer.java:41)
Is anyone facing similar issue?
Appreciate your help.
Thanks
I missed below step:
(http://dbfit.github.io/dbfit/docs/database-specific-information.html#microsoft-sql-server)
Microsoft SQL Server
Deploying the JDBC Driver
Download MS SQL Server JDBC driver from their site (It is not open source and cannot be distributed with DbFit.)
Deploy sqljdbc4.jar in DbFit’s lib folder - the same folder as dbfit-XXX.jar.
Deploy auth\x86\sqljdbc_auth.dll in %programfiles(x86)%\Java\jre7\bin folder to allow integrated windows authentication
Then use connetion as
!|DatabaseEnvironment|sqlserver|
|Connect|jdbc:sqlserver://myhost;integratedSecurity=true|
and it worked.

JBoss AS7 Hornetq - RemoteConenctionFactory lookup fails with RoundRobinConnectionLoadBalancingPolicy NotSerializableException

I'm using JBoss AS 7 Hornetq. Our standalone java application interacts with a queue and sends messages. We had the entire environment setup and it was working pretty smoothly. Suddenly, one fine day, our standalone application failed with the below exception:
Caused by: java.io.NotSerializableException: org.hornetq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy
Detailed exception stack trace is below
javax.naming.NamingException: Failed to lookup [Root exception is java.io.NotSerializableException: org.hornetq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy]
at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:36)
at org.jboss.naming.remote.protocol.v1.Protocol$1.execute(Protocol.java:104)
at org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1.lookup(RemoteNamingStoreV1.java:79)
at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:79)
at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:83)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.infosys.lbs.publishing.LocationProcessor.postMessageInQueue(LocationProcessor.java:377)
at com.infosys.lbs.publishing.LocationProcessor.process(LocationProcessor.java:69)
at com.infosys.lbs.publishing.main.Publisher.main(Publisher.java:34)
Caused by: java.io.NotSerializableException: org.hornetq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:891)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1063)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:885)
at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1063)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:998)
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:885)
at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:62)
at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:119)
at org.jboss.naming.remote.protocol.v1.Protocol$1$2.write(Protocol.java:138)
at org.jboss.naming.remote.protocol.v1.WriteUtil.write(WriteUtil.java:61)
at org.jboss.naming.remote.protocol.v1.Protocol$1.handleServerMessage(Protocol.java:128)
at org.jboss.naming.remote.protocol.v1.RemoteNamingServerV1$MessageReciever$1.run(RemoteNamingServerV1.java:73)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: an exception which occurred:
in field loadBalancingPolicy
in field serverLocator
in object org.hornetq.jms.client.HornetQJMSConnectionFactory#ea074d
Exception was happening when the app was trying to lookup the connection factory
QueueConnectionFactory qcf = (QueueConnectionFactory)context.lookup("jms/RemoteConnectionFactory");
Below are the steps on how we resolved the issue
There was almost zero help for resolving this issue. A web search on this exception returned next to nothing. However, this particular thread on JBoss AS Dev site spinned a thought in my head: RemoteConnectionFactory is not found when looking up in a remote client
The scenario mentioned in this thread was not same as ours. (In our app this is the first and the only lookup happening.) This thread got me thinking towards a possible connection factory initialization issue. While there is nothing I could do to debug or find the issue around it, I thought that if I could reinitialize it, that would help.
So I tried lookup with java:jboss/exported/jms/RemoteConnectionFactory As expected it failed with a NamingException. Hoping that this naming syntax (using java:/) would have resulted in a reinitialization, I tried lookup again with jms/RemoteConnectionFactory. And bingo!!! it worked!
Unfortunately, we still don't know why it happened, and if it is just a one-off case! Documenting it here just in case some mortal soul hits this issue.

Old Version of Commons-HttpClient gives IOException in the Axis2 Web Service Client

I am using a wsdl2java generated web service client for the axis2 web service (axis2 version is 1.6.1). So for http connection the old version of commons-httpclient 3.1 is used. While doing some load tests to my web service client. In some cases i came across this exception
org.apache.axis2.AxisFault: org.apache.axiom.ext.io.StreamCopyException: Error reading from source
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at com.ardic.arcsp.carbon.registry.ws.stub.WSStorageServiceStub.fromOM(WSStorageServiceStub.java:16706)
at com.ardic.arcsp.carbon.registry.ws.stub.WSStorageServiceStub.wSgetById(WSStorageServiceStub.java:6659)
at com.ardic.arcsp.update.wsclient.WSStorageServiceClient.getResourceById(WSStorageServiceClient.java:177)
at com.ardic.arcsp.update.wsclient.OTAUpdateTestServlet.downloadResource(OTAUpdateTestServlet.java:162)
at com.ardic.arcsp.update.wsclient.OTAUpdateTestServlet.doGet(OTAUpdateTestServlet.java:91)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at sun.reflect.GeneratedMethodAccessor30.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:273)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:270)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:305)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:298)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:57)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:189)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.wso2.carbon.server.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:154)
at org.wso2.carbon.server.TomcatServer$1.invoke(TomcatServer.java:254)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399)
at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:396)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:356)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1534)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:705)
Caused by: org.apache.axiom.om.OMException: org.apache.axiom.ext.io.StreamCopyException: Error reading from source
at org.apache.axiom.attachments.impl.PartFactory.createPart(PartFactory.java:172)
at org.apache.axiom.attachments.Attachments.getPart(Attachments.java:705)
at org.apache.axiom.attachments.Attachments.getNextPartDataHandler(Attachments.java:623)
at org.apache.axiom.attachments.Attachments.getDataHandler(Attachments.java:350)
at org.apache.axiom.om.impl.builder.OMAttachmentAccessorMimePartProvider.getDataHandler(OMAttachmentAccessorMimePartProvider.java:45)
at org.apache.axiom.util.stax.xop.XOPDecodingStreamReader$DataHandlerProviderImpl.getDataHandler(XOPDecodingStreamReader.java:81)
at org.apache.axiom.util.stax.xop.XOPDecodingStreamReader.getDataHandler(XOPDecodingStreamReader.java:472)
at org.apache.axiom.om.impl.SwitchingWrapper.getDataHandler(SwitchingWrapper.java:1360)
at org.apache.axiom.util.stax.XMLStreamReaderUtils.getDataHandlerFromElement(XMLStreamReaderUtils.java:230)
at com.ardic.arcsp.carbon.registry.ws.stub.xsd.WSResource$Factory.parse(WSResource.java:2087)
at com.ardic.arcsp.carbon.registry.ws.stub.WSgetByIdResponse$Factory.parse(WSgetByIdResponse.java:417)
at com.ardic.arcsp.carbon.registry.ws.stub.WSStorageServiceStub.fromOM(WSStorageServiceStub.java:16273)
... 37 more
Caused by: org.apache.axiom.ext.io.StreamCopyException: Error reading from source
at org.apache.axiom.attachments.utils.BAAOutputStream.readFrom(BAAOutputStream.java:114)
at org.apache.axiom.attachments.impl.BufferUtils.inputStream2OutputStream(BufferUtils.java:76)
at org.apache.axiom.attachments.impl.PartFactory.createPart(PartFactory.java:136)
... 48 more
Caused by: java.io.IOException: CRLF expected at end of chunk: 116/161
at org.apache.commons.httpclient.ChunkedInputStream.readCRLF(ChunkedInputStream.java:207)
at org.apache.commons.httpclient.ChunkedInputStream.nextChunk(ChunkedInputStream.java:219)
at org.apache.commons.httpclient.ChunkedInputStream.read(ChunkedInputStream.java:176)
at java.io.FilterInputStream.read(FilterInputStream.java:116)
at org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:108)
at java.io.FilterInputStream.read(FilterInputStream.java:116)
at org.apache.axiom.om.util.DetachableInputStream.read(DetachableInputStream.java:147)
at java.io.FilterInputStream.read(FilterInputStream.java:116)
at java.io.PushbackInputStream.read(PushbackInputStream.java:169)
at org.apache.axiom.attachments.BoundaryPushbackInputStream.readFromStream(BoundaryPushbackInputStream.java:114)
at org.apache.axiom.attachments.BoundaryPushbackInputStream.read(BoundaryPushbackInputStream.java:248)
at org.apache.axiom.attachments.MIMEBodyPartInputStream.read(MIMEBodyPartInputStream.java:87)
at org.apache.axiom.attachments.utils.BAAOutputStream.readFrom(BAAOutputStream.java:112)
... 50 more
The web service client request files from the server and downloads the file. These exceptions occurs on the response while receiving files in chunks.
While searching i came across this fix mentioned here.
https://issues.apache.org/jira/browse/HTTPCORE-190
However the exceptions still occur. So what else can cause this exceptions?
UPDATE:
Ok, i got the real reason for exception.On the client side if the memory allocation for jvm is low, the response from the server cannot be processed due to SocketTimeOut. But the exception itself could not stress this. Increasing the heap on the client side can solve the problem temporary.
You definitely need enough memory to hold all the data that is chucked to the client. Java can give really weird results, especially the older JVMs, when there isn't enough memory to go around. It can be tricky sometimes to identify that as the root cause so bravo on that find.
There are a few helpful big on the Apache Axis2 User's Guide - Creating Clients page that might be helpful if you are new to wsdl2java.
Our next step is to learn what command line options are available. One thing you can try is using the -u option to generate separate classes for the data bindings instead of creating them as inner classes. (Take a look at this Stack Overflow question.)
Since this question is 10 years old if you run into this or another error please create a new question specific to that context.

NullPointerException while raise an embedded ldap server using spring

I'm trying to raise the Spring Embedded Ldap Server using:
But I'm keep on getting this exception:
2010-06-10 14:33:35,559 ERROR main ApacheDSContainer start - Server startup failed
java.lang.NullPointerException
at org.apache.directory.server.core.schema.DefaultSchemaService.initialize(DefaultSchemaService.java:382)
at org.apache.directory.server.core.DefaultDirectoryService.initialize(DefaultDirectoryService.java:1425)
at org.apache.directory.server.core.DefaultDirectoryService.startup(DefaultDirectoryService.java:907)
at org.springframework.security.ldap.server.ApacheDSContainer.start(ApacheDSContainer.java:160)
at org.springframework.security.ldap.server.ApacheDSContainer.afterPropertiesSet(ApacheDSContainer.java:113)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4212)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
I'm using spring 3.0.2 and added the following jars for the ldap:
spring-security-ldap-3.0.2.RELEASE.jar
spring-ldap-1.3.0.RELEASE-all.jar
apacheds-all-1.5.6.jar
shared-ldap-0.9.15.jar
slf4j-api-1.5.6.jar
slf4j-simple-1.5.6.jar
Help please....
#Zorkus: I'm not sure exactly what kind of problem you came across with Apache Directory, and what is the root cause of that, but if all you need is a working embedded java LDAP server for integration testing with Spring Security then you might want to consider some alternatives.
I've recently started to investigate for alternatives, because I couldn't achieve with Apache Directory what I wanted despite a lot of time and effort invested. (I basically wanted to replicate the schema and the user database of an Active Directory instance into an embedded server.)
What I found is that the UnboundID LDAP SDK is a nice replacement. Integrating with it requires a bit more effort than a one-liner in your spring context (like <security:ldap-server/>), but not much more. Starting up an LDAP server requires just a few lines of code:
InMemoryDirectoryServerConfig config =
new InMemoryDirectoryServerConfig("dc=example, dc=com");
// schema config only necessary if the standard
// schema provided by the library doesn't suit your needs
config.setSchema(Schema.getSchema("your-custom-schema.schema"));
// listener config only necessary if you want to make sure that the
// server listens on port 33389, otherwise a free random port will
// be picked at runtime - which might be even better for tests btw.
config.setListenerConfigs(
new InMemoryListenerConfig("myListener", null, 33389, null, null, null));
InMemoryDirectoryServer ds = new InMemoryDirectoryServer(config);
ds.startListening();
// import your test data from ldif files
ds.importFromLDIF(true,"content.ldif");
The only dependency you will need for this to work is:
<dependency>
<groupId>com.unboundid</groupId>
<artifactId>unboundid-ldapsdk</artifactId>
<version>2.3.1</version>
</dependency>
It would be pretty easy to wrap the above code in a class that you can instantiate and configure from your Spring context.
For documentation and code examples on the UnboundID LDAP SDK see: https://www.unboundid.com/products/ldap-sdk/docs/
(I'm not affiliated with UnboundID in any way.)
Check whether the authorization state used by the LDAP client has access to the schema.