“SecurityException: sealing violation” when starti

2019-01-23 09:19发布

问题:

I need do start the derby server from my java application using "org.apache.derby.drda.NetworkServerControl" class.
When I try to start the server it throws an exception.

Code:

NetworkServerControl server = null; 
server=new NetworkServerControl(InetAddress.getLocalHost(),1527,"user","123")
server.start(new PrintWriter(System.out));

Error:

Caused by: java.lang.SecurityException: sealing violation: package org.apache.derby.impl.store.raw.xact is sealed

Can anybody tell me the reason for this error?

回答1:

You have probably Derby classes twice on your classpath. Look for Derby classes in some another jar archive and use them only once.



回答2:

I was facing same problem. I was packaging my application using One Jar. One Jar has it's own class loader which could cause the issue. If you are using One Jar, Try packaging your app without One Jar and verify.



回答3:

I has this problem in Squirrel. I tried to add a new Derby embedded driver and I had the error.

Then I closed Squirrel, removed derby**.jar from "c:\Program Files\squirrel-sql-3.5.0\lib\", started Squirrel and added the new driver successfully.