SpringLiquibase errors when running on docker - spring

I'm working with SpringLiquibase using the latest liquibase version
liquibase-core 3.8.7 and I created a bean
#Bean
public SpringLiquibase getLiquibase() {
// Configure Liquibase
SpringLiquibase liquibase = new SpringLiquibase();
liquibase.setChangeLog("classpath:db_scripts/db.changelog-master.yaml");
liquibase.setDataSource(dataSource);
liquibase.setShouldRun(true);
return liquibase;
}
and the db.changelog-master.yaml is under resources and looks like that
databaseChangeLog:
- includeAll:
path: db_changes/
relativeToChangelogFile: true
when I run the application locally it's running good, but when I run it as a docker I get the following error:
Caused by: liquibase.exception.ChangeLogParseException: Error parsing classpath:db_scripts/db.changelog-master.yaml
at liquibase.parser.core.yaml.YamlChangeLogParser.parse(YamlChangeLogParser.java:83)
at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:217)
at liquibase.Liquibase.update(Liquibase.java:190)
at liquibase.Liquibase.update(Liquibase.java:179)
at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:366)
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:314)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1855)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1792)
... 22 common frames omitted
Caused by: liquibase.exception.SetupException: Could not find directory or directory was empty for includeAll 'db_changes/'
at liquibase.changelog.DatabaseChangeLog.includeAll(DatabaseChangeLog.java:528)
at liquibase.changelog.DatabaseChangeLog.handleChildNode(DatabaseChangeLog.java:395)
at liquibase.changelog.DatabaseChangeLog.load(DatabaseChangeLog.java:305)
at liquibase.parser.core.yaml.YamlChangeLogParser.parse(YamlChangeLogParser.java:77)
... 29 common frames omitted
Caused by: liquibase.exception.SetupException: Could not find directory or directory was empty for includeAll 'db_changes/'
at liquibase.changelog.DatabaseChangeLog.includeAll(DatabaseChangeLog.java:519)
... 32 common frames omitted
I know there is a bug
https://liquibase.jira.com/browse/CORE-2863 but it doesn't talk about docker.
so I'm not sure it's related.
any ideas?

Related

Caused by: org.ehcache.core.spi.ServiceLocator$DependencyException: Multiple factories for non-plural service

We are getting below error while initializing ehcache:
Caused by: org.ehcache.core.spi.ServiceLocator$DependencyException: Multiple factories for non-plural service
at org.ehcache.core.spi.ServiceLocator$DependencySet.lookupService(ServiceLocator.java:382)
at org.ehcache.core.spi.ServiceLocator$DependencySet.lookupDependenciesOf(ServiceLocator.java:357)
at org.ehcache.core.spi.ServiceLocator$DependencySet.build(ServiceLocator.java:316)
Source Code to initialize cache:
CacheManager cacheManager =
Caching.getCachingProvider("org.ehcache.jsr107.EhcacheCachingProvider")
.getCacheManager(); Cache<K, V> cache = cacheManager.getCache("my-cache");
ehcache version: 3.8.1

Kotlin and spring boot data resource exception

I'm trying out kotlin and spring boot with spring data.
id("org.springframework.boot") version "2.1.8.RELEASE"
I have some schema-*.sql files in src/main/resources. I put this in my application.properties
spring.datasource.schema=/sql/schema-*.sql
I then made a small spring boot ApplicationRunner-based app (so set WebApplicationType.NONE) and these all get executed as expected and the app starts fine.
#SpringBootApplication
private class MainApp(): ApplicationRunner { ... }
fun main(args: Array<String>) {
runApplication<MainApp>(*args) {
webApplicationType = WebApplicationType.NONE
}
}
Now, when I change the above to WebApplicationType.SERVLET, I get the following:
Caused by: java.io.FileNotFoundException: ServletContext resource [/sql/] cannot be resolved to URL because it does not exist
at org.springframework.web.context.support.ServletContextResource.getURL(ServletContextResource.java:173) ~[spring-web-5.1.9.RELEASE.jar:5.1.9.RELEASE]
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:498) ~[spring-core-5.1.9.RELEASE.jar:5.1.9.RELEASE]
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:298) ~[spring-core-5.1.9.RELEASE.jar:5.1.9.RELEASE]
at org.springframework.boot.devtools.restart.ClassLoaderFilesResourcePatternResolver.getResources(ClassLoaderFilesResourcePatternResolver.java:109) ~[spring-boot-devtools-2.1.8.RELEASE.jar:2.1.8.RELEASE]
at org.springframework.context.support.GenericApplicationContext.getResources(GenericApplicationContext.java:233) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE]
at org.springframework.jdbc.config.SortedResourcesFactoryBean.createInstance(SortedResourcesFactoryBean.java:76) ~[spring-jdbc-5.1.9.RELEASE.jar:5.1.9.RELEASE]
at org.springframework.jdbc.config.SortedResourcesFactoryBean.createInstance(SortedResourcesFactoryBean.java:42) ~[spring-jdbc-5.1.9.RELEASE.jar:5.1.9.RELEASE]
at org.springframework.beans.factory.config.AbstractFactoryBean.afterPropertiesSet(AbstractFactoryBean.java:142) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE]
at org.springframework.boot.autoconfigure.jdbc.DataSourceInitializer.doGetResources(DataSourceInitializer.java:175) ~[spring-boot-autoconfigure-2.1.8.RELEASE.jar:2.1.8.RELEASE]
... 89 common frames omitted
This exception goes away and the http server seems to be fine when I omment out:
spring.datasource.schema=/sql/schema-*.sql
Any ideas what I'm supposed to change to make this work?
Try that spring.datasource.schema=classpath:sql/schema-*.sql.

Can't Get Elasticsearch Plugin to Work with Grails 3

I've tried to hook up Elasticsearch plugin ('org.grails.plugins:elasticsearch:1.4.1') with a Grails 3.1.9 project without any luck.
I've also uploaded a simple application in github to demonstrate the issue (https://github.com/jackiebai/testEs)
The above sample testing app only has 1 domain class called Person:
class Person {
String name
static searchable = true
static constraints = {
}
}
The corresponding service class PersonService is used to save and index the Person data:
import grails.transaction.Transactional
#Transactional
class PersonService {
def addPerson(Person person){
person.save()
person.index()
}
def addPerson(String name) {
Person p = new Person(name:name)
addPerson(p)
}
}
I've also added a couple of lines of code in the BootStrap.groovy so that some data will get inserted into the default hibernate db when the application starts:
class BootStrap {
def personService
def init = { servletContext ->
personService.addPerson("Person One")
personService.addPerson("John Smith")
}
def destroy = {
}
}
The application.yml variable settings for the development environment look like below:
environments:
development:
dataSource:
dbCreate: create-drop
url: jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
elasticSearch:
client:
mode: node
transport.sniff: true
bulkIndexOnStartup: true
datastoreImpl: hibernateDatastore
Additional dependencies and bootRun code block were included in the build.gradle by following the plugin user guide (http://noamt.github.io/elasticsearch-grails-plugin/docs/index.html)
dependencies {
...
compile 'org.grails.plugins:elasticsearch:1.4.1'
compile 'org.elasticsearch:elasticsearch:5.4.1'
...
}
bootRun{
jvmArgs = ['-Des.path.home=/Users/myname/elasticsearch-5.4.1']
}
Unfortunately the application failed to run under my osx 10.11.6,java 1.8.0_91 environment with below errors:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'elasticSearchClient': FactoryBean threw exception on object creation; nested exception is java.lang.NoClassDefFoundError: org/elasticsearch/mapper/attachments/MapperAttachmentsPlugin
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:175)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1590)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
... 34 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/elasticsearch/mapper/attachments/MapperAttachmentsPlugin
at grails.plugins.elasticsearch.ClientNodeFactoryBean.getObject(ClientNodeFactoryBean.groovy:207)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
... 39 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.elasticsearch.mapper.attachments.MapperAttachmentsPlugin
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 41 common frames omitted
According to documentation you should use v1.2.0
https://github.com/noamt/elasticsearch-grails-plugin
I believe version 1.4.1 is broken. You can try 2.4.0.RC1 with Grails 3.3+ but you need to add dependency to mapper-attachments and specify elasticsearch.version for Spring Boot:
ext['elasticsearch.version'] = '5.4.1'
dependencies {
compile 'org.grails.plugins:elasticsearch:2.4.0.RC1'
runtime 'org.elasticsearch.plugin:mapper-attachments:2.4.6'
}
See issue#198

problems with getting basic logging up with springboot and logback

i have a simple spring boot app in groovy. here are the gradle dependencies i have set so far
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.3.11'
compile 'org.easyrules:easyrules-core:2.2.1-SNAPSHOT'
compile 'org.easyrules:easyrules-spring:2.2.1-SNAPSHOT'
compile 'org.easyrules:easyrules-jmx:2.2.1-SNAPSHOT'
testCompile group: 'junit', name: 'junit', version: '4.11'
compile 'org.springframework.boot:spring-boot-starter'
compile 'org.springframework.boot:spring-boot-starter-actuator'
compile 'org.springframework.boot:spring-boot-starter-logging'
compile 'ch.qos.logback:logback-classic:1.1.5'
}
this brings in slf4j-api, log4j-over-slf4j, jul-to-slf4j, and jcl-over-slf4f at versions 1.7.13
then in my helper class i have this
#Component
#PropertySource ("classpath:application.properties")
class RulesHelper {
private static final Logger log = LoggerFactory.getLogger(RulesHelper.class)
followed by a bean def like this
#Bean
def rulesEngine () {
assert jmxEnabled != null
if ( !jmxEnabled ) {
//return std rules engine
println "returning std rules engine of type ${stdRulesEngine.getClass().name}"
ruleEngine = stdRulesEngine
return stdRulesEngine
} else {
println "returning jmx rules engine of type ${jmxRulesEngine.getClass().name}"
//log.debug("hello from logger")
//assert log
ruleEngine = jmxRulesEngine
return jmxRulesEngine //JmxRulesExtends RulesEngine so should work
}
}
if i uncomment out that assert i get an error when i run like this saying it cant find org.slf4j.event.LoggingEvent
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [java.lang.Object]: Factory method 'rulesEngine' threw exception; nested exception is java.lang.NoClassDefFoundError: org/slf4j/event/LoggingEvent
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
... 26 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/slf4j/event/LoggingEvent
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:85)
at java.security.AccessController.doPrivileged(Native Method)
at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:82)
at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:80)
at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:251)
at groovy.lang.MetaClassImpl.populateMethods(MetaClassImpl.java:361)
at groovy.lang.MetaClassImpl.fillMethodIndex(MetaClassImpl.java:340)
at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:3224)
at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:222)
at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:253)
at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:263)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:259)
at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:855)
at org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:888)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:880)
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToBoolean(DefaultTypeTransformation.java:180)
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.booleanUnbox(DefaultTypeTransformation.java:69)
at org.softwood.easyrules.RulesHelper.rulesEngine(RulesHelper.groovy:79)
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:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 27 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.slf4j.event.LoggingEvent
what have i done wrong here - i thought this would work based on what i have read
well what do you know - dependency management issue - the latest springboot-starter-logging is only using slf4j-api.1.7.13,
however if you get the latest logback which i did logback_classic.1.1.5 there was breaking issue somewhere in the Api client librray that didnt export the class - which is why it couldnt be found. see logback issue/news
if you explicitly add the dependency
...
compile 'ch.qos.logback:logback-classic:1.1.5'
compile 'org.slf4j:slf4j-api:1.7.16'
to gradle.build, refresh and retry it all starts to work as nature expected. Blimey painful as usual as these things normally are
java.lang.NoClassDefFoundError: org/slf4j/event/LoggingEvent
Logback-classic version 1.1.4 and later require slf4j-api version 1.7.15 or later.
With an earlier slf4j-api.jar in the classpath, attempting introspection of a Logger instance returned by logback version 1.1.4 or later will result in a NoClassDefFoundError similar to that shown below.
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/event/LoggingEvent
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2451)
at java.lang.Class.privateGetPublicMethods(Class.java:2571)
at java.lang.Class.getMethods(Class.java:1429)
at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1261)
at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1122)
at java.beans.Introspector.getBeanInfo(Introspector.java:414)
at java.beans.Introspector.getBeanInfo(Introspector.java:161)
Placing slf4j-api.jar version 1.7.15 or later in the classpath should solve the issue.
Note that this problem only occurs with logback version 1.1.4 and later, other bindings such as slf4j-log4j, slf4j-jdk14 and slf4j-simple are unaffected.
corresponding maven dependency missing got it from https://mvnrepository.com/artifact/org.slf4j/slf4j-api/1.7.15
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.15</version>
</dependency>

Calling session Bean deployed on jboss 5.x from client side

I'm running JBoss 5.1 GA with JDK 1.6 on Linux and trying to call session bean(jar containing this session bean is deployed on jboss server), Now i want to call this session bean from client, but didnt work.
Java Code at client Side
public class CallingJbossSessionBeanFromClient {
/**
* #param args
* #throws Exception
*/
public static void main(String[] args) throws Exception
{
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
p.put(Context.PROVIDER_URL, "jnp://182.158.93.41:8080");
Context context = new InitialContext(p);
System.out.println("Successfully Lookup and going to call SessionBean Function deployed on JBoss-5.1.0 Server");
SlsSessiongRemote remote=(SlsSessionRemote) context.lookup("SlsSessionBean/remote");
//SlsSessionBean/remote is RemoteBinding of session Bean
System.out.println("Called");
}
}
where 'SlsSessionBean/remote' is remote binding of session bean deployed on jboss server.
#Stateless
#RemoteBinding(jndiBinding="SlsSessionBean/remote")
but end up with following error
Exception in thread "main" javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at CallingJbossSessionBeanFromClient.main(CallingJbossSessionBeanFromClient.java:20)
Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
... 4 more
After seeing above error i added jbossjmx-ant.jar in the classpath of 'CallingJbossSessionBeanFromClient' class and got following error
Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/logging/Logger
at org.jnp.interfaces.NamingContext.<clinit>(NamingContext.java:181)
at org.jnp.interfaces.NamingContextFactory.getInitialContext(NamingContextFactory.java:55)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at CallingJbossSessionBeanFromClient.main(CallingJbossSessionBeanFromClient.java:20)
Caused by: java.lang.ClassNotFoundException: org.jboss.logging.Logger
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
... 7 more
After seeing above error i added jboss-logging-spi.jar in the classpath of 'CallingJbossSessionBeanFromClient' class and got following error
Exception in thread "main" javax.naming.CommunicationException: Could not obtain connection to any of these urls: 182.158.93.41:8080 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to retrieve stub from server /182.158.93.41:8080 [Root exception is java.io.EOFException]]
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1763)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:693)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at CallingJbossSessionBeanFromClient.main(CallingJbossSessionBeanFromClient.java:22)
Caused by: javax.naming.CommunicationException: Failed to retrieve stub from server /182.158.93.41:8080 [Root exception is java.io.EOFException]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:327)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1734)
... 4 more
Caused by: java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2281)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2750)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:780)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:312)
... 5 more
Plz tell me, am i on the right way to call sesion bean from client java class?
I have spent hours looking for solution on Google. However I cannot seem to find anything that holds the hand..try to be more clear, i'm in lack of ideas in this problem, even it sounds like a classic
Plz suggest solution
The solution to this problem is to open the JMX-Console and click on the service=Naming to view the MBean view of the Naming service. Check if the port used is still 1099.....
Changed the URL to jnp://182.158.93.41:1299, the client could communicate with the EJB.
If you are running over JBoss AS 5.x
Here is RMI based JNDI description.
RMI-Port: default -1099 / If dynamic port changed to ports-01 Then Port is 1199
Now, Remaining Things are OK, Modify code ass below
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
p.put(Context.PROVIDER_URL, "jnp://182.158.93.41:1199");
Another Point is case of accessing
SlsSessiongRemote remote=(SlsSessionRemote) context.lookup("SlsSessionBean/remote");
if - #Stateless(name="SlsSessionBean")
Then Remote JNDI- [SlsSessionBean/remote] and Local JNDI - [SlsSessionBean/local]
if - #Stateless(name="SlsSessionBean", mappedName="SlsSessionBeanGlobal")
Then Remote JNDI- [SlsSessionBeanGlobal] and Local JNDI - [SlsSessionBean/local]

Resources