"No bean found under attribute key" exception when a JSP is not accessed
HI,
We are using weblogic 7.1 SP6, Oblix and TRC struts in our application. During normal access to various pages system works fine. When the application is not accessed for 30 minutes system displays session expired exception. But some time when a page is not accessed for some time, say 15 - 20 minutes and user clicks any link system displays a exception dump in the screen. The exception displays for pages with track changes. The exception starts with following line
[ServletException in:/jsp/include/Header.jsp] No bean found under attribute key HomepageFormBean' javax.servlet.jsp.JspException: No bean bound under attribute key HomePageFormBean at org.apache.struts.taglib.logic.CompareTagBase.condition(CompareTagBase.java:221) at org.apache.struts.taglib.logic.EqualTag.condition(EqualTag.java:90)
After closing the window and tried to access the same page then the system works fine. The above exception is intermittent.
Any help is highly appreciated.
Thanks,
K.Pushparaj
Hi dear use this code i modified
<logic:iterate id="lstDelNotificationData" name="institutionHomeForm" property="delNotification_data" indexId="i" >
<table cellpadding="0" cellspacing="0" width="320" border="0">
<tr>
<td valign="top"><img src="/images/bullet2.gif" alt=" "></td>
<td>
"sm"> Your FYE <bean:write name="lstDelNotificationData" property="ins_fye"/> Annual ......is
Now u will not get bean problem
Similar Messages
-
How can I throw a hard 404 error to apache when a JSP is not found.
How can I throw a hard 404 error to apache when a JSP is not found.
I want to let apache handle the error.[email protected] (Jeremy Conner) wrote in
<[email protected]>:
>How can I throw a hard 404 error to apache when a JSP is not found.
>I want to let apache handle the error.
>
>
First thought that comes to mind is to return HTML that tells the browser
redirect to a nonexistent file under Apache. You can't tell Apache to
throw a 404 unless you're in a mod. Maybe something they could add to the
proxy, but until then, I think a redirection in the response HTML is your
only option.
Jesse
-
I get an error message when downloading ITunes "could not access the network location" %public%\desktop\?
windows vista 32 bitTry the following user tip:
"Could not access network location %PUBLIC%\Desktop\" install errors -
Capturing Key press when the focus is not on VI. (event is not working).
I have a VI, and found similar in Forums. I need to catch key down event, when the focus is not on VI.
I attached the VI found in forum. Try to click on other window, for example on block diagram of VI, when VI is running and check if it works. The answer is no, it doesn't work. When you press any key, the led button must change it's state, but it does only when the focus is on VI's front panel. The question is how to control key press, when VI is minimized or inactive. Is it possible to catch key down or any similar event, when the focus is on any other application, not on VI?
Solved!
Go to Solution.
Attachments:
simulatekeyevent.vi 16 KBHave a look at the "Connectivity...input devices..." menu.
For an example, open the example finder and look for "basic input demo". It should give you some ideas. Good luck!
LabVIEW Champion . Do more with less code and in less time . -
Null pointer exception when running JSP
I have recently configured a web application to run on a solaris 9 platform with an Oracle 10g database. I am using Sun One Web Server 6.1 SP4 as my web server. Most of my JSP's run fine but one of them is giving me the following error:
[29/Mar/2005:08:28:47] failure ( 961): for host 147.103.44.38 trying to GET /CI/searchSummary.jsp, service-j2ee reports: StandardWrapperValve[jsp]: WEB2792: Servlet.service() for servlet jsp threw exception java.lang.NullPointerException at jsps.CI._searchSummary_jsp._jspService(_searchSummary_jsp.java:366) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:908) at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(JspServlet.java:675) at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:447) at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:363) at javax.servlet.http.HttpServlet.service(HttpServlet.java:908) at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:771) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:322) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:209) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509) at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:161) at com.iplanet.ias.web.WebContainer.service(WebContainer.java:578)
I have not been able to determine the cause of this error since the line numbers in the error log refer to the servlet created when the JSP is interpreted insead of the line number in the JSP itself. Is there any way to correlate the error in the log with the actual JSP instead of the servlet that the interpreter creates? Any ideas as to what could cause this particular error? Any help would be greatly appreciated! Thanks!!!Yes, you can look at the generated java servlet code under {http-instance}/ClassCache/{instance}/{web-app}/.../_searchSummary_jsp.java
-
XMLStreamReader exception when using webservice with security access denied
Hi,
I'm using CXF webservices generated from a WSDL with SOAP document style. Under normal conditions, the client and server work fine, and can I read info back from the the server (SOAP http messages passed between both)
However, for some servers, I am using SUNs Policy Agent, which checks for an authentication token in the http header cookie before allowing access to the web service. I set up the cxf service port as follow:
Service service = Service.create(serviceName);
service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, address);
servicePort = (IMyService)service.getPort(portName, IMyService.class);
I also add the authentication token to the http header cookie in the service's request context.
If the token is correct, everything works fine. However, if the token is incorrect, and access is denied, the policy agent does not return a SOAP http message. In this case, the web service method throws a low-level XMLStreamReader exception i.e. it can't read the SOAP message response - so I can't get the actual response from the policy agent.
Would anyone have an idea on this? Should I configure the CXF port differently, or should I try to get the policy agent to return a SOAP message even if access is denied.
There is already a browser that can access the policy agent - and this needs to be redirected if access is denied. So in effect, we need the redirect functionality for the browser, and the returned SOAP message for the application using the web service.
Any help would be greatly appreciated!
RobThanks for your answer.
I eventually found a workaround for this problem.
Actually you don't need to provide an SSO cookie the first time you connect to the webgate server, you just need to provide basic credentials and the webgate will provide you an SSO cookie that you can use for the next call.
The problem is that this doesn't work out of the box with the .NET/WSDL framework for some reason (with Java + the HTTPClient library I had no problem).
I had to had manually the following headers to the HTTP request to make it work:
Authentication: Basic XXXXXXXX
Cookie: OBBasicAuth=fromDialog
Where XXXXXXXX is a base64 encoded string containing "login:password"
Thanks,
Franck -
Register 12 VerifyError exception when compiling jsp with that jsp tag!
Hi everybody,
We implemented a tag which is charged with a simple task like just "out.println"s,
on production with WL5.1 SP11,jdk1.2.
Then we got java.lang.VerifyError exception which is also denoted at Giuseppe Madonna's
mail on ( http://newsgroups2.bea.com/cgi-bin/dnewsweb?cmd=article&group=weblogic.developer.interest.jsp&item=6834&utag=
) that "java.lang.VerifyError: Register 12 contains wrong type"
To be able to find the inconsistency in class files denoted at VerifyError exception,
we delete the tmp dir. of web app resides in a war.
Also the related java beans used in jsp tag and related jsp, are in a jar on our
classpath and .tld file resides in the .war file of our web application.
But also, I must define that it is our first tag implemented after we migrate to
the .war file after the web application directory structure of same application(that
old dir. also deleted), I know it is silly but, is it possible that WL can now refer
to something related our previous directory structure of our app. like that old .tld
file or classes?
Or may it be related with the difference between jdk versions on the test and the
production server?
Any help will be really appreciated..
Many thanks,
Banu
Start up weblogic with -
java -noverify ....
Mike
"banu" <[email protected]> wrote:
>
>Hi everybody,
>We implemented a tag which is charged with a simple task like just "out.println"s,
>on production with WL5.1 SP11,jdk1.2.
>
>Then we got java.lang.VerifyError exception which is also denoted at Giuseppe
>Madonna's
>mail on ( http://newsgroups2.bea.com/cgi-bin/dnewsweb?cmd=article&group=weblogic.developer.interest.jsp&item=6834&utag=
>) that "java.lang.VerifyError: Register 12 contains wrong type"
>
>To be able to find the inconsistency in class files denoted at VerifyError
>exception,
>we delete the tmp dir. of web app resides in a war.
>
>Also the related java beans used in jsp tag and related jsp, are in a jar
>on our
>classpath and .tld file resides in the .war file of our web application.
>
>But also, I must define that it is our first tag implemented after we migrate
>to
>the .war file after the web application directory structure of same application(that
>old dir. also deleted), I know it is silly but, is it possible that WL can
>now refer
>to something related our previous directory structure of our app. like that
>old .tld
>file or classes?
>
>Or may it be related with the difference between jdk versions on the test
>and the
>production server?
>
>
>Any help will be really appreciated..
>Many thanks,
>Banu
>
-
It says the original file can not be located. If I do find it under documents it can not be accessed. (faded prilnt)
Probably not every one, but you will have to do it several times. Right click on the name of the song, show in window's explorer and when it can't it should give you a dialogue to find the song.
Once it finds one it'll offer to find more and you can locate stuff that way. -
How to listen for key press when air app does not have focus
Hi,
I am developing a application in air and part of the functionality I need is the ability for the app to listen for when a specific key is pressed, even when the air app does not have focus.
Is there support for this for windows or mac? If not, how might this be accomplished? ANE?Ok Mr. Smartass...Ok
I'm building a browser that is always open, and when
a user presses Ctrl+F1 (notice, just those two keys,
I don't care what else they press...) the browser
will open up. That way, you don't have to wait for it
to load all the time.You have two ideas here. One is having a universal key map that always gets ctrl-f1 sent to your app. The other is a program that is constantly running so that you don't have to wait for it to open up. The former is not possible (and this is a good thing) As warneria and I have been saying, it is bad design for an app to try to force an OS to implement this kind of feature.
If you're not going to help please don't post at all;
it's a waste of time for both you, me, and anyone
else who may need help on the same subject. Why wouldBelieve it or not, I am helping you.
See
http://www.google.com/search?hl=en&lr=&q=programming+code+side+effects
and
http://www.faqs.org/docs/artu/ch04s02.html
"Doug McIlroy's advice to �Do one thing well� is usually interpreted as being about simplicity. But it's also, implicitly and at least as importantly, about orthogonality."
anyone in their right mind who's trying to steal
people's passwords come out and say, "I'm not trying
to steal people's passwords!"wait, your question is why would someone trying to steal passwords say I'm not trying to steal passwords? I think duplicitous people in their right minds might try to trick you that way.
Beyond that, even if you're not a malicious hacker - and I am sure you are not - if someone posts a solution to your problem, malicious coders then will have learned how to do it. If you think you're programming or using these forums in a bubble, you are not. -
Exception when running JSP on Tomcat!Pls help me!
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: /JspTestBean3.jsp(3,4) Invalid directive
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:417)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:126)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:383)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:799)
at org.apache.jasper.compiler.Parser.parse(Parser.java:122)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:199)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:153)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:219)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:323)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:474)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:184)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2396)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
at java.lang.Thread.run(Thread.java:536)
********How to resolve this exception, i need your help. Thanks a lot.;)********I think the tag <@page > contains some invalid directive, just check it out, if didn't get any, then if possible copy and paste the jsp file content in reply
-
Why doesn't doFilter work was expected when a .jsp page is accessed?
I'm hoping an expert could point me in the right direction or tell me
if this is a bug in WebLogic.
My environment is WebLogic 6.1 (service pack 4), on Windows 2000.
I need to capture all the response data that comes back from the
servlet. So, I have a simple filter that wraps the response object,
and sends the wrapped object into filterChain.doFilter() method.
I've set up the web.xml so that any servlet access should trigger my
filter (the <url-pattern> is /*). I've also configured a sample
web-app called TEST to serve .html/.jsp pages.
When the browser makes a .html request, everything works as expected.
After the filterChain.doFilter(), I can take a look at the wrapped
response object and print the contents of the response.
However, when I access a .jsp page as part of form data submit, the
output stream of my wrapper is empty after the filterChain.doFilter()
completes.
If I don't wrap the response, then everything seems to work fine. The
.jsp gets interpreted properly by the servlet container, I can see the
result page in the browser just fine.
By inserting debug statements, I can see that if I wrap the responses,
for a .html request, under the covers, wrapper's getOutputStream()
gets called. But for a .jsp request, under the covers, wrapper's
getWriter() gets called. I don't know how significant this is, but
this is the only difference I see!
If I don't wrap the response, I am not sure how to get at the response
data. All I need to do is to take certain actions depending on the
response. That is why I'm using a wrapper to get at the response data.
In the JRun AppServer, the code just works fine.
I've enclosed the source code & the output that demonstrates the
problem.
What am I doing wrong? Or, is this a bug in WebLogic? If this is a
bug, is there a patch available?
Thanks,
--Sridhar
// HeaderFilter.java
// This is the filter that gets invoked through the web.xml
configuration
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class HeaderFilter implements Filter {
public FilterConfig filterConfig;
public void destroy() {
this.filterConfig = null;
public void init(FilterConfig filterConfig) {
this.filterConfig = filterConfig;
public FilterConfig getFilterConfig() {
return filterConfig;
public void setFilterConfig(FilterConfig filterConfig) {
this.filterConfig = filterConfig;
public void doFilter(ServletRequest req, ServletResponse resp,
FilterChain chain)
throws java.io.IOException, javax.servlet.ServletException {
ServletContext context = filterConfig.getServletContext();
HttpServletResponse response = (HttpServletResponse)resp;
TestResponseWrapper wrapper = new
TestResponseWrapper(response);
chain.doFilter(req, wrapper);
OutputStream out = resp.getOutputStream();
System.out.println("The content length is :" +
wrapper.getContentLength());
if ("text/html".equals(wrapper.getContentType())) {
byte[] data = wrapper.getData();
System.out.println("TEXT RESPONSE, length is " +
data.length);
System.out.println(new String(data));
out.write(data);
// out.close();
// TestResponseWrapper.java
// This class wraps the response object so that you could take a look
at
// the response contents after the filterConfig.doFilter() method
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
public class TestResponseWrapper extends HttpServletResponseWrapper{
private ByteArrayOutputStream output;
private int contentLength;
private String contentType;
public TestResponseWrapper(HttpServletResponse response) {
super(response);
output = new ByteArrayOutputStream();
public ServletOutputStream getOutputStream() {
System.out.println("****** getOutputStream() called *******");
return new FilterServletOutputStream(output);
public byte[] getData() {
return output.toByteArray();
public PrintWriter getWriter() {
System.out.println("****** getWriter() called *******");
return new PrintWriter(getOutputStream(), false);
public void setContentType(String type) {
System.out.println("**** Wrapper setContentType called ****");
this.contentType = type;
super.setContentType(type);
public String getContentType() {
return this.contentType;
public int getContentLength() {
return contentLength;
public void setContentLength(int length) {
System.out.println("**** Wrapper setContentLength called
this.contentLength=length;
super.setContentLength(length);
// FilterServletOutputStream.java
// This class is used by the wrapper for getOutputStream() method
// to return a ServletOutputStream object.
import javax.servlet.ServletOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.*;
public class FilterServletOutputStream extends ServletOutputStream {
private DataOutputStream stream;
public FilterServletOutputStream(OutputStream output) {
stream = new DataOutputStream(output);
public void write(int b) throws IOException {
stream.write(b);
public void write(byte[] b) throws IOException {
stream.write(b);
public void write(byte[] b, int off, int len) throws IOException {
stream.write(b, off, len);
// test.html
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title> Web Posting Information </title>
</head>
<body>
<form name="myform" method="POST" action="resource.jsp">
<input type="TEXT" name="input"></input>
<br>
<input type="SUBMIT" value="done"></input>
</form>
</body>
</html>
// resource.jsp
// This gets referenced by the test.html file
<HTML><BODY>
<head>
<title>JRun Programming Techniques</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<H3>Secure Resource Page</H3>
<p>This is a secure page.</p>
<BR><B>User: </B>
<%
// out.write(request.getParameter("input"));
%>
</BODY></HTML>
// HERE IS THE OUTPUT
// HERE IS WHAT I SEE WHEN I ACCESS
// http://localhost:7001/TEST/test.html
**** Wrapper setContentType called ****
**** Wrapper setContentLength called ****
****** getOutputStream() called *******
The content length is :331
TEXT RESPONSE, length is 331
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title> Web Posting Information </title>
</head>
<body>
<form name="myform" method="POST" action="resource.jsp">
<input type="TEXT" name="input"></input>
<br>
<input type="SUBMIT" value="done"></input>
</form>
</body>
</html>
// HERE IS WHAT I SEE WHEN I enter some value in the "input" field
// of the form, and click on the "submit" button.
// Why isn't setContentLength() getting called on the wrapper?
// It appears as if the wrapper's output stream isn't getting used
// at all!!!
**** Wrapper setContentType called ****
****** getWriter() called *******
****** getOutputStream() called *******
The content length is :0
TEXT RESPONSE, length is 0
If someone else runs into this, here is how I solved the problem -
If you create a PrintWriter object with the autoflush option, it
doesn't flush the underlying buffer till you call println on it. I
looked through the generated code for the servlet, and it was doing a
JSPWriter.print() to output information.
So, I changed the ResponseWrapper to keep a handle to the PrintWriter
object, and then flush it in the filter, and that works.
Why the same code behaves differently in JRun & Weblogic, I'm not sure
--Sridhar
-
Error when installing SP2: "Can not access specified drive..."
Hi Tim,
I had a BOE 3.1 installed on windows server 2003, however the installation was made from an external drive. When I tried to install SP2, it took a long time and the end it sent an error message about "could not find the drive E". Do you know why it depends on the drive where the installation files for BOE were?
Thanks, regards,
Sandra.creating new thread for this post to increase response.
I'm not aware of SP2 having issues with E: is it a physical drive in the server or NAS/SAN/other?
Regards,
Tim -
Tagid attribute in netui:textbox in jsp is not reflecting
Hi,
I included this netui tag in my jsp
<netui:textBox dataSource="{actionForm.custId}" tagId="custTagId"></netui:textBox>
But attribtue "tagid" doesnot seems to be reflecting in the html pages.
thanks,
shashiTanya,
This works well in a pageFlow. But it in the context of a portal it throws a JavaScript
error saying that document[getNetuiTagName("myForm")][getNetuiTagName("age")]
is null.
Thanks,
Anant
"tanya" <[email protected]> wrote:
>
I'm not sure what you mean by "reflecting", but if you're referring to
accessing
it via javascript, see the following:
http://edocs.bea.com/workshop/docs81/doc/en/workshop/guide/netui/guide/conValidatingUserInput.html
You'll end up having to do something like this:
<netui:html>
<netui:textBox tagId="age" dataSource="{actionForm.age}" onBlur="isValidAge();"/>
</netui:html>
And this would be the JavaScript function isValidAge:
function isValidAge() {
if(document[getNetuiTagName("myForm")][getNetuiTagName("age")].value
<= 0)
alert('Wrong Age');
-Tanya
"shashishekar" <[email protected]> wrote:
Hi,
I included this netui tag in my jsp
<netui:textBox dataSource="{actionForm.custId}" tagId="custTagId"></netui:textBox>
But attribtue "tagid" doesnot seems to be reflecting in the html pages.
thanks,
shashi -
Windows 7 error when installing iTunes 'Could not access network location %APPDATA%'
This error message pops up everytime i try to install iTunes on my PC. I am trying to run the 64-bit version and have also tried fixit application, bu the problem persists. How can I solve this error message?
Try disabling anti virus software and turning off the Firewall
Disable antivirus software
Turn-Windows-Firewall-on-or-off -
Invalid Key Exception: Unsupported key type: Sun RSA public key, 1024 bits
I am trying to retrieve certificates from Microsoft Keystore and extract its keys using SunMSCAPI in jdk 1.6. It gives me an invalid key exception, when I am trying to wrap the Symmetric key (which was previously used to perform AES encryption on data), using RSA algorithm.
Code snippet:
// RSA 1024 bits Asymmetric encryption of Symmetric AES key
// List the certificates from Microsoft KeyStore using SunMSCAPI.
System.out.println("List of certificates found in Microsoft Personal Keystore:");
KeyStore ks = KeyStore.getInstance("Windows-MY", "SunMSCAPI");
ks.load(null, null) ;
Enumeration en = ks.aliases() ;
PublicKey RSAPubKey = null;
Key RSAPrivKey = null;
int i = 0;
while (en.hasMoreElements()) {
String aliasKey = (String)en.nextElement() ;
X509Certificate c = (X509Certificate) ks.getCertificate(aliasKey) ;
String sss = ks.getCertificateAlias(c);
if(sss.equals("C5151997"))
System.out.println("---> alias : " + sss) ;
i= i + 1;
String str = c.toString();
System.out.println(" Certificate details : " + str ) ;
RSAPubKey = c.getPublicKey();
RSAPrivKey = ks.getKey(aliasKey, null); //"mypassword".toCharArray()
Certificate[] chain = ks.getCertificateChain(aliasKey);
System.out.println("No of certificates found from Personal MS Keystore: " + i);
// Encrypt the generated Symmetric AES Key using RSA cipher
Cipher rsaCipher = Cipher.getInstance("RSA/ECB/PKCS1Padding", ks.getProvider().getName());
rsaCipher.init(Cipher.WRAP_MODE, RSAPubKey);
byte[] encryptedSymmKey = rsaCipher.wrap(aeskey);
System.out.println("Encrypted Symmetric Key :" + new String(encryptedSymmKey));
System.out.println("Encrypted Symmetric Key Length in Bytes: " + encryptedSymmKey.length);
// RSA Decryption of Encrypted Symmetric AES key
rsaCipher.init(Cipher.UNWRAP_MODE, RSAPrivKey);
Key decryptedKey = rsaCipher.unwrap(encryptedSymmKey, "AES", Cipher.SECRET_KEY);Output:
List of certificates found in Microsoft Personal Keystore:
---> alias : C5151997
Certificate details : [
Version: V3
Subject: CN=C5151997, O=SAP-AG, C=DE
Signature Algorithm: SHA1withRSA, OID = 1.2.840.113549.1.1.5
Key: Sun RSA public key, 1024 bits
modulus: 171871587533146191561538456391418351861663300588728159334223437391061141885590024223283480319626015611710315581642512941578588886825766256507714725820048129123720143461110410353346492039350478625370269565346566901446816729164309038944197418238814947654954590754593726047828813400082450341775203029183105860831
public exponent: 65537
Validity: [From: Mon Jan 24 18:17:49 IST 2011,
To: Wed Jan 23 18:17:49 IST 2013]
Issuer: CN=SSO_CA, O=SAP-AG, C=DE
SerialNumber: [ 4d12c509 00000005 eb85]
Certificate Extensions: 6
[1]: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 07 E5 83 A1 B2 B7 DF 6B 4B 67 9C 1D 42 C9 0D F4 .......kKg..B...
0010: 35 76 D3 F7 5v..
[2]: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: E4 C4 2C 93 20 AF DA 4C F2 53 68 4A C0 E7 EC 30 ..,. ..L.ShJ...0
0010: 8C 0C 3B 9A ..;.
[3]: ObjectId: 1.3.6.1.4.1.311.21.7 Criticality=false
Extension unknown: DER encoded OCTET string =
0000: 04 30 30 2E 06 26 2B 06 01 04 01 82 37 15 08 82 .00..&+.....7...
0010: D1 E1 73 84 E4 FE 0B 84 FD 8B 15 83 E5 90 1B 83 ..s.............
0020: E6 A1 43 81 62 84 B1 DA 50 9E D3 14 02 01 64 02 ..C.b...P.....d.
0030: 01 1B ..
[4]: ObjectId: 2.5.29.17 Criticality=false
SubjectAlternativeName [
RFC822Name: [email protected]
[5]: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
DigitalSignature
Non_repudiation
Key_Encipherment
Data_Encipherment
[6]: ObjectId: 2.5.29.19 Criticality=true
BasicConstraints:[
CA:false
PathLen: undefined
Algorithm: [SHA1withRSA]
Signature:
0000: B3 C5 92 66 8D D7 ED 6D 51 12 63 CC F4 52 18 B9 ...f...mQ.c..R..
0010: B8 A6 78 F7 ED 7D 78 18 DA 71 09 C9 AE C8 49 23 ..x...x..q....I#
0020: F5 32 2F 0F D1 C0 4C 08 2B 6D 3C 11 B9 5F 5B B5 .2/...L.+m<.._[.
0030: 05 D9 CA E6 F9 0A 94 14 E7 C6 7A DB 63 FE E5 EC ..........z.c...
0040: 48 94 8C 0D 77 92 59 DE 34 6E 77 1A 24 FE E3 C1 H...w.Y.4nw.$...
0050: D8 0B 52 6A 7E 22 13 71 D7 F8 AF D1 17 C8 64 4F ..Rj.".q......dO
0060: 83 EA 2D 6A CA 7F C3 84 37 15 FE 99 73 1D 7C D1 ..-j....7...s...
0070: 6D B4 99 09 62 B9 0F 18 33 4C C6 66 7A 9F C0 DB m...b...3L.fz...
No of certificates found from Personal MS Keystore: 1
Exception in thread "main" java.security.InvalidKeyException: Unsupported key type: Sun RSA public key, 1024 bits
modulus: 171871587533146191561538456391418351861663300588728159334223437391061141885590024223283480319626015611710315581642512941578588886825766256507714725820048129123720143461110410353346492039350478625370269565346566901446816729164309038944197418238814947654954590754593726047828813400082450341775203029183105860831
public exponent: 65537
at sun.security.mscapi.RSACipher.init(RSACipher.java:176)
at sun.security.mscapi.RSACipher.engineInit(RSACipher.java:129)
at javax.crypto.Cipher.init(DashoA13*..)
at javax.crypto.Cipher.init(DashoA13*..)
at com.sap.srm.crpto.client.applet.CryptoClass.main(CryptoClass.java:102)
Edited by: sabre150 on 18-Jul-2011 03:47
Added [ code] tags to make code readable.A bit of research indicates that the classes of the keys obtained by
RSAPubKey = c.getPublicKey();
RSAPrivKey = ks.getKey(aliasKey, null); //"mypassword".toCharArray()are sun.security.rsa.RSAPublicKeyImpl and sun.security.*mscapi*.RSAPrivateKey . It seems that for Cipher objects from the SunMSCAPI provider cannot accept RSA public keys of class sun.security.rsa.RSAPublicKeyImpl and that the SunMSCAPI will only accept RSA private keys of class sun.security.mscapi.RSAPrivateKey.
This came up under different guise a couple of years ago. It makes sense since encrypting/wrapping with a public key does not represent a security problem (there is nothing secret in any of the encryption operations) when done outside of MSCAPI so one can use any provider that has the capability BUT the decryption/unwrapping must be done with the SunMSCAPI provider which delegates it to the MSCAPI.
My working test code based on your code implementing this approach is :
// RSA 1024 bits Asymmetric encryption of Symmetric AES key
// List the certificates from Microsoft KeyStore using SunMSCAPI.
System.out.println("List of certificates found in Microsoft Personal Keystore:");
KeyStore ks = KeyStore.getInstance("Windows-MY", "SunMSCAPI");
ks.load(null, null);
Enumeration en = ks.aliases();
PublicKey RSAPubKey = null;
Key RSAPrivKey = null;
int i = 0;
while (en.hasMoreElements())
String aliasKey = (String) en.nextElement();
X509Certificate c = (X509Certificate) ks.getCertificate(aliasKey);
String sss = ks.getCertificateAlias(c);
if (sss.equals("rsa_key")) // The alias for my key - make sure you change it back to your alias
System.out.println("---> alias : " + sss);
i = i + 1;
String str = c.toString();
System.out.println(" Certificate details : " + str);
RSAPubKey = c.getPublicKey();
System.out.println(RSAPubKey.getClass().getName());
RSAPrivKey = ks.getKey(aliasKey, null); //"mypassword".toCharArray()
System.out.println(RSAPrivKey.getClass().getName());
Certificate[] chain = ks.getCertificateChain(aliasKey);
System.out.println(ks.getProvider().getName());
System.out.println("No of certificates found from Personal MS Keystore: " + i);
Cipher rsaCipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");//, ks.getProvider().getName()); !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
rsaCipher.init(Cipher.WRAP_MODE, RSAPubKey);
byte[] keyBytes =
1, 2, 3, 4, 5, 6, 7, 8, 2, 3, 4, 5, 6, 7, 8, 9
SecretKey aeskey = new SecretKeySpec(keyBytes, "AES");
byte[] encryptedSymmKey = rsaCipher.wrap(aeskey);
System.out.println("Encrypted Symmetric Key :" + Arrays.toString(encryptedSymmKey));
System.out.println("Encrypted Symmetric Key Length in Bytes: " + encryptedSymmKey.length);
// RSA Decryption of Encrypted Symmetric AES key
Cipher unwrapRsaCipher = Cipher.getInstance("RSA/ECB/PKCS1Padding", ks.getProvider().getName()); //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
unwrapRsaCipher.init(Cipher.UNWRAP_MODE, RSAPrivKey);
Key decryptedKey = unwrapRsaCipher.unwrap(encryptedSymmKey, "AES", Cipher.SECRET_KEY);
System.out.println("Decrypted Symmetric Key :" + Arrays.toString(decryptedKey.getEncoded())); // Matches the 'keyBytes' above
Maybe you are looking for
-
Error in loading WebUtil package
Dear all, i have the following problem, we have install the application server on one machine Windows server 2003 Enterprise edition (both the infra and middle tier on the same machine), and we wanted to configure the webutil package with this instal
-
Third Party Sales Order Change
Hi Gurus I have a situationin third party processing. When the sales order is created with IC = TAS, it fires PR which is then converted to a PO. However after the PO is generated, if Qty in Sales order is changed it does not update the PO. Have you
-
Help please....i'm hoping to set it up and give as a gift
-
Multiple channel data with different time stamp logging
I have peaks and valleys from multiple channels with different time stamp but I am not able to log to a single file. Any idea on how to do this? Attachments: Single Point Peak Valley Log.vi 53 KB
-
Macbook GMA X3100 drivers?
hello everybody, Does anyone know if there are new drivers or updates for the GMA X3100 grafic card,for my macbook. When i play a movie or if i do visualities in itunes the grafic card cant handle it,what to do? thanx