Error loading war to tomcat6 - eclipse

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.

Related

Apache Ignite crash on startup

I'm using Apache Ignite entity framework Nuget as a second level cache in an ApsNetCore 2.0 web application under IIS(as reverse proxy).
On my development machine (VS2017 Windows 8.1) everything works well. Wen i deploy to WindowsServer 2012 the Ignite crash at startup with :
An error occurred while starting the application.
IgniteException: Failed to load jvm.dll (Please specify IgniteConfiguration.JvmDllPath or JAVA_HOME.)
Apache.Ignite.Core.Impl.Unmanaged.Jni.JvmDll.Load(string configJvmDllPath, ILogger log)
TargetInvocationException: Exception has been thrown by the target of an invocation.
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, bool publicOnly, bool noCheck, ref bool canBeCached, ref RuntimeMethodHandleInternal ctor, ref bool bNeedSecurityCheck)
IgniteException: Failed to load jvm.dll (Please specify IgniteConfiguration.JvmDllPath or JAVA_HOME.)
Apache.Ignite.Core.Impl.Unmanaged.Jni.JvmDll.Load(string configJvmDllPath, ILogger log)
Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
Apache.Ignite.EntityFramework.IgniteDbConfiguration.GetOrStartIgnite(IgniteConfiguration cfg)
Apache.Ignite.EntityFramework.IgniteDbConfiguration..ctor()
I checked and re-chewed, installed the JDK , correct system variables....everything. The error don't goes away. What is interesting is the application run ok as console. When it runs under IIS(reverse proxy) it crashes at startup with the above error.
Any suggestions ?
Thank you
I managed to start the website. How ? Only with JDK 11 and explicit path to jvm.dll on app.config file:
If is not explicit in config then crashes.
The JAVA_HOME from system variable is correct set. Also the Path variable is
%JAVA_HOME%;%JAVA_HOME%\bin;%JAVA_HOME%\bin\server;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0;C:\Program Files\Microsoft\Web Platform Installer;C:\Program Files\dotnet;C:\Program Files (x86)\dotnet;C:\ProgramData\chocolatey\bin;C:\Program Files\Memurai;C:\Program Files\Java\jdk-15.0.1\bin\
Maybe is a conflict with C:\Program Files\Java\jdk-15.0.1\bin\ ? It carsh with jvm 15. But it works with jvm 11
Looks like the IIS worker process is running in 32-bit mode, so Ignite looks for a 32-bit JDK, which is not present.
And the console app runs in 64-bit mode, using 64-bit JDK, so it works.
Please check the app pool settings in IIS Manager -> Application Pools -> select the app pool you want and -> Advanced Settings.
Additionally, you can enable detailed logging to a file (since you can't see console logs in IIS) - Ignite logs all attempts to resolve the JDK path. For example, with Apache.Ignite.NLog package:
var nlogConfig = new LoggingConfiguration();
var fileTarget = new FileTarget
{
FileName = "/home/pavel/w/ignite_nlog.log"
};
nlogConfig.AddTarget("logfile", fileTarget);
nlogConfig.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, fileTarget));
LogManager.Configuration = nlogConfig;
var igniteConfig = new IgniteConfiguration
{
Logger = new IgniteNLogLogger()
};
Ignition.Start(igniteConfig);
I've checked the suggested points by Pavel Tupitsyn:
App pool aplication is 64bits (emable 32bits=false)
I've installed apache.Ignite.NLog
I'tested it on my machine and it logs well all java resolves.
I've deployed to windows server 2012 and under IIS i'm getting 'Process Failure'.
The log file looks like:
2020-12-07 19:39:38.3304|DEBUG||Starting Ignite.NET 2.9.0.50002
2020-12-07 19:39:38.3834|WARN||GC server mode is not enabled, this could lead to less than optimal performance on multi-core machines (to enable see http://msdn.microsoft.com/en-us/library/ms229357(v=vs.110).aspx).
2020-12-07 19:39:46.2534|DEBUG||Starting Ignite.NET 2.9.0.50002
so...just a warning (present on my machine too).
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info:
Apache.Ignite.Core.Common.IgniteException
at Apache.Ignite.Core.Impl.Unmanaged.Jni.JvmDll.Load(System.String, Apache.Ignite.Core.Log.ILogger)
at Apache.Ignite.Core.Ignition.Start(Apache.Ignite.Core.IgniteConfiguration)
at Nop.Web.Program.Main(System.String[])
well...adding apache.ingite.nlog throws PROCESS FAILURE
Hosting is virtual machine with Windows Server 2012 64bits
Any other ideas please....

Error upgrading Jasperreports server from 7.2 to 7.5 (keystore problem)

The upgrade procedure is pretty simple and well documented. I have been upgrading jasperreports server since version 4 always using the same procedure (buildomatic).
Now, in 7.5 version I get
java.lang.RuntimeException: KeystoreManager was never initialized or
there are errors while instantiating the instance.
Failed to instantiate
[com.jaspersoft.jasperserver.crypto.KeystoreManager]: Please make sure
that create-keystore was executed;
Error creating bean with name 'keystoreManager': Invocation of init
method failed;
Error creating bean with name 'passwordEncoder': Unsatisfied
dependency expressed through field 'keystoreManager';
The keystore is in /root folder, as it should.
Have you tried the process mentioned in this link https://community.jaspersoft.com/wiki/encryption-jasperreports-server-75
"If the JasperReports Server cannot find the keystore files - maybe because of permissions as noted above, you will get an exception on server start like:
Failed to instantiate [com.jaspersoft.jasperserver.crypto.KeystoreManager]: Please make sure that create-keystore was executed; nested exception is java.lang.RuntimeException: KeystoreManager was never initialized or there are errors while instantiating the instance.
To fix this, you need to move the keystore files into a directory that is accessible by the user running the web app process. See Updating keystore files below."

JavaMail crashes after build/deploy on Glassfish 4

My current project includes using of a JavaMail for confirming an user email. The problem I have is that, using eclipse, every time I build & deploy my web application on the local Glassfish server the JavaMail crashes with the following exception:
Severe: java.lang.SecurityException: Access to default session denied
at javax.mail.Session.getDefaultInstance(Session.java:333)
at utils.MailService.sendEmailSSL(MailService.java:58)
And here the code snipped where I'm obtaining the session and which is throwing the above exception:
Session session = Session.getDefaultInstance(
props,
new javax.mail.Authenticator(){
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(usr, pwd);
}
});
The workaround I've found so far is restarting Glassfish and after that JavaMail functions properly again. The problem is it is very annoying and time consuming doing a restart even after the smallest change in my code.
My question: Is there a possibility to reset only the JavaMail service and bind this with the build event?
Off course any other suggestions are welcome too :)
If you can avoid using Session.getDefaultInstance. Use Session.getInstance and fix some of the common mistakes.

Eclipse, Tomcat, Jersey /JAXB: Hot redeployment problems

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!

Jboss shows error with datasource on startup

On starting jboss I am getting the following error :
--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboss.jca:service=DataSourceBinding,name=DefaultDS
State: NOTYETINSTALLED
Depends On Me:
jboss.ejb:service=EJBTimerService,persistencePolicy=database
jboss:service=KeyGeneratorFactory,type=HiLo
jboss.mq:service=StateManager
jboss.mq:service=PersistenceManager
And for all database connections in the servlet I get the following exception :
org.postgresql.util.PSQLException: FATAL: password a
uthentication failed for user "poll"
It was working fine and all of a sudden I started getting these errors. My password is correct. I even tried changing the password and then tried again it showed the same exception. What is happening here?
The DefaultDS data source is what the name suggests; the default datasource. It ships with JBoss and is configured to use the Hypersonic (ie in-memory) database. JBoss uses the DefaultDS datasource to read/write internal queues, timed events, etc
Check the file ../conf/standardjbosscmp-jdbc.xml to see what you've got configured for the DefaultDS datasource. It sounds like you've edited that file unintentionally. Unless you need to persist internal queues etc across boots, just leave it as shipped using Hypersonic.
See the JBoss doc for more.