cannot send message to weblogic queues - java

Iam trying to send a string message into a JMS queue created in weblogic server. Iam using Eclipse ide and when i run my web application i get the following error and the tomcat server gets shutdown.The error is
javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalException: failed to unmarshal class weblogic.security.acl.internal.AuthenticatedUser; nested exception is:
java.io.StreamCorruptedException: invalid type code: 31]
at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:74)
at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:32)
at weblogic.jndi.WLInitialContextFactoryDelegate.toNamingException(WLInitialContextFactoryDelegate.java:773)
at weblogic.jndi.WLInitialContextFactoryDelegate.pushSubject(WLInitialContextFactoryDelegate.java:673)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:466)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:373)
at weblogic.jndi.Environment.getContext(Environment.java:307)
at weblogic.jndi.Environment.getContext(Environment.java:277)
at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:117)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at com.infotech.jms.JMSBEAQueueSend.sendMessage(JMSBEAQueueSend.java:48)
at com.infotech.struts.actions.AppAction.execute(AppAction.java:75)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
Caused by: java.rmi.UnmarshalException: failed to unmarshal class weblogic.security.acl.internal.AuthenticatedUser; nested exception is:
java.io.StreamCorruptedException: invalid type code: 31
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:229)
at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:224)
at weblogic.common.internal.RMIBootServiceImpl_1001_WLStub.authenticate(Unknown Source)
at weblogic.security.acl.internal.Security$1.run(Security.java:185)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.security.acl.internal.Security.authenticate(Security.java:181)
at weblogic.jndi.WLInitialContextFactoryDelegate.authenticateRemotely(WLInitialContextFactoryDelegate.java:734)
at weblogic.jndi.WLInitialContextFactoryDelegate.pushSubject(WLInitialContextFactoryDelegate.java:667)
... 29 more
Caused by: java.io.StreamCorruptedException: invalid type code: 31
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:195)
at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:565)
at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:191)
at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:62)
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:227)
... 37 more
Please help me out.Thanks and best regards

Based on a some quick research into this issue, it appears to be caused by using different JDK levels between the app server and the client. Most of the examples I have seen have shown it to occur when using Java 6 on the client while running Weblogic on Java 5.
While I have not personally tried it, the recommendation is to add the following to your client application's startup command:
-Dsun.lang.ClassLoader.allowArraySyntax=true
Setting this property enables a backwards compatibility mode in the ClassLoader's loadClass method.
Here is a link to an Oracle forum question that provides some additional information.
Alternatively, you would have to look at making sure the client and server are running the same JVM level if you are performing direct integrations. Obviously, this is not usually the optimal solution.

Related

not getting solution for error 500 whose root cause is java.lang.NoClassDefFoundError: java/sql/Driver

I am using eclipse photon and i am getting error 500, i have got some solution but not for my specific problem,that is-
java.lang.NoClassDefFoundError: java/sql/Driver
i dont understand how to remove java/sql/Driver type of error.
Here is my Error-
HTTP Status 500 – Internal Server Error
Type Exception Report
Message Servlet execution threw an exception
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
javax.servlet.ServletException: Servlet execution threw an exception
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Root Cause
java.lang.NoClassDefFoundError: java/sql/Driver
java.base/java.lang.ClassLoader.findBootstrapClass(Native Method)
java.base/java.lang.ClassLoader.findBootstrapClassOrNull(Unknown Source)
java.base/java.lang.System$2.findBootstrapClassOrNull(Unknown Source)
java.base/jdk.internal.loader.ClassLoaders$BootClassLoader.loadClassOrNull(Unknown Source)
java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(Unknown Source)
java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
java.base/java.lang.ClassLoader.loadClass(Unknown Source)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1247)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1157)
java.base/java.lang.Class.forName0(Native Method)
java.base/java.lang.Class.forName(Unknown Source)
com.login.LoginCDao.getLoginC(LoginCDao.java:12)
com.login.GetLogin.doGet(GetLogin.java:23)
`javax.servlet.http.HttpServlet.service(HttpServlet.java:634`)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Note The full stack trace of the root cause is available in the server logs.
Apache Tomcat/9.0.13
Make sure you have driver jar set in classpath properly. For instance mysql-connector in case you are using mysql.
In case of oracle, Download the appropriate ojdbc6.jar JDBC driver file for your database version here

ClassFormatError : Unknown constant tag

I do face a problem with Java when sending an URL to Alfresco.
When a user logs into the my website, through Joomla, the server calls for the CRM, then passes the credentials to Alfresco
The URL is designed as follows :
https://example.com:8553/alfresco/testlogin.jsp?Itemid=1&username=USERNAME&password=PASSWD
A little background of the project :
This occurs on a replicate of an existing (and functional) webserver. The error appears when logging into the new webserver, which is an exact replication of the previously used server.
Browsing the web I've found several answers suggering to either copy and paste the Java folder, or to re-install it directly. I did both of those and none of them worked so far.
Moreover, this is the alfrescoTomcat log, which is the same as shown on the screenshot :
Jul 31, 2017 3:01:48 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.ClassFormatError: Unknown constant tag 61 in class file org/apache/jsp/testlogin_jsp
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
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.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:134)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
at org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:621)
at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:144)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:558)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
This is the only difference with the old server logs.
I am kinda new to such problems and would require your help to get this through. Either by redirecting me to a correct solution I may have missed or by clearing it up for me.
Thanks for your time and consideration.
I am gonna give this tip if anyone encounters the same problem :
What I did to fix this error was simply to rename my script (the one who triggered the error) to old.script.jsp. Then using notepad++ I copied/pasted the code and saved it under the old name script.jsp.
Everything works fine by now.

Upgrade repast simphony version 1.2 to repast 2.0

I need your help. I'm running a repast simulation from another Java application.
What I intend to do is to upgrade the repast version 1.2 to the repast version 2.0.
How can I do this?
I tried to replace the repast.simphony.bin_and_src.jar with the latest version of it (repast 2.0) but such an error occurs:
repast.simphony.scenario.ScenarioLoadException: C:\workspace\.metadata\.plugins\...\score.rs\user_path.xml (The system cannot find the file specified)
at repast.simphony.scenario.ScenarioLoader.load(ScenarioLoader.java:219)
at lab.MyRunner.load(MyRunner.java:45)
at lab.MyExperiment.<init>(MyExperiment.java:39)
at servlets.SimServlet.doPost(SimServlet.java:126)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run (Unknown Source)
Caused by: java.io.FileNotFoundException: C:\workspace\.metadata\.plugins\...\score.rs\user_path.xml (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileReader.<init>(Unknown Source)
at repast.simphony.scenario.data.UserPathFileReader.read(UserPathFileReader.java:43)
at repast.simphony.scenario.ScenarioLoader.load(ScenarioLoader.java:108)
I saw your question as I have this problem too. I found the cause of the problem in
this email group. For those that aren't interested in clicking on a link, the problem arises because user_path.xml files were introduced with Repast Simphony 2.0, whereas earlier versions do not use this file.
There is apparently an automated method to update your old packages, see section 2.5 here. But there could still be issues with the code.
I'm going to try to reconstruct the program I'm trying to use in the latest version. As Nick says in his reply in that archive, the alternative is to install an earlier version of RS which doesn't have user_path.xml files.

java.io.FileNotFoundException:(Access is denied) at java.io.FileInputStream.open(Native Method) Remote Tomcat Server read excel client machine

I am working on a Web application that reads the excel file from the specified path and imports the data in the excel file to the oracle database. This functionality is absolutely working when I run it on my local tomcat machine but when I deploy it on the remote tomcat server It throws the following exception:
java.io.FileNotFoundException: Z:\02_Information_DataBase\ImportingTool\eMan.xls (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at modules.report.dao.POIExcelReaderDao.displayFromExcel(POIExcelReaderDao.java:156)
at modules.report.service.POIExcelReaderService.displayFromExcel(POIExcelReaderService.java:91)
at modules.report.controller.ReportController.service(ReportController.java:118)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at modules.index.controller.IndexController.service(IndexController.java:87)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source
The remote tomcat server has enough permissions to the specified file path but even then it says that the access is denied.
I went through a lot of surfing on internet but in vain....none of the solutions helped me out. Could anyone share a piece of information regarding the issue .....???
Z sounds like a mapped drive.
Mapped drives are not available for serverprocesses, that are startet as a service, even if they are running as a user.
Use the full qualified UNC-path instead.
*update:
It is possible to map the drive by the process itself and use it, but you should not do this.

Migration of java application from Windows to linux server

I am trying to migrate a java application which consist of some graph charts from Windows to Linux but I am getting following the exception:
java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)
at java.awt.Window.<init>(Window.java:432)
at java.awt.Frame.<init>(Frame.java:403)
at java.awt.Frame.<init>(Frame.java:368)
at javachart.servlet.Bean.makeURLImage(Unknown Source)
at javachart.applet.ParameterParser.makeURLImage(Unknown Source)
at javachart.applet.ParameterParser.populateGc(Unknown Source)
at javachart.applet.ParameterParser.getDatasetPropertiesFromParameters(Unknown Source)
at javachart.applet.ParameterParser.getDatasetParameters(Unknown Source)
at javachart.applet.ParameterParser.getDataset(Unknown Source)
at javachart.applet.ParameterParser.getDatasets(Unknown Source)
at javachart.applet.ParameterParser.getOptions(Unknown Source)
at javachart.servlet.Bean.getOptions(Unknown Source)
at javachart.servlet.labelLineApp.init(Unknown Source)
at javachart.servlet.Bean.buildChart(Unknown Source)
at javachart.servlet.Bean.generate(Unknown Source)
at javachart.servlet.Bean.getFileName(Unknown Source)
at org.apache.jsp.www.SaveHtml.chartByHotelSNS_jsp._jspService(chartByHotelSNS_jsp.java:676)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:662)
I also tried with setting the Display environment variable through Putty but that also didn't work.
Can anyone tell me where exactly the problem is?
Is it in the application or linux side?
You need to somehow set System.setProperty("java.awt.headless", "true");
Tell the server team to start whatever Java they are starting with an additional command line parameter
java -Djava.awt.headless=true
I believe, the root cause of your issue is that the linux server doesn't have X11 installed, on the other hand the code you're running uses the graphics environment, or at least your graphical output is not configured properly.
I think this article can be useful in this case.
In addition the link provided by Alex K can also be an answer to your question.
Good Luck!
Either set the following sytem property (if X11 is installed):
DISPLAY=:0.0
export DISPLAY
Or start your own dummy X11 server. Example:
vncserver :1
export DISPLAY=:1
Or have a look at Xvfb

Categories

Resources