I'm using a setup specified in the title. Nothing unusual.
Many times (almost always), after saving a file (HTML or JS! Not even Java!), and re-loading the webpage hosted on this Tomcat (which uses Jersey & Jaxb etc), I get a bunch of:
Apr 10, 2014 12:52:23 PM com.sun.jersey.spi.container.ContainerResponse logException
SEVERE: Mapped exception to response: 500 (Internal Server Error)
javax.ws.rs.WebApplicationException: javax.xml.bind.JAXBException - with linked exception:
[java.io.FileNotFoundException: ... loader/META-INF/services/javax.xml.bind.JAXBContext (No such file or directory)]
at com.sun.jersey.core.provider.jaxb.AbstractRootElementProvider.writeTo(AbstractRootElementProvider.java:159)
What have I done to deserve this? :-)
The implication is that I have to stop, and re-start Tomcat every time, and that wastes a lot of time.
PS
'Automatic publish after build event' = true
module--> auto reload = false
I spent hours trying to solve this, googling the hell out of these terms, and getting back a lot of irrelevant stuff.
Thank you!
Related
I am trying to authenticate user using FormLoginHandler and Postgresql Database with SqlAuthentication.
But I get the following error:
Jun 15, 2022 1:14:34 PM io.vertx.ext.web.RoutingContext
SEVERE: Unhandled exception in router
io.vertx.ext.web.handler.HttpException: Unauthorized
Caused by: io.vertx.core.impl.NoStackTraceThrowable: Invalid username/password
I am providing the right credentials.
The code snippet is:
SqlAuthenticationOptions sauthopts = new SqlAuthenticationOptions();
sauthopts.setAuthenticationQuery(AUTHENTICATE_QUERY);
SqlAuthentication authenticationProvider = SqlAuthentication.create(sqlClient, sauthopts);
router.route("/secure/*").handler(RedirectAuthHandler.create(authenticationProvider, "/login.html"));
FormLoginHandler formLoginHandler = FormLoginHandler.create(authenticationProvider);
router.route("/loginhandler").handler(formLoginHandler);
Please let me know if I am missing something here; or point me to a sample example.
Thanks in Advance.
Your setup doesn't show anything abnormal at first sight. For security reasons, we cannot "just" log the authentication data, as it would be a critical OWASP bug and security vulnerability.
My best guess is that probably is something not totally correct with the query, so this means you have now 2 options:
debug the application and see the query that is being sent + the arguments
prepare a small complete example that shows the bug and open an issue in vert.x so we can debug it further.
If you're upgrading from an older version, be aware that in vert.x 4.2.0 some changes were made to the base64 encoding to keep it consistent across modules. This could be a reason why authentication could fail as the encoded hashes may be slightly different. If you're just doing 4.3.0 from the start, then this would not be a problem.
I'm attempting to load my war file to Tomcat 6 and constantly get this error:
May 20, 2014 12:35:42 AM org.apache.catalina.startup.ContextConfig
init
SEVERE: Exception fixing docBase for context [/MyService]
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
...
May 20, 2014 12:35:42 AM org.apache.catalina.core.StandardContext resourcesStart
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Invalid or unreadable WAR file : error in opening zip file
I've found several suggestions and tried them all, still stumped.
Moved the file to a diff directory, then copied to webapps
Changed the file permissions before moving to webapps
Stopped Tomcat, delete the old, add the new, then restart
Added a random class to the war before re-deploying
Uninstalled tomcat6 (also removing the tomcat6 directory) and re-installed tomcat6 fully
Here's the strangest part - I've also taken old wars (older versions of the same app) that used to work on this same server, and those don't work either (same error), even after re-installing Tomcat. This leads me to believe it's a Tomcat problem, however the uninstall didn't fix anything.
Also, I've created war files from this same project (Eclipse) and deployed them fine to a different tomcat6 server. Also, when I run the app on my dev box localhost Eclipse/Tomcat connecting to the same database remotely, everything works fine.
When I actually make an http request, the app is deployed, however I have a static initializer that is not working and causing a null pointer exception. I assume this is related to the
SEVERE: Error starting static Resources
Here is the static initializer, it is creating a BoneCP connection pool, which also has always worked and I confirmed that MySQL is working fine (replication is also still occurring - it is a slave MySQL). The connectionPool object is null and I don't get a stack trace in my logs for the openPool() method, I also don't see any root connections to MySQL:
protected static BoneCP connectionPool = null;
static
{
openPool();
}
protected static void openPool()
{
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
BoneCPConfig config = new BoneCPConfig();
config.setJdbcUrl("jdbc:mysql://localhost:3306/mydatabase");
config.setUsername("root");
config.setPassword("mypassword"); //SLAVE
config.setMinConnectionsPerPartition(2);
config.setMaxConnectionsPerPartition(6);
config.setPartitionCount(7);
connectionPool = new BoneCP(config);
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
Welp, I figured this out...
Somehow the password for the mysql root user was changed, which is very odd since I'm the ONLY person that ever touches any of this. I have a feeling MySQLWorkbench somehow did this without me knowing? I just recently installed a new version (6.1).
Basically this seems to be a catch all error, which I saw some people mention on other threads, so I've been on a 4 day wild goose chase. The only reason I figured this out was because I finally tried to log in to mysql as root through the console, in retrospect I should have tried that earlier.
Is it possible to let the server send messages to all connected clients without waiting for any action from them? Let me explain it :-) I've been reading the docs/examples and I have found nothing that satifies my needs: the flow is always the same; a client connects (e.g: a GET call to a Rest API), the connection is suspendend and until a new API call is received (e.g.: a POST call) the server simply waits (or at least this is what I have understood). My use case is pretty different: I want the server to send some "notifications" once new data become available. This would be my use case (pretty simplifed):
Client A connects to server
Connection is suspended since no new data is available at the moment
The server gets notified new data is available from an external
source and broadcasts it to client A
Go to step 2
What I have achieved so far is getting the connection successfully established. The next step is to solve this server issue. I must say this technology is completely new to me so it is possible I misunderstood how something works. If that's the case, let me know!
This is my stack:
Spring 3.2.0 RELEASE
Jersey 1.8
Atmosphere Jersey 1.0.13
Tomcat 7.0.40
Thank you all in advance!
UPDATE: After following this I get this warning, which I have no idea how to get rid of:
2013-06-04 09:40:36,284 WARN [org.atmosphere.cpr.AtmosphereFramework] - Failed using comet support: org.atmosphere.container.Tomcat7AsyncSupportWithWebSocket, error: Tomcat failed to detect this is a Comet application because context.xml is missing or the Http11NioProtocol Connector is not enabled.
If that's not the case, you can also remove META-INF/context.xml and WEB-INF/lib/atmosphere-compat-tomcat.jar Is the Nio or Apr Connector enabled?
2013-06-04 09:40:36,285 WARN [org.atmosphere.cpr.AtmosphereFramework] - Using org.atmosphere.container.Tomcat7BIOSupportWithWebSocket
I followed the app structure commented here, so this should not be a problem. I have noticed that by changing the transport to "websocket" instead of "long-polling" shows no errors. The server finally sends data tough :)
I followed your link and modified the code a little.
When you are in the step 3 "The server gets notified new data is available from an external source and broadcasts it to client A", you have to write a line like this:
BroadcasterFactory.getDefault().lookup("/*").broadcast(response);
At first I used the TextMessage received from my ActiveMQ Queue but I get this error, so I used a Jackson class as an object response and everything worked fine.
SEVERE: A message body writer for Java class org.apache.activemq.command.ActiveMQTextMessage, and Java type class org.apache.activemq.command.ActiveMQTextMessage, and MIME media type application/json was not found
jun 03, 2014 11:32:21 AM com.sun.jersey.spi.container.ContainerResponse write
SEVERE: The registered message body writers compatible with the MIME media type are:
application/json (JSONJAXBElementProvider, JSONArrayProvider, JSONObjectProvider, JSONRootElementProvider, JSONListElementProvider, ...)
I'm trying to learn to work with bpel. I choose Eclipse Bpel Designer and apache ode (on a tomcat server) in order to experiment. The process I tried to model was a loan process. It has 3 services: a creditRate service (written in eclipse bpel designer and deployed befo-hand an tested that it works), a currency converter service, and the main orchestration process. While I had no errors on deployment when testing the web service from eclipse following errors occur:
ERROR [ExternalService] Error sending message to Axis2 for ODE mex
{PartnerRoleMex#hqejbhcnphr87mcnd0np43 [PID
{CreditBuletinNamespace}CreditBuletin-137] calling
org.apache.ode.bpel.epr.WSAEndpoint#a64453.getRating(...) Status
REQUEST} org.apache.ode.axis2.OdeFault: Binding operation not found:
service {http://www.webserviceX.NET/}CurrencyConvertor port
CurrencyConvertorSoap name getRating. at
org.apache.ode.axis2.util.SoapMessageConverter.createSoapRequest(SoapMessageConverter.java:154)
and
Failure during invoke: Error sending message to Axis2 for ODE mex
{PartnerRoleMex#hqejbhcnphr87mcnd0np43 [PID
{CreditBuletinNamespace}CreditBuletin-137] calling
org.apache.ode.bpel.epr.WSAEndpoint#a64453.getRating(...) Status
REQUEST} 21:09:14,421 INFO [BpelRuntimeContextImpl] ActivityRecovery:
Registering activity 19, failure reason: Error sending message to
Axis2 for ODE mex {PartnerRoleMex#hqejbhcnphr87mcnd0np43 [PID
{CreditBuletinNamespace}CreditBuletin-137] calling
org.apache.ode.bpel.epr.WSAEndpoint#a64453.getRating(...) Status
REQUEST} on channel 33
Can someone help me out with a solution? I have searched for some solution but have not found one that works. It may be that due to my poor knowledge I am not searching right or not doing something right. Because this description may be confusing I have attached my solution because I believe they will tell more of what I'm trying to do and how wrong I am doing it. http://www.mediafire.com/?9bjgt44spln1zwr
Thank-you in advance
EDIT: after doing an iterative approach (as sugested in the first answer) it seems that the external conversion service was not responding from ode. This is strange because the service worked from the browser and no error was reported when deplying. Again because of my poor knowledge I believe code speaks better than my phrasing. I have made an eclipse project just with the external currency convertor. Any help / guidance is heartly appreciated. Thank you in advance. http://www.mediafire.com/?56csca1qgt5ka9a
Your CreditRating process works fine, the error lies in the CreditBuletin process. When I test this one with soapUI, I get a selectionFailure. This error in BPEL tells you that something is wrong with a from or to in your process.
To outline the problem here is a very simplified version of the activities of your CreditBuletin process, reduced to just the initial receive, the final reply and one of your assign activities inbetween. You can paste this into the main sequence of your process to reproduce the problem.
<bpel:receive name="receiveInput" partnerLink="clientInput" operation="getLoan" portType="tns:CreditBuletinPT" variable="receiveInput" createInstance="yes"></bpel:receive>
<bpel:assign validate="no" name="AssignFinal">
<bpel:copy>
<bpel:from>
<bpel:literal>
<tns:SumaRON xmlns:tns="CreditBuletinNamespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<output>0</output>
</tns:SumaRON>
</bpel:literal>
</bpel:from>
<bpel:to variable="outputResult" part="parameters"></bpel:to>
</bpel:copy>
<bpel:copy>
<bpel:from>
<![CDATA[$loanWithInterest * bpel:getVariableData('CurrencyRateInputResponse','parameters','ConversionRateResult')]]>
</bpel:from>
<bpel:to part="parameters" variable="outputResult">
<bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
<![CDATA[output]]>
</bpel:query>
</bpel:to>
</bpel:copy>
</bpel:assign>
<bpel:reply name="outputResult" partnerLink="clientInput" operation="getLoan" portType="tns:CreditBuletinPT" variable="outputResult"></bpel:reply>
You are trying to assign the same variable twice, first with a default initialization. This doesn't make much sense, but for some reason the BPEL editor generates these initializations on default. You get a correct reply, if you change the from statement in the second copy to something else, for instance
<![CDATA[bpel:getVariableData('receiveInput','parameters','suma')]]>
So, your problem(s) come(s) from your from statements, most likely the ones that use the getVariableData() function. Now, I don't want to repair all expressions in your process (because there are many and that is your task), but I suggest to have a look at all of them. Start with a minimal working process, such as the one above with the from exchanged and do incremental updates of functionality while testing each increment. That way, you will eventually end up with something that works.
I'm using RESTlet as Server and Client. Server is running over Tomcat and I can access it from browser.
For Client, I'm using org.restlet.resource.ClientResource. It works fine if I send a few requests to that server, but if I send a few hundred calls it breaks:
Fev 20, 2013 12:59:43 PM org.restlet.engine.connector.ClientConnectionHelper start
INFO: Starting the internal [HTTP/1.1] client
(some calls work)
Fev 20, 2013 1:00:49 PM org.restlet.util.SelectionRegistration block
WARNING: The thread blocked at the cyclic barrier has timed out
java.util.concurrent.TimeoutException
at java.util.concurrent.CyclicBarrier.dowait(CyclicBarrier.java:250)
at java.util.concurrent.CyclicBarrier.await(CyclicBarrier.java:427)
at org.restlet.util.SelectionRegistration.block(SelectionRegistration.java:191)
at org.restlet.engine.io.NbChannelInputStream.onFill(NbChannelInputStream.java:230)
at org.restlet.engine.io.Buffer.process(Buffer.java:601)
at org.restlet.engine.io.NbChannelInputStream.read(NbChannelInputStream.java:307)
at java.io.InputStream.read(InputStream.java:101)
at org.restlet.engine.io.BioUtils.copy(BioUtils.java:80)
at org.restlet.engine.io.NioUtils.copy(NioUtils.java:147)
at org.restlet.representation.ReadableRepresentation.write(ReadableRepresentation.java:104)
at org.restlet.representation.ChannelRepresentation.write(ChannelRepresentation.java:76)
at org.restlet.representation.ChannelRepresentation.write(ChannelRepresentation.java:82)
Exception in thread "main" java.io.IOException: The thread blocked at the cyclic barrier has timed out.
at org.restlet.util.SelectionRegistration.block(SelectionRegistration.java:197)
at org.restlet.engine.io.NbChannelInputStream.onFill(NbChannelInputStream.java:230)
at org.restlet.engine.io.Buffer.process(Buffer.java:601)
at org.restlet.engine.io.NbChannelInputStream.read(NbChannelInputStream.java:307)
at java.io.InputStream.read(InputStream.java:101)
at org.restlet.engine.io.BioUtils.copy(BioUtils.java:80)
at org.restlet.engine.io.NioUtils.copy(NioUtils.java:147)
at org.restlet.representation.ReadableRepresentation.write(ReadableRepresentation.java:104)
at org.restlet.representation.ChannelRepresentation.write(ChannelRepresentation.java:76)
at org.restlet.representation.ChannelRepresentation.write(ChannelRepresentation.java:82)
Caused by: java.util.concurrent.TimeoutException
at java.util.concurrent.CyclicBarrier.dowait(CyclicBarrier.java:250)
at java.util.concurrent.CyclicBarrier.await(CyclicBarrier.java:427)
at org.restlet.util.SelectionRegistration.block(SelectionRegistration.java:191)
... 11 more
I wanna use Apache HTTP Client to be able to do more calls, but I can't find documentation on how to attach it.
I had the same problem but on a live production machine which caused my server to eat up 100% of CPU. I was able to solve it by going back to using restlet 2.1.0 instead of 2.1.2. Not really an answer to the underlying problem, but definitely a solution.
Every evidence points this error to be internal in RESTlet client. Instead of using it, I used URL.getInputStream(), and with that I was able to easily do 10K sequential calls to my RESTlet server. Of course URL is way simple, it's unable to handle errors and shouldn't be used in production, but it proved RESTlet isn't worth it.
I also managed to make Benchmark comparing Axis2 and RESTlet as server, and they had same performance taking 3-5 milisecs to answer a request, I expected REST to be faster... I implemented REST server directly from Servlet and it too 0-1 milisecs to respond. Because of that I decided to drop REST and stick with SOAP Axis2, it's not slower than RESTlet and just a few milisecs slower than Servlet, but it way more flexible and powerful.