I'm learning to programming and I'm trying to create in a page a list of booking that a user has done.
In particular, I would like to recover all the bookings made by a user using his email
I have create a JSP page:
<body>
<%=session.getAttribute("Nome") +" "+ session.getAttribute("Cognome") + " "+ session.getAttribute("Email") %>
<br>
Prenotazioni Effettuate:
<%
try{
String email=(String)session.getAttribute("Email");
// out.print("Hello "+n);
Class.forName("com.mysql.cj.jdbc.Driver");
// out.println("driver loaded");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/Hotel","root" ,"123456789");
// out.println("Connect");
Statement stmt = con.createStatement();
// out.println("conncetion successfull");
String query="";
String emailp = "";
String arrivdate = "";
query="select * from reservation where email = "+email;
ResultSet r = stmt.executeQuery(query);
while (r.next())
{
emailp = r.getString("email");
arrivdate = r.getString("arrivalDate");
%>
Email: <%= emailp %>
Arrival date: <%= arrivdate %>
<% }}
catch(Exception e)
{
}
out.close();
%>
I don't understand why nothing is printed.
Is it a query problem or a code problem that's wrong? do you know how to help me?
GRAVE: Servlet.service() for servlet [jsp] in context with path
> [/Apartment] threw exception [java.lang.IllegalStateException:
> Exception occurred when flushing data] with root cause
> java.io.IOException: Stream closed at
> org.apache.jasper.runtime.JspWriterImpl.ensureOpen(JspWriterImpl.java:187)
> at
> org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:105)
> at
> org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:180)
> at
> org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:120)
> at
> org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)
> at
> org.apache.jsp.Prenotazionieffettuate_jsp._jspService(Prenotazionieffettuate_jsp.java:198)
> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) at
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:444)
> at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> at
> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
> at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
> at
> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:651)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
> at
> org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:412)
> at
> org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
> at
> org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:754)
> at
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1385)
> at
> org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
> at java.lang.Thread.run(Thread.java:748)
I solved using this way:
String query="SELECT * FROM reservation WHERE email= '" + session.getAttribute("Email") + "'";
Related
I am attempting to use OCI Instance Principal authorization with Kafka Producer API to produce message to a OCI streams endpoint.
I am referring to the documentation provided here - https://docs.public.oneportal.content.oci.oraclecloud.com/en-us/iaas/Content/Streaming/Tasks/kafkacompatibility_topic-Configuration.htm
I run into the below issue that seems to indicate that the Jersey client instance is closed even as the attempt is being made to call the metadata service endpoint.
> 2022-08-13 07:33:17.393 INFO [,d6d94a84e30ed614,d6d94a84e30ed614] 9
> --- [tp1638249646-16] ePrincipalsAuthenticationDetailsProvider : Instance principals authentication can only be used on OCI compute
> instances. Please confirm this code is running on an OCI compute
> instance. See
> https://docs.oracle.com/en-us/iaas/Content/Identity/Tasks/callingservicesfrominstances.htm
> for more info. 2022-08-13 07:33:17.394 WARN
> [,d6d94a84e30ed614,d6d94a84e30ed614] 9 --- [tp1638249646-16]
> ientAuthenticationDetailsProviderBuilder : Attempt 1 - Rest call to
> get region from metadata service failed
>
> java.lang.IllegalStateException: Client instance has been closed. at
> org.glassfish.jersey.internal.guava.Preconditions.checkState(Preconditions.java:169)
> at
> org.glassfish.jersey.client.JerseyClient.checkNotClosed(JerseyClient.java:257)
> at
> org.glassfish.jersey.client.JerseyClient.target(JerseyClient.java:272)
> at
> org.glassfish.jersey.client.JerseyClient.target(JerseyClient.java:56)
> at
> com.oracle.bmc.auth.AbstractFederationClientAuthenticationDetailsProviderBuilder.simpleRetry(AbstractFederationClientAuthenticationDetailsProviderBuilder.java:502)
> at
> com.oracle.bmc.auth.AbstractFederationClientAuthenticationDetailsProviderBuilder.simpleRetry(AbstractFederationClientAuthenticationDetailsProviderBuilder.java:490)
> at
> com.oracle.bmc.auth.AbstractFederationClientAuthenticationDetailsProviderBuilder.executeInstanceFallback(AbstractFederationClientAuthenticationDetailsProviderBuilder.java:342)
> at
> com.oracle.bmc.auth.AbstractFederationClientAuthenticationDetailsProviderBuilder.autoDetectEndpointUsingMetadataUrl(AbstractFederationClientAuthenticationDetailsProviderBuilder.java:249)
> at
> com.oracle.bmc.auth.AbstractFederationClientAuthenticationDetailsProviderBuilder.autoDetectUsingMetadataUrl(AbstractFederationClientAuthenticationDetailsProviderBuilder.java:237)
> at
> com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider$InstancePrincipalsAuthenticationDetailsProviderBuilder.build(InstancePrincipalsAuthenticationDetailsProvider.java:99)
> at
> com.oracle.bmc.auth.sasl.InstancePrincipalsLoginModule.loadAuthenticationProvider(InstancePrincipalsLoginModule.java:31)
> at
> com.oracle.bmc.auth.sasl.OciLoginModule.initialize(OciLoginModule.java:36)
> at
> com.oracle.bmc.auth.sasl.InstancePrincipalsLoginModule.initialize(InstancePrincipalsLoginModule.java:17)
> 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
> javax.security.auth.login.LoginContext.invoke(LoginContext.java:736)
> at
> javax.security.auth.login.LoginContext.access$000(LoginContext.java:195)
> at javax.security.auth.login.LoginContext$4.run(LoginContext.java:682)
> at javax.security.auth.login.LoginContext$4.run(LoginContext.java:680)
> at java.security.AccessController.doPrivileged(Native Method) at
> javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
> at javax.security.auth.login.LoginContext.login(LoginContext.java:587)
> at
> org.apache.kafka.common.security.authenticator.AbstractLogin.login(AbstractLogin.java:60)
> at
> org.apache.kafka.common.security.authenticator.LoginManager.(LoginManager.java:62)
> at
> org.apache.kafka.common.security.authenticator.LoginManager.acquireLoginManager(LoginManager.java:105)
> at
> org.apache.kafka.common.network.SaslChannelBuilder.configure(SaslChannelBuilder.java:170)
> at
> org.apache.kafka.common.network.ChannelBuilders.create(ChannelBuilders.java:192)
> at
> org.apache.kafka.common.network.ChannelBuilders.clientChannelBuilder(ChannelBuilders.java:81)
> at
> org.apache.kafka.clients.ClientUtils.createChannelBuilder(ClientUtils.java:104)
> at
> org.apache.kafka.clients.producer.KafkaProducer.newSender(KafkaProducer.java:447)
> at
> org.apache.kafka.clients.producer.KafkaProducer.(KafkaProducer.java:428)
> at
> org.apache.kafka.clients.producer.KafkaProducer.(KafkaProducer.java:290)
> at
> org.springframework.kafka.core.DefaultKafkaProducerFactory.createRawProducer(DefaultKafkaProducerFactory.java:863)
> at
> org.springframework.kafka.core.DefaultKafkaProducerFactory.createKafkaProducer(DefaultKafkaProducerFactory.java:704)
> at
> org.springframework.kafka.core.DefaultKafkaProducerFactory.doCreateProducer(DefaultKafkaProducerFactory.java:664)
> at
> org.springframework.kafka.core.DefaultKafkaProducerFactory.createProducer(DefaultKafkaProducerFactory.java:639)
> at
> org.springframework.kafka.core.DefaultKafkaProducerFactory.createProducer(DefaultKafkaProducerFactory.java:633)
> at
> org.springframework.kafka.core.KafkaTemplate.getTheProducer(KafkaTemplate.java:752)
> at
> org.springframework.kafka.core.KafkaTemplate.doSend(KafkaTemplate.java:638)
> at
> org.springframework.kafka.core.KafkaTemplate.send(KafkaTemplate.java:429)
> at
> com.oracle.cxmarketing.messaging.kafka.producer.KafkaMessageProducer.send(KafkaMessageProducer.java:84)
> at
> com.oracle.cxmarketing.messaging.kafka.producer.KafkaMessageProducer.send(KafkaMessageProducer.java:78)
> at
> com.oracle.centralpod.poc.streams.messaging.producer.AccountsProducer.produceMessage(AccountsProducer.java:19)
> at
> com.oracle.centralpod.poc.streams.service.impl.StreamsPocServiceImpl.sendMessage(StreamsPocServiceImpl.java:22)
> at
> com.oracle.centralpod.poc.streams.web.controller.v1.StreamsPocController.sendMessage(StreamsPocController.java:33)
The container that executes this code is running within an OCI compute instance.
Can I get help to understand the cause of this issue?
I initially wanted to migrate a JAVA EE project into maven. However, I ran into a dispatching error.
I got this stack trace in the file :
C:\Program Files using(x86)\IBM\WebSphere\AppServer\profiles\AppSrv01\logs\My_SERVER\SystemOut.log
> [22/03/18 07:46:32:755 VET] 00000020 XmlConfigurat I
> com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
> Parsing configuration file [struts-default.xml] [22/03/18 07:46:32:766
> VET] 00000020 XmlConfigurat I
> com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
> Parsing configuration file [struts-plugin.xml] [22/03/18 07:46:32:812
> VET] 00000020 XmlConfigurat I
> com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
> Parsing configuration file [struts.xml] [22/03/18 07:46:32:814 VET]
> 00000020 DefaultConfig I
> com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
> Overriding property struts.i18n.reload - old value: false new value:
> true [22/03/18 07:46:32:814 VET] 00000020 DefaultConfig I
> com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
> Overriding property struts.configuration.xml.reload - old value: false
> new value: true [22/03/18 07:46:32:858 VET] 00000020 Dispatcher E
> com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
> Dispatcher initialization failed
> java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at
> com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:295)
> at
> com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:431)
> at
> com.opensymphony.xwork2.inject.ContainerBuilder$5.create(ContainerBuilder.java:207)
> at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51) at
> com.opensymphony.xwork2.inject.ContainerBuilder$3.create(ContainerBuilder.java:93)
> at
> com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:487)
> at
> com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:484)
> at
> com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:574)
> at
> com.opensymphony.xwork2.inject.ContainerBuilder.create(ContainerBuilder.java:484)
> at
> com.opensymphony.xwork2.config.impl.DefaultConfiguration.createBootstrapContainer(DefaultConfiguration.java:252)
> at
> com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:193)
> at
> com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
> at
> org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415)
> at
> org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)
> at
> com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:140)
> at
> com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:509)
> at
> com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:423)
> at
> com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:282)
> at
> com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:340)
> at
> com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:812)
> at
> com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:917)
> at
> com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.invokeFilters(DefaultExtensionProcessor.java:924)
> at
> com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:852)
> at
> com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3610)
> at
> com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:274)
> at
> com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:926)
> at
> com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1557)
> at
> com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:173)
> at
> com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
> at
> com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
> at
> com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
> at
> com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1772)
> at
> com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
> at
> com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
> at
> com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
> at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) at
> com.ibm.io.async.ResultHandler.complete(ResultHandler.java:202) at
> com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:766)
> at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:896) at
> com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1527) Caused by:
> java.lang.reflect.InvocationTargetException at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
> at java.lang.reflect.Method.invoke(Method.java:599) at
> com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:293)
> ... 40 more Caused by: java.lang.NoClassDefFoundError:
> ognl.OgnlRuntime (initialization failure) at
> java.lang.J9VMInternals.initialize(J9VMInternals.java:140) at
> com.opensymphony.xwork2.ognl.OgnlValueStackFactory.setContainer(OgnlValueStackFactory.java:85)
> ... 45 more
>
> [22/03/18 07:46:32:860 VET] 00000020 webapp E
> com.ibm.ws.webcontainer.webapp.WebApp logError SRVE0293E: [Erreur du
> servlet]-[ognl.OgnlRuntime (initialization failure)] :
> java.lang.reflect.InvocationTargetException - Class:
> com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector File:
> ContainerImpl.java Method: inject Line: 295 -
> com/opensymphony/xwork2/inject/ContainerImpl.java:295:-1 at
> org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:428) at
> org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)
> at
> com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:140)
> at
> com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:509)
> at
> com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:423)
> at
> com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:282)
> at
> com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:340)
> at
> com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:812)
> at
> com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:917)
> at
> com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.invokeFilters(DefaultExtensionProcessor.java:924)
> at
> com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:852)
> at
> com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3610)
> at
> com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:274)
> at
> com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:926)
> at
> com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1557)
> at
> com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:173)
> at
> com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
> at
> com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
> at
> com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
> at
> com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1772)
> at
> com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
> at
> com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
> at
> com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
> at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) at
> com.ibm.io.async.ResultHandler.complete(ResultHandler.java:202) at
> com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:766)
> at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:896) at
> com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1527) Caused by:
> java.lang.RuntimeException:
> java.lang.reflect.InvocationTargetException at
> com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:295)
> at
> com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:431)
> at
> com.opensymphony.xwork2.inject.ContainerBuilder$5.create(ContainerBuilder.java:207)
> at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51) at
> com.opensymphony.xwork2.inject.ContainerBuilder$3.create(ContainerBuilder.java:93)
> at
> com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:487)
> at
> com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:484)
> at
> com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:574)
> at
> com.opensymphony.xwork2.inject.ContainerBuilder.create(ContainerBuilder.java:484)
> at
> com.opensymphony.xwork2.config.impl.DefaultConfiguration.createBootstrapContainer(DefaultConfiguration.java:252)
> at
> com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:193)
> at
> com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
> at
> org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415)
> ... 27 more Caused by: java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
> at java.lang.reflect.Method.invoke(Method.java:599) at
> com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:293)
> ... 40 more Caused by: java.lang.NoClassDefFoundError:
> ognl.OgnlRuntime (initialization failure) at
> java.lang.J9VMInternals.initialize(J9VMInternals.java:140) at
> com.opensymphony.xwork2.ognl.OgnlValueStackFactory.setContainer(OgnlValueStackFactory.java:85)
> ... 45 more
>
> [22/03/18 07:46:32:873 VET] 00000020 srt W
> com.ibm.ws.webcontainer.srt.SRTServletResponse addHeader WARNING:
> Cannot set header. Response already committed. [22/03/18 07:46:32:874
> VET] 00000020 srt W
> com.ibm.ws.webcontainer.srt.SRTServletResponse setHeader WARNING:
> Cannot set header. Response already committed. [22/03/18 07:46:32:875
> VET] 00000020 srt W
> com.ibm.ws.webcontainer.srt.SRTServletResponse setHeader WARNING:
> Cannot set header. Response already committed. [22/03/18 07:46:32:875
> VET] 00000020 srt W
> com.ibm.ws.webcontainer.srt.SRTServletResponse setDateHeader WARNING:
> Cannot set header. Response already committed.
I added this dependency to my POM.xml (I thought that it's missing)
<dependency>
<groupId>org.apache.struts.xwork</groupId>
<artifactId>xwork-core</artifactId>
<version>2.2.1</version>
</dependency>
But I still have the error.
Can anyone tell me what I'm missing? Is it perhaps because I'm using Eclipse NEON1?
I have JDK1.7.0_71 and Websphere 7.0.0.
JAVA_HOME=C:\Program Files (x86)\Java\jdk1.7.0_71
MAVEN_HOME=D:\Maven\apache-maven-3.3.9
Caused by: java.lang.NoClassDefFoundError:
ognl.OgnlRuntime (initialization failure) at
You have missing OGNL dependencies on class path at run time.
The xwork-core is transitive dependency for struts2-core artifact.
OGNL is also transitive dependency.
Regarding the second error:
Response has been already commuted.
Struts is trying to return error result by using servlet response internally or forward to the error page by it can't do it if response has been commuted. The response becomes commuted as soon as the buffer is flushed. You should check the size of buffer on the response object and how much bytes has written to it.
javassist dependency was messing.
I added this dependeny on the POM file :
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.12.1.GA</version>
</dependency>
and it works for me.
I've been making a database for a flight company, and one of the requirements is to allow customers to search for flight schedules in order for them to book flights. However, when I run my code, I keep getting errors. I've tried looking through my code many times, but I still can't seem to find out where the problem is. The error message that I got was that there was a problem with the line if(rs.next()){, but it doesn't show any red underline when I'm looking through the code editor. Instead, the parts that have the red underlines are all my <tr> and <td> tags.
Also, I would appreciate it if someone can teach me how to create a dropdown table for the origin_airport and destination_airport datafields, so that users can choose.
Here's my code:
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Member Login</title>
</head>
<body>
<form>
<table>
<%#page import="java.sql.*" %>
<%
String user = request.getParameter("user");
out.println("Welcome, "+user);
out.println("<br>Account status: Member");
out.println("<br>What flight do you want to search for today?");
String origin=request.getParameter("origin_airport");
String dest=request.getParameter("destination_airport");
String depart=request.getParameter("departure_time");
String arrival=request.getParameter("arrival_time");
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url="jdbc:mysql://localhost/testing";
String username="root";
String password="password";
Connection conn=DriverManager.getConnection(url,username,password);
Statement st=conn.createStatement();
ResultSet rs = st.executeQuery("select * from flight_schedule where origin_airport='"+origin+"'");
ResultSet rs1 = st.executeQuery("select * from flight_schedule where destination_airport='"+dest+"'");
ResultSet rs2 = st.executeQuery("select * from flight_schedule where departure_time='"+depart+"'");
ResultSet rs3 = st.executeQuery("select * from flight_schedule where arrival_time='"+arrival+"'");
if(rs.next()){
%>
<tr><td>Origin airport: </td><td<input type="text" value="<%=rs.getString("origin_airport")%>" > </td></tr>
<tr><td>Destination airport: </td><td<input type="text" value="<%=rs1.getString("destination_airport")%>" > </td></tr>
<tr><td>Departure date: </td><td<input type="text" value="<%=rs2.getString("departure_time")%>" > </td></tr>
<tr><td>Arrival date: </td><td<input type="text" value="<%=rs3.getString("arrival_time")%>" > </td></tr>
<%
}
%>
</form>
</table>
</body>
</html>
I would really appreciate it if someone could take their time and help me by pointing me in the right direction. Thanks in advance.
The error message shown on Eclipse: An exception occurred processing JSP page [/Homescreen_Member.jsp] at line [33]
Exception of error:
org.apache.jasper.JasperException: An exception occurred processing JSP page [/Homescreen_Member.jsp] at line [33]
30: ResultSet rs1 = st.executeQuery("select * from flight_schedule where destination_airport='"+dest+"'");
31: ResultSet rs2 = st.executeQuery("select * from flight_schedule where departure_time='"+depart+"'");
32: ResultSet rs3 = st.executeQuery("select * from flight_schedule where arrival_time='"+arrival+"'");
33: if(rs.next()){
34: %>
35: <tr><td>Origin airport: </td><td<input type="text" value="<%=rs.getString("origin_airport")%>" > </td></tr>
36: <tr><td>Destination airport: </td><td<input type="text" value="<%=rs.getString("destination_airport")%>" > </td></tr>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:588)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:466)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Root cause:
javax.servlet.ServletException: java.sql.SQLException: Operation not allowed after ResultSet closed
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:669)
org.apache.jsp.Homescreen_005fMember_jsp._jspService(Homescreen_005fMember_jsp.java:178)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:443)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Root Cause
java.sql.SQLException: Operation not allowed after ResultSet closed
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964)
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:897)
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:886)
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:860)
com.mysql.jdbc.ResultSetImpl.checkClosed(ResultSetImpl.java:743)
com.mysql.jdbc.ResultSetImpl.next(ResultSetImpl.java:6303)
org.apache.jsp.Homescreen_005fMember_jsp._jspService(Homescreen_005fMember_jsp.java:142)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:443)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
The Javadoc for Statement says "By default, only one ResultSet object per Statement object can be open at the same time." You've opened three other ResultSets before accessing the first one, each causing the previous ResultSet to be closed, and you can't do that.
I'm working in ICIMS API. I need to return JSON data and some specific data in header in a cfm page call by ICIMS server.
Here is the response should be:
Response to the Work Flow Status Change PUSH event to the platform:
HTTP/1.1 303 See Other
Location: http://xx.xx.xx.xx:8085/selectpackage?systemHash=101
Content-Type: application/json
{
"userMessage":"Confirm or modify package.",
}
Thanks in advance.
Answer:
> <cfset contentString = '{"userMessage": "Confirm or modify package."}'
> />
>
> <cfheader name="Location"
> value="http://xx.xx.xx.xx:8085/selectpackage?systemHash=101" />
> <cfcontent type="application/json" variable="#toBinary( toBase64( contentString ) )#" />
<cfheader
statusCode = "303"
statusText = "See Other">
<cfheader
name="Location"
value="http://xx.xx.xx.xx:8085/selectpackage?systemHash=101">
<cfheader
name="Content-Type"
value="application/json">
<cfset foo = structNew()>
<cfset foo["userMessage"] = "Confirm or modify package.">
<cfoutput>#serializeJSON(foo)#</cfoutput>
I have a table in whose column I show both a image and text.Image is being displayed on upper side and text is being displayed below it.But I want to show both side by side.Moreover I want table to be fit on screen i.e I don't want to have scroll bars.
My Html code is
<% #page language = "java"
contentType = "text/html; charset=ISO-8859-1"
pageEncoding = "ISO-8859-1" %>
<% #taglib uri = "http://java.sun.com/jsp/jstl/core"
prefix = "c" %>
<% #taglib prefix = "fmt"
uri = "http://java.sun.com/jsp/jstl/fmt" %>
< !DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd" >
< html >
< head >
< meta http - equiv = "refresh"
content = "30" >
< title > Insert title here < /title>
<style>
.green {
color: green;
text-transform: capitalize;
}
.red {
color: red;
text-transform: capitalize;
}
</div >
< /style>
</head >
< body style = 'margin:0;padding:0;' >
< jsp: useBean id = "bs"
class = "beam_Status.BeamStatus_Bean" >
< /jsp:useBean>
<div id="loadData">
<CENTER><H1>BEAMLINE STATUS</H1 > < /CENTER>
<center>
<table border = "1" width="100%" height="60">
<tr>
<th><h1><b>BEAMLINES</b > < /h1></th >
< th > < h1 > < b > STATUS < /b></h1 > < /th>
</tr >
< c: forEach
var = "country"
items = "${bs.beam_CurrentStatus()}" >
< h3 > < b >
< c: choose >
< c: when test = "${country.value == 'IN OPERATION'}" >
< tr >
< td class = "green"
style = "text-transform: uppercase;" > < center > < h2 > $ {
country.key
} < /h2></center > < /td>
<td class="green" style="text-transform: uppercase; " ><img style="vertical-align:middle;" src = "red.png" height="50" width="50" / > < h2 > $ {
country.value
} < /h2></td >
< /tr>
</c: when >
< c: otherwise >
< tr >
< td class = "red"
style = "text-transform: uppercase; " > < center > < h2 > $ {
country.key
} < /h2></center > < /td>
<td class="red" style="text-transform: uppercase; " ><img style="vertical-align:middle;" src = "green.png" height="50" width="50" / > < h2 > $ {
country.value
} < /h2> </td >
< /tr>
</c: otherwise >
< /c:choose>
</b > < /h3>
</c: forEach >
< /table>
</center >
< /div>
<script>
< /html >
My output.
I want the second column text and image to be aligned side by side and table to fit the screen.
Thanks in advance.
Got it, just added
display: inline-block
<h2 style="vertical-align:middle; display: inline-block;">
I think it's simpler to break the column with image and text in 2 distinct columns: 1 for the image and 1 for the text. In css you can use: table {width:100%}
Make the following changes in the image tag:
add display:block and add float:left
In the text to show it side by side, just add float:left assuming text is inside a block element like a p tag.
For table to occupy full screen use width:100%;