Deploying maven web on azure - spring

Situation:
I have a local environment and I deploy the web app to a vanilla tomcat server. Application runs as intended. I deploy to Azure and I get a NPE during deployment. The Azure tomcat server is suppose to be vanilla as well.
Question
The question is why would I get an NPE in one environment preventing the app from running and not get the same NPE in a different environment when both environment as suppose to be the same? Where would I start looking?
Or to put it another way:
"Why does container.addServlet("dispatcher", new DispatcherServlet(ctx)) return null 'if this ServletContext already contains a complete ServletRegistration for the given servletName' on production? When it is not doing it in my local/dev environment.
New to java, new to azure, and hip deep in trouble.
Using eclipse with the azure toolkit plugin.
Web app runs on local tomcat server just fine. Talks to the mysql db deployed on azure just fine.
I attempted to deploy to azure. It says that it published correctly but I am receiving 404 errors. Can't figure out how to get logging to work correctly on azure but was able to get the stream working. After copying the stream and spending a lot of time formatting the output here is the only error that occurs when deploying:
07-Feb-2020 05:57:32.426 SEVERE [main] org.apache.catalina.startup.HostConfig.deployDirectory Error deploying web application directory [D:\home\site\wwwroot\webapps\hds]java.lang.IllegalStateException: Error starting child
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:716)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1133)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1868)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1045)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:429)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1577)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:309)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:424)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:367)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:934)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:831)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1382)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1372)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:907)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:423)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:933)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:637)
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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/hds]]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:441)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:713)... 37 moreCaused by: java.lang.NullPointerException
at hds.configs.ApplicationInitializer.onStartup(ApplicationInitializer.java:21)
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:172)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5120)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)... 38 more
the interesting part seems to be:
at hds.configs.ApplicationInitializer.onStartup(ApplicationInitializer.java:21)
Here is the "offending" code:
public class ApplicationInitializer implements WebApplicationInitializer {
public void onStartup(ServletContext container) throws ServletException {
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
ctx.register(WebMvcConfig.class);
ctx.setServletContext(container);
ServletRegistration.Dynamic servlet = container.addServlet("dispatcher", new DispatcherServlet(ctx));
//servlet.setLoadOnStartup(1);
servlet.setLoadOnStartup(-1);
servlet.addMapping("/");
}
}
Line 21 of the code is:
'''
servlet.setLoadOnStartup(-1);
'''
and if you need the WebMvcConfig.class:
#Configuration
#EnableWebMvc
#ComponentScan(basePackages = "hds.controllers,hds.daos,hds.services,hds.configs")
public class WebMvcConfig implements WebMvcConfigurer {
#Bean
public InternalResourceViewResolver resolver() {
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
resolver.setViewClass(JstlView.class);
resolver.setPrefix("/WEB-INF/views/");
resolver.setSuffix(".jsp");
return resolver;
}
#Bean
public MessageSource messageSource() {
ResourceBundleMessageSource source = new ResourceBundleMessageSource();
source.setBasename("messages");
return source;
}
#Override
public Validator getValidator() {
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
validator.setValidationMessageSource(messageSource());
return validator;
}
}
I have no idea why this would generate this error. Like I said before I am very new to java and azure and with full disclosure this is part of a college capstone project. creating a website instead of a cms and tying it to database is bonus.
If someone could tell me how to get the logs running on azure, that would be helpful. I went ahead and got a storage account and turned the logs on but I have no idea how to access them.
I tried using azure support and while the gentleman was nice but he was clearly out of his depth.
Like I said runs locally just fine and the configs are pretty much boiler plate (I think based on my research).

In Azure App Service you can choose between different versions of Tomcat, please make sure you are targeting the same version you are testing with.
If you still hit issue, please create an Azure support request and we will assist:
https://learn.microsoft.com/en-us/azure/azure-portal/supportability/how-to-create-azure-support-request

In the following link you will find how to enable logs for your Web App on App Service and how to stream them using the portal or CLI:
https://learn.microsoft.com/en-us/azure/app-service/troubleshoot-diagnostic-logs
You can download the Logs using FTP:
https://learn.microsoft.com/en-us/azure/app-service/deploy-ftp#get-ftp-connection-information
The logs should be in the /site/LogFiles folder.

Related

Fail to deploy service using thick client

I'm trying to deploy a simple service using a thick client, I use kubernetes job to launch a thick client, and then use ignite instance to deploy:
private void deployService() {
ServiceConfiguration serviceCfg = new ServiceConfiguration();
serviceCfg.setName("simpleService");
serviceCfg.setMaxPerNodeCount(1);
serviceCfg.setTotalCount(1);
serviceCfg.setService(new SimpleServiceImpl());
ignite.services().deploy(serviceCfg);
}
but I got the following error:
SEVERE: Failed to initialize service (service will not be deployed): simpleService
class org.apache.ignite.IgniteCheckedException: com.example.ignite_springcloud.model.ignite_service.SimpleServiceImpl at
org.apache.ignite.internal.util.IgniteUtils.unmarshal(IgniteUtils.java:11026) at org.apache.ignite.internal.processors.service.GridServiceProcessor.copyAndInject(GridServiceProcessor.java:1381) at
org.apache.ignite.internal.processors.service.GridServiceProcessor.redeploy(GridServiceProcessor.java:1302) at
org.apache.ignite.internal.processors.service.GridServiceProcessor.processAssignment(GridServiceProcessor.java:1931) at
org.apache.ignite.internal.processors.service.GridServiceProcessor.onSystemCacheUpdated(GridServiceProcessor.java:1555) at
org.apache.ignite.internal.processors.service.GridServiceProcessor.access$300(GridServiceProcessor.java:133) at
org.apache.ignite.internal.processors.service.GridServiceProcessor$ServiceEntriesListener$1.run0(GridServiceProcessor.java:1537) at
org.apache.ignite.internal.processors.service.GridServiceProcessor$DepRunnable.run(GridServiceProcessor.java:2007) at
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) Caused by: class org.apache.ignite.binary.BinaryInvalidTypeException: com.example.ignite_springcloud.model.ignite_service.SimpleServiceImpl at
org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:697) at
org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1765) at
org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1724) at
org.apache.ignite.internal.binary.GridBinaryMarshaller.deserialize(GridBinaryMarshaller.java:318) at
org.apache.ignite.internal.binary.GridBinaryMarshaller.deserialize(GridBinaryMarshaller.java:303) at
org.apache.ignite.internal.binary.BinaryMarshaller.unmarshal0(BinaryMarshaller.java:100) at
org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.unmarshal(AbstractNodeNameAwareMarshaller.java:80) at
org.apache.ignite.internal.util.IgniteUtils.unmarshal(IgniteUtils.java:11020) ... 10 more Caused by:
java.lang.ClassNotFoundException: com.example.ignite_springcloud.model.ignite_service.SimpleServiceImpl at
java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) at
java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at
java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) at
java.base/java.lang.Class.forName0(Native Method) at
java.base/java.lang.Class.forName(Class.java:398) at
org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:9503) at
org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:9441) at
org.apache.ignite.internal.MarshallerContextImpl.getClass(MarshallerContextImpl.java:325) at
org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:673) ... 170 more
Also, the service related class and interface are defined together with thick client, and I didn't provide jar or classpath on server nodes, but I set peer class loading for both client and servers:
igniteConfig.setPeerClassLoadingEnabled(true);
igniteConfig.setDeploymentMode(DeploymentMode.CONTINUOUS);
I just wonder if this is the correct way to deploy a service to server. and btw, if I deployed the service through a thick client, then that thick client left the cluster and closed, will the service be accessible and callable by other client nodes?
Peer class loading does not work for Services: https://ignite.apache.org/docs/latest/code-deployment/peer-class-loading
You have to deploy service classes manually on server nodes.
if I deployed the service through a thick client, then that thick client left the cluster and closed, will the service be accessible and callable by other client nodes
Yes.

Tomcat 8 + Spring #EnableAsync = app deployment error

I'm a mobile developer trying to develop a server side app ;-(. It is going well but now, I am facing an annoying problem, trying to run a method in asynchronous way using Spring multitasking. Basically the method is sending an email. I was reading a little about #Async spring annotation and tried to use it in my implementation.
In order to do this I had created this class:
import java.util.concurrent.Executor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
#Configuration
#EnableAsync
public class AsynchConfiguration
{
#Bean(name = "asyncExecutor")
public Executor asyncExecutor()
{
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(3);
executor.setMaxPoolSize(3);
executor.setQueueCapacity(100);
executor.setThreadNamePrefix("AsynchThread-");
executor.initialize();
return executor;
}
}
And then in my email service I added a new method:
#Async("asyncExecutor")
public void lostPetSeeAddressAsync(String nameComplete, String to, String petName, String ip, String address, String lat, String lon) throws MessagingException {
lostPetSeeAddress(nameComplete, to, petName, ip, address, lat, lon);
}
Which is just calling my previous synchro method to send emails (lostPetSeeAddress).
But after this code Tomcat is failing to deploy the app. If I remove the AsynchConfiguration class it works well. I tried to set the Async on my xml config but it is failing in the same way. The annoying part of this is the lack of error messages in Tomcat's console.
Perhaps somebody can help me with what I need to do or at least with some hint about how to debug or where to get logs about where and why is Tomcat failing.
Thanks in advance.
Edit: This is the error trace on Eclipse console, when deploy fail:
INFO: Server startup in 33305 ms
Jan 30, 2020 9:37:46 AM org.apache.coyote.http11.AbstractHttp11Processor process
INFO: Error parsing HTTP request header
Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character found in the HTTP protocol
at org.apache.coyote.http11.AbstractNioInputBuffer.parseRequestLine(AbstractNioInputBuffer.java:345)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1065)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1539)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
I finally got an error message and could solve the problem. It was caused by a cyclic dependency on com.lowagie library for itext. Here the error message:
Caused by: java.lang.IllegalStateException: Unable to complete the scan for annotations for web application [/app] due to a StackOverflowError. Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies. The class hierarchy being processed was [org.bouncycastle.asn1.ASN1EncodableVector->org.bouncycastle.asn1.DEREncodableVector->org.bouncycastle.asn1.ASN1EncodableVector]
After solving the com.lowagie library problem, Spring Async configuration works fine.
This is not a real solution but a hint for other people. Because to be honest I still having no idea about why, adding Async Spring configuration rise com.lowagie cyclic dependency problem. Perhaps Async on Spring is using org.bouncycastle? Weird, but perhaps other Spring wise people can enlighten us.

Spring Boot application failing on AutoConfigurationImportFilter not being able to be built but no class specified

So I go to start my app and it gives me this error:
java.lang.IllegalArgumentException: Unable to instantiate factory class: org.springframework.boot.autoconfigure.AutoConfigurationImportFilter
at org.springframework.core.io.support.SpringFactoriesLoader.instantiateFactory(SpringFactoriesLoader.java:167)
at org.springframework.core.io.support.SpringFactoriesLoader.loadFactories(SpringFactoriesLoader.java:104)
at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.getAutoConfigurationImportFilters(AutoConfigurationImportSelector.java:266)
at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.filter(AutoConfigurationImportSelector.java:237)
at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.selectImports(AutoConfigurationImportSelector.java:102)
at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector$AutoConfigurationGroup.process(AutoConfigurationImportSelector.java:386)
at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGrouping.getImports(ConfigurationClassParser.java:828)
at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:563)
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:188)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:316)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:233)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:271)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:91)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:692)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:530)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230)
at com.bayer.aws.agent.GeneEditBarcodeAgentApplication.main(GeneEditBarcodeAgentApplication.java:12)
Caused by: java.lang.IllegalArgumentException: Class [org.springframework.boot.autoconfigure.condition.OnBeanCondition] is not assignable to [org.springframework.boot.autoconfigure.AutoConfigurationImportFilter]
at org.springframework.core.io.support.SpringFactoriesLoader.instantiateFactory(SpringFactoriesLoader.java:162)
... 20 common frames omitted
It's not specifying what class it's failing to build however and I've got beans for all the classes that spring would try to build so I'm just confused on how to figure out what class it's missing. I really don't want to build beans for all of the classes in my apps. (like my models and controllers) Does anyone know how to go about finding out what class spring is unable to build? I can post up some of my code here but I have to be careful as this is for work so I will post up code by request for anyone that needs to see something. Thanks so much in advance for any help you can give me!
Thanks,
Jon
Edit: Here's the code for the application
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class GeneEditBarcodeAgentApplication
{
public static void main(String[] args)
{
System.out.println("Starting app");
SpringApplication.run(GeneEditBarcodeAgentApplication.class, args);
}
}
I had same issue. It got resolved by deleting spring-boot-autoconfigure folder under C:\Users\currentUser\.m2\repository\org\springframework\boot
Then in eclipse do maven update.

sun/io/MalformedInputException when trying to remotely connect to JMS queue on websphere

I am aware that a (very) similar question has been asked elsewhere but there are no answers so am posting here in the hope the new post will trigger some valuable responses.
I am trying to create a standalone app that will interrogate a JMS queue that is running on websphere. The queues are running as local apps are able to communicate with it and there are messages sitting there waiting for me.
I am using Netbeans and am using JDK1.8.
In addition I have added the following jar files to the library:
javax.jms-1.1.jar
com.ibm.ws.orb_8.5.0.jar
com.ibm.ws.ejb.thinclient_8.5.0.jar
The latter two were copied from the websphere installation.
Here is a summary of the initial code (it is actually built in a class with methods for the context and factory bits so have modified it to show here):
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(Context.PROVIDER_URL, corbaloc:iiop:192.168.254.202:2809);
try{
InitialContext jndiContext = new InitialContext(env);
}catch(NamingException e){
System.out.println("ERROR: Could not create JNDI context: " + System.lineSeparator() + e.toString());
System.exit(1);
}
ConnectionFactory connectionFactory= (ConnectionFactory) this.jndiContext.lookup(factory);
String outFactory = "jndi/OUTConnectionFactory";
try{
connectionFactory = (ConnectionFactory) jndiContext.lookup(outFactory);
}catch(Exception e){
System.out.println("ERROR: Could not create factory connection:");
System.out.println(e.toString());
System.exit(2);
}
At this point (connectionFactory = ...) it fails without triggering the catch
Exception in thread "P=598328:O=0:CT" java.lang.NoClassDefFoundError: sun/io/MalformedInputException
at com.ibm.rmi.iiop.CDRReader.getTcsCConverter(CDRReader.java:398)
at com.ibm.rmi.iiop.CDRReader.readStringOrIndirection(CDRReader.java:479)
at com.ibm.rmi.iiop.CDRReader.read_string(CDRReader.java:465)
at com.ibm.rmi.IOR.read(IOR.java:335)
at com.ibm.rmi.iiop.Connection._locate(Connection.java:480)
at com.ibm.rmi.iiop.Connection.locate(Connection.java:439)
at com.ibm.rmi.iiop.GIOPImpl.locate(GIOPImpl.java:219)
at com.ibm.rmi.corba.Corbaloc.locateUsingINS(Corbaloc.java:307)
at com.ibm.rmi.corba.Corbaloc.resolve(Corbaloc.java:378)
at com.ibm.rmi.corba.ORB.objectURLToObject(ORB.java:3721)
at com.ibm.CORBA.iiop.ORB.objectURLToObject(ORB.java:3256)
at com.ibm.rmi.corba.ORB.string_to_object(ORB.java:3619)
at com.ibm.ws.naming.util.WsnInitCtxFactory.stringToObject(WsnInitCtxFactory.java:1645)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getWsnNameService(WsnInitCtxFactory.java:1502)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootContextFromServer(WsnInitCtxFactory.java:1040)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootJndiContext(WsnInitCtxFactory.java:962)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:614)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:128)
at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:765)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:164)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:179)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at jmstool2.JmsConn.CreateFactCon(JmsConn.java:103)
at jmstool2.JmsConn.connect(JmsConn.java:59)
at jmstool2.Jmstool2.main(Jmstool2.java:21)
Caused by: java.lang.ClassNotFoundException: sun.io.MalformedInputException
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 25 more
Java Result: 1
I am really not sure where to look to resolve this error. Is it a case of finding the right .jar file or library or are there bigger issues at play here? I am a LAMP developer really and this dive into the world of Java and JMS queues is proving rather frustrating.
Many thanks
The class sun.io.MalformedInputException doesn't exist in Java 8, and also Java 8 is not supported as client to WebSphere Application Server v 8.5. Please use Java 6 or 7.

Spring SockJS unable to find registered handlers

I have registered handler for the SockJS service as
#Bean
public SimpleUrlHandlerMapping handlerMapping() {
SockJsService sockJsService = new DefaultSockJsService(sockJsTaskScheduler());
Map<String, Object> urlMap = new HashMap<String, Object>();
urlMap.put("/sockjs/cobrowse/agent/**", new SockJsHttpRequestHandler(sockJsService, coBrowseSockJsAgentHandler()));
urlMap.put("/sockjs/cobrowse/customer/**", new SockJsHttpRequestHandler(sockJsService, coBrowseSockJsCustomerHandler()));
urlMap.put("/sockjs/cobrowse/admin/**", new SockJsHttpRequestHandler(sockJsService, coBrowseSockJsAdminHandler()));
SimpleUrlHandlerMapping hm = new SimpleUrlHandlerMapping();
hm.setOrder(-1);
hm.setUrlMap(urlMap);
return hm;
}
But when I try calling from client using one of registered URLs, it throws an exception!
org.springframework.web.socket.support.ExceptionWebSocketHandlerDecorator - ERROR - Closing due to exception for SockJS session id=8cf_1l_6
java.lang.IllegalArgumentException: WebSocketHandler not found for SockJS session id=8cf_1l_6
at org.springframework.util.Assert.isTrue(Assert.java:65)
at org.springframework.web.socket.support.PerConnectionWebSocketHandler.getHandler(PerConnectionWebSocketHandler.java:91)
at org.springframework.web.socket.support.PerConnectionWebSocketHandler.handleTransportError(PerConnectionWebSocketHandler.java:97)
at org.springframework.web.socket.support.ExceptionWebSocketHandlerDecorator.handleTransportError(ExceptionWebSocketHandlerDecorator.java:79)
at org.springframework.web.socket.support.WebSocketHandlerDecorator.handleTransportError(WebSocketHandlerDecorator.java:64)
at org.springframework.web.socket.support.LoggingWebSocketHandlerDecorator.handleTransportError(LoggingWebSocketHandlerDecorator.java:66)
at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.delegateError(AbstractSockJsSession.java:188)
at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.tryCloseWithSockJsTransportError(AbstractSockJsSession.java:255)
at org.springframework.web.socket.sockjs.transport.session.WebSocketServerSockJsSession.initializeDelegateSession(WebSocketServerSockJsSession.java:122)
at org.springframework.web.socket.sockjs.transport.handler.SockJsWebSocketHandler.afterConnectionEstablished(SockJsWebSocketHandler.java:72)
at org.springframework.web.socket.adapter.StandardWebSocketHandlerAdapter.onOpen(StandardWebSocketHandlerAdapter.java:93)
at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.init(WsHttpUpgradeHandler.java:130)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:653)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1584)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1543)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
This is even more surprising because same code was running till yesterday -No major changes on my side. My guess is, it's something to do with spring jars, may be nightly update -I am using "4.0.0.BUILD-SNAPSHOT", but then I do not have previous libs!
Posting it here, if someone have came across this, meanwhile I am trying to get hold of old libs to try out - i do not know how to get it from official repo (Older version of same release!).
I spend couple of hours comparing my code against repository and tried to figure out what went wrong -when I was confident enough that I have not broken anything, I guessed that it might be that its due to the latest JAR. I use maven so my repo got updated today morning. Since libs are from Spring -this guess has to com last!
My guess turned out to be correct -when I replaced current version "4.0.0.BUILD-20130823.020236" with an earlier one which is "4.0.0.BUILD-20130814.154539-172" -Issue got resolved. Thanks a lot microsoft recycle bin!

Resources